How to use the @pulumi/kubernetes.yaml function in @pulumi/kubernetes

To help you get started, we’ve selected a few @pulumi/kubernetes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / pulumi-kubernetes / tests / sdk / nodejs / examples / yaml-guestbook / index.ts View on Github external
// Copyright 2016-2018, Pulumi Corporation.  All rights reserved.

import * as k8s from "@pulumi/kubernetes";

// Create resources from standard Kubernetes guestbook YAML example.
const guestbook = new k8s.yaml.ConfigGroup("guestbook", { files: "yaml/*.yaml" });

// Export the (cluster-private) IP address of the Guestbook frontend.
export const frontendIp = guestbook.getResource("v1/Service", "frontend", "spec").clusterIP;
github pulumi / pulumi-kubernetes / tests / sdk / nodejs / aliases / step2 / index.ts View on Github external
//
//     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 k8s from "@pulumi/kubernetes";

//
// Force a rollout and ensure update completes successfully.
//

new k8s.yaml.ConfigFile("alias-test", {file: "manifests/av1DeploymentRollout.yaml"});
github pulumi / pulumi-eks / nodejs / eks / dashboard.ts View on Github external
export function createDashboard(name: string, args: DashboardOptions, parent: pulumi.ComponentResource, k8sProvider: k8s.Provider) {
    // Deploy the latest version of the k8s dashboard.
    const dashboardYaml = [
        path.join(__dirname, "dashboard", "kubernetes-dashboard.yaml"),
        path.join(__dirname, "dashboard", "heapster.yaml"),
        path.join(__dirname, "dashboard", "influxdb.yaml"),
        path.join(__dirname, "dashboard", "heapster-rbac.yaml"),
    ].map(filePath => fs.readFileSync(filePath).toString());
    const dashboard = new k8s.yaml.ConfigGroup(`${name}-dashboard`, {
        yaml: dashboardYaml,
    }, { parent: parent, providers: { kubernetes: k8sProvider } });

    // Create a service account for admin access.
    const adminAccount = new k8s.core.v1.ServiceAccount(`${name}-eks-admin`, {
        metadata: {
            name: "eks-admin",
            namespace: "kube-system",
        },
    }, { parent: parent, provider: k8sProvider });

    // Create a role binding for the admin account.
    const adminRoleBinding = new k8s.rbac.v1.ClusterRoleBinding(`${name}-eks-admin`, {
        metadata: {
            name: "eks-admin",
        },
github pulumi / pulumi-kubernetes / tests / sdk / nodejs / examples / prometheus-operator / index.ts View on Github external
constructor(
        name: string,
        args: PrometheusOperatorArgs,
        opts?: pulumi.ComponentResourceOptions,
    ) {
        super('pulumi:monitoring/v1:PrometheusOperator', name, {}, opts);

        this.configFile = new k8s.yaml.ConfigFile(name, {
            file: 'https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.38.1/bundle.yaml',
        }, {parent: this});

        this.service = this.configFile.getResource("v1/Service", "default", "prometheus-operator");
    }
}
github pulumi / pulumi-kubernetes / tests / integration / yaml-url / step1 / index.ts View on Github external
function configFile(name: string, namespace: string, resourcePrefix?: string): k8s.yaml.ConfigFile {
    return new k8s.yaml.ConfigFile(name, {
        file: "https://raw.githubusercontent.com/pulumi/pulumi-kubernetes/master/tests/examples" +
            "/yaml-guestbook/yaml/guestbook.yaml",
        resourcePrefix: resourcePrefix,
        transformations: [
            (obj: any) => {
                if (obj !== undefined) {
                    if (obj.metadata !== undefined) {
                        obj.metadata.namespace = namespace;
                    } else {
                        obj.metadata = {namespace: namespace};
                    }
                }
            }
        ]
    });
}
github pulumi / pulumi-kubernetes / tests / sdk / nodejs / secrets / step1 / index.ts View on Github external
password: Buffer.from(rawPW).toString("base64"),
    }
});

const randSuffix = Math.random().toString(36).substring(7);
const name = `test-${randSuffix}`;

const secretYaml = `
apiVersion: v1
kind: Secret
metadata:
  name: ${name}
stringData:
  password: ${rawPW}
`
const cg = new k8s.yaml.ConfigGroup("example", {
    yaml: secretYaml,
});

export const cmDataData = cmData.data;
export const cmBinaryDataData = cmBinaryData.binaryData;
export const ssStringDataData = ssStringData.data;
export const ssDataData = ssData.data;
export const cgSecret = cg.getResource("v1/Secret", name).stringData;
github pulumi / pulumi-kubernetes / tests / sdk / nodejs / examples / prometheus-operator / step1 / index.ts View on Github external
constructor(
        name: string,
        args: PrometheusOperatorArgs,
        opts?: pulumi.ComponentResourceOptions,
    ) {
        super('pulumi:monitoring/v1:PrometheusOperator', name, {}, opts);

        this.configFile = new k8s.yaml.ConfigFile(name, {
            file: 'https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.38.1/bundle.yaml',
        }, {parent: this});

        this.service = this.configFile.getResource("v1/Service", "default", "prometheus-operator");
    }
}
github pulumi / pulumi-kubernetes / tests / integration / istio / step1 / index.ts View on Github external
{ provider: k8sProvider }
);

function addNamespace(o: any) {
    if (o !== undefined) {
        o.metadata.namespace = "bookinfo";
    }
}

const bookinfo = new k8s.yaml.ConfigFile(
    "yaml/bookinfo.yaml",
    { transformations: [addNamespace] },
    { dependsOn: istio, providers: { kubernetes: k8sProvider } }
);

new k8s.yaml.ConfigFile(
    "yaml/bookinfo-gateway.yaml",
    { transformations: [addNamespace] },
    { dependsOn: bookinfo, providers: { kubernetes: k8sProvider } }
);

export const port = istio
    .getResourceProperty("v1/Service","istio-system", "istio-ingressgateway", "spec")
    .apply(p => p.ports.filter(p => p.name == "http2"));

export const frontendIp = pulumi
    .all([
        istio.getResourceProperty("v1/Service", "istio-system", "istio-ingressgateway", "status"),
        istio.getResourceProperty("v1/Service", "istio-system", "istio-ingressgateway", "spec")
    ])
    .apply(([status, spec]) => {
        const port = spec.ports.filter(p => p.name == "http2")[0].port;
github pulumi / pulumi-kubernetes / tests / sdk / nodejs / yaml-url / step1 / index.ts View on Github external
function configFile(name: string, namespace: string, resourcePrefix?: string): k8s.yaml.ConfigFile {
    return new k8s.yaml.ConfigFile(name, {
        file: "https://raw.githubusercontent.com/pulumi/pulumi-kubernetes/master/tests/sdk/nodejs/examples/yaml-guestbook/yaml/guestbook.yaml",
        resourcePrefix: resourcePrefix,
        transformations: [
            (obj: any) => {
                if (obj !== undefined) {
                    if (obj.metadata !== undefined) {
                        obj.metadata.namespace = namespace;
                    } else {
                        obj.metadata = {namespace: namespace};
                    }
                }
            }
        ]
    });
}

@pulumi/kubernetes

[![Build Status](https://travis-ci.com/pulumi/pulumi-kubernetes.svg?token=eHg7Zp5zdDDJfTjY8ejq&branch=master)](https://travis-ci.com/pulumi/pulumi-kubernetes) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM

Apache-2.0
Latest version published 17 days ago

Package Health Score

92 / 100
Full package analysis