Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const namespace = new k8s.core.v1.Namespace("test-namespace");
//
// `get`s the Kubernetes API service.
//
const svc = k8s.core.v1.Service.get("kube-api", "default/kubernetes");
// This will fail with a TypeError if the status was not populated (i.e. the .get isn't working)
export const loadBalancer = svc.status.loadBalancer;
//
// Create a CustomResourceDefinition, a CustomResource, and then `.get` it.
//
const ct = new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-cron-object",
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as k8s from "@pulumi/kubernetes";
const namespace = new k8s.core.v1.Namespace("test-namespace");
//
// Delete the CustomResourceDefinition. On the next refresh, the CustomResource will be
// automatically deleted from the state rather than returning a "kind not found" error.
// This is a contrived example for testing, and it doesn't make any sense to delete a
// CRD while leaving related CRs.
//
new k8s.apiextensions.CustomResource(
"my-new-foobar-object",
{
apiVersion: "stable.example.com/v1",
kind: "FooBar",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-foobar-object",
},
spec: { foo: "such amaze" }
},
);
import * as k8s from "@pulumi/kubernetes";
const namespace = new k8s.core.v1.Namespace("test-namespace");
//
// `get`s the Kubernetes API service.
//
k8s.core.v1.Service.get("kube-api", "default/kubernetes");
//
// Create a CustomResourceDefinition, a CustomResource, and then `.get` it.
//
const ct = new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-cron-object",
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as k8s from "@pulumi/kubernetes";
const namespace = new k8s.core.v1.Namespace("test-namespace");
//
// Create a CustomResourceDefinition and a CustomResource.
//
new k8s.apiextensions.v1beta1.CustomResourceDefinition("foobar", {
metadata: { name: "foobars.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "foobars",
singular: "foobar",
kind: "FooBar",
shortNames: ["fb"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-foobar-object",
const namespace = new k8s.core.v1.Namespace("test-namespace");
//
// `get`s the Kubernetes API service.
//
const svc = k8s.core.v1.Service.get("kube-api", "default/kubernetes");
// This will fail with a TypeError if the status was not populated (i.e. the .get isn't working)
export const loadBalancer = svc.status.loadBalancer;
//
// Create a CustomResourceDefinition, a CustomResource, and then `.get` it.
//
const ct = new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-cron-object",
const myMonitoring = prometheusOperator.service.apply(service => {
return new k8s.apiextensions.CustomResource('my-monitoring', {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'ServiceMonitor',
spec: {
selector: {
matchLabels: { app: 'my-app' },
},
endpoints: [
{
port: 'http',
interval: '65s',
// start with the following
relabelings: [
{
regex: '(.*)',
targetLabel: 'stackdriver',
replacement: 'true',
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
const namespace = new k8s.core.v1.Namespace("test-namespace");
const idNamespace = namespace.metadata.name;
k8s.apiextensions.CustomResource.get("my-new-cron-object-get", {
apiVersion: "stable.example.com/v1",
kind: "CronTab",
id: pulumi.interpolate `${idNamespace}/my-new-cron-object`,
});
const ct = new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-cron-object",
{
apiVersion: "stable.example.com/v1",
kind: "CronTab",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-cron-object",
},
spec: { cronSpec: "* * * * */5", image: "my-awesome-cron-image" }
},
{ dependsOn: ct }
);
const ct = new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-cron-object",
{
apiVersion: "stable.example.com/v1",
kind: "CronTab",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-cron-object",
},
spec: { cronSpec: "* * * * */5", image: "my-awesome-cron-image" }
},
{ dependsOn: ct }
);
k8s.apiextensions.CustomResource.get("my-new-cron-object-get", {
apiVersion: "stable.example.com/v1",
kind: "CronTab",
const ct = new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
}
}
});
new k8s.apiextensions.CustomResource(
"my-new-cron-object",
{
apiVersion: "stable.example.com/v1",
kind: "CronTab",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-cron-object",
},
spec: { cronSpec: "* * * * */5", image: "my-awesome-cron-image" }
},
{ dependsOn: ct }
);