Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function chart(resourcePrefix?: string): k8s.helm.v2.Chart {
return new k8s.helm.v2.Chart("nginx-lego", {
// Represents chart `stable/nginx-lego@v0.3.1`.
path: "nginx-lego",
version: "0.3.1",
resourcePrefix: resourcePrefix,
values: {
// Override for the Chart's `values.yml` file. Use `null` to zero out resource requests so it
// can be scheduled on our (wimpy) CI cluster. (Setting these values to `null` is the "normal"
// way to delete values.)
nginx: {resources: null},
default: {resources: null},
lego: {resources: null}
},
transformations: [
// Make every service private to the cluster, i.e., turn all services into ClusterIP instead of
// LoadBalancer.
(obj: any) => {
"cluster-admin-binding",
{
metadata: { name: "cluster-admin-binding" },
roleRef: {
apiGroup: "rbac.authorization.k8s.io",
kind: "ClusterRole",
name: "cluster-admin"
},
subjects: [
{ apiGroup: "rbac.authorization.k8s.io", kind: "User", name: config.gcpUsername }
]
},
{ provider: k8sProvider }
);
export const istio = new k8s.helm.v2.Chart(
appName,
{
chart: "istio",
namespace: namespace.metadata.name,
version: "1.0.1",
fetchOpts: { repo: "https://istio.io/charts/" },
// for all options check https://github.com/istio/istio/tree/master/install/kubernetes/helm/istio
values: { kiali: { enabled: true } }
},
{ dependsOn: [namespace, adminBinding], providers: { kubernetes: k8sProvider } }
);
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import { config } from "./config";
const projectName = pulumi.getProject();
const provider = new k8s.Provider("provider", {
kubeconfig: config.kubeconfig,
});
export const appsNamespaceName = config.appsNamespaceName
// Deploy NGINX ingress controller using the Helm chart.
const nginx = new k8s.helm.v2.Chart("nginx",
{
namespace: config.appSvcsNamespaceName,
chart: "nginx-ingress",
version: "1.24.4",
fetchOpts: {repo: "https://kubernetes-charts.storage.googleapis.com/"},
values: {controller: {publishService: {enabled: true}}},
transformations: [
(obj: any) => {
// Do transformations on the YAML to set the namespace
if (obj.metadata) {
obj.metadata.namespace = config.appSvcsNamespaceName;
}
},
],
},
{providers: {kubernetes: provider}},
password,
};
return r;
});
// Storage the docker registry credentials as a secret
const secretRegistry = new k8s.core.v1.Secret("registry-secret", {
data: {
".dockercfg": dockercfg.apply(c => Buffer.from(JSON.stringify(c)).toString("base64")),
},
type: "kubernetes.io/dockercfg",
},
{ provider: args.k8sProvider, parent: this });
// Deploy a KEDA Edge Helm chart
const keda = new k8s.helm.v2.Chart("keda-edge", {
repo: "kedacore",
chart: "keda-edge",
version: "0.0.1-2019.07.24.21.37.42-8ffd9a3",
values: {
logLevel: "debug",
},
}, { providers: { kubernetes: args.k8sProvider }, parent: this });
this.k8sProvider = args.k8sProvider;
this.registry = registry;
this.registrySecretName = secretRegistry.metadata.name;
this.registerOutputs();
}
}
//
// 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";
import * as config from "./config";
// Deploy the latest version of the stable/wordpress chart.
const wordpress = new k8s.helm.v2.Chart(
"wpdev",
{
repo: "stable",
version: "2.1.3",
chart: "wordpress",
},
{ providers: { kubernetes: config.k8sProvider } },
);
// Export the public IP for Wordpress.
export const frontendIp = wordpress
.getResourceProperty("v1/Service", "wpdev-wordpress", "status")
.apply(status => status.loadBalancer.ingress[0].ip);
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as k8s from "@pulumi/kubernetes";
import * as util from "./util";
// Install Prometheus on the cluster.
const prometheus = new k8s.helm.v2.Chart("p8s", {
repo: "stable",
chart: "prometheus",
version: "6.10.0",
});
const containerName = "example-app";
// Define Pod template that deploys an instrumented app. Annotation `prometheus.io/scrape` instructs
// Prometheus to scrape this pod for metrics.
const instrumentedPod = {
metadata: { annotations: { "prometheus.io/scrape": "true" }, labels: { app: "example-app" } },
spec: {
containers: [
{
name: containerName,
// Prometheus-instrumented app that generates artificial load on itself.
image: "fabxc/instrumented_app",
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
// Minikube does not implement services of type `LoadBalancer`; require the user to specify if we're
// running on minikube, and if so, create only services of type ClusterIP.
const config = new pulumi.Config();
if (config.require("isMinikube") === "true") {
throw new Error("This example does not yet support minikube");
}
// Deploy the latest version of the stable/wordpress chart.
const wordpress = new k8s.helm.v2.Chart("wpdev", {
repo: "stable",
version: "2.1.3",
chart: "wordpress",
});
// Export the public IP for Wordpress.
const frontend = wordpress.getResourceProperty("v1/Service", "wpdev-wordpress", "status");
export const frontendIp = frontend.apply(status => status.loadBalancer.ingress[0].ip);
"cluster-admin-binding",
{
metadata: { name: "cluster-admin-binding" },
roleRef: {
apiGroup: "rbac.authorization.k8s.io",
kind: "ClusterRole",
name: "cluster-admin"
},
subjects: [
{ apiGroup: "rbac.authorization.k8s.io", kind: "User", name: config.gcpUsername }
]
},
{ provider: k8sProvider }
);
export const istio_init = new k8s.helm.v2.Chart(
`${appName}-init`,
{
path: "charts/istio-init",
namespace: namespace.metadata.name,
values: { kiali: { enabled: true } }
},
{ dependsOn: [namespace, adminBinding], providers: { kubernetes: k8sProvider } }
);
export const crd10 = namespace.metadata.name.apply(ns => istio_init.getResource("batch/v1/Job", ns, "istio-init-crd-10"));
export const crd11 = namespace.metadata.name.apply(ns => istio_init.getResource("batch/v1/Job", ns, "istio-init-crd-11"));
export const crd12 = namespace.metadata.name.apply(ns => istio_init.getResource("batch/v1/Job", ns, "istio-init-crd-12"));
export const istio = new k8s.helm.v2.Chart(
appName,
{
import * as k8s from "@pulumi/kubernetes";
const namespace = new k8s.core.v1.Namespace("test");
new k8s.helm.v3.Chart("skip-crd-rendering", {
skipCRDRendering: true,
namespace: namespace.metadata.name,
path: "helm-skip-crd-rendering",
});
new k8s.helm.v3.Chart("allow-crd-rendering", {
skipCRDRendering: false,
namespace: namespace.metadata.name,
path: "helm-allow-crd-rendering",
});
function chart(resourcePrefix?: string): k8s.helm.v3.Chart {
return new k8s.helm.v3.Chart("nginx", {
path: "nginx",
namespace: namespaceName,
resourcePrefix: resourcePrefix,
values: {
service: { type: "ClusterIP" }
},
transformations: [
(obj: any, opts: pulumi.CustomResourceOptions) => {
if (obj.kind == "Service" && obj.apiVersion == "v1") {
opts.additionalSecretOutputs = ["status"];
}
}
]
});
}