Skip to content

Commit

Permalink
chore: change helm chart and NS
Browse files Browse the repository at this point in the history
  • Loading branch information
dirien committed Dec 13, 2024
1 parent cfd629c commit 5b4c49e
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 81 deletions.
27 changes: 11 additions & 16 deletions helm-kubernetes-csharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
return await Deployment.RunAsync(() =>
{
var config = new Config();
var k8sNamespace = config.Get("k8sNamespace") ?? "default";
var k8sNamespace = config.Get("k8sNamespace") ?? "ingress-nginx";
var appLabels = new InputMap<string>
{
{ "app", "nginx-ingress" },
{ "app", "ingress-nginx" },
};

var ingressns = new Kubernetes.Core.V1.Namespace("ingressns", new()
Expand All @@ -22,33 +22,28 @@

var ingresscontroller = new Kubernetes.Helm.V3.Release("ingresscontroller", new()
{
Chart = "nginx-ingress",
Chart = "ingress-nginx",
Namespace = ingressns.Metadata.Apply(m => m.Name),
RepositoryOpts = new Kubernetes.Types.Inputs.Helm.V3.RepositoryOptsArgs
{
Repo = "https://helm.nginx.com/stable",
Repo = "https://kubernetes.github.io/ingress-nginx",
},
SkipCrds = true,
Values = new Dictionary<string, object>
{
["serviceAccount"] = new Dictionary<string, object>
{
["automountServiceAccountToken"] = "true"
},
["controller"] = new Dictionary<string, object>
{
["enableCustomResources"] = "false",
["appprotect"] = new Dictionary<string, object>
{
["enable"] = "false"
},
["appprotectdos"] = new Dictionary<string, object>
{
["enable"] = "false"
},
["service"] = new Dictionary<string, object>
["publishService"] = new Dictionary<string, object>
{
["extraLabels"] = appLabels
["enabled"] = "true"
},
},
},
Version = "0.14.1",
Version = "4.11.3",
});

return new Dictionary<string, object?>
Expand Down
2 changes: 1 addition & 1 deletion helm-kubernetes-csharp/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ template:
description: A C# program to deploy a Helm chart onto a Kubernetes cluster
config:
k8sNamespace:
default: nginx-ingress
default: ingress-nginx
description: The Kubernetes namespace to deploy into
2 changes: 1 addition & 1 deletion helm-kubernetes-go/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ template:
description: A Go program to deploy a Helm chart onto a Kubernetes cluster
config:
k8sNamespace:
default: nginx-ingress
default: ingress-nginx
description: The Kubernetes namespace to deploy into
22 changes: 10 additions & 12 deletions helm-kubernetes-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
k8sNamespace = "default"
}
appLabels := pulumi.StringMap{
"app": pulumi.String("nginx-ingress"),
"app": pulumi.String("ingress-nginx"),
}

// Create a new namespace (user supplies the name of the namespace)
Expand All @@ -32,27 +32,25 @@ func main() {

// Use Helm to install the Nginx ingress controller
ingresscontroller, err := helmv3.NewRelease(ctx, "ingresscontroller", &helmv3.ReleaseArgs{
Chart: pulumi.String("nginx-ingress"),
Chart: pulumi.String("ingress-nginx"),
Namespace: ingressNs.Metadata.Name(),
RepositoryOpts: &helmv3.RepositoryOptsArgs{
Repo: pulumi.String("https://helm.nginx.com/stable"),
Repo: pulumi.String("https://kubernetes.github.io/ingress-nginx"),
},
SkipCrds: pulumi.Bool(true),
Values: pulumi.Map{
"servicAccount": pulumi.Map{
"automountServiceAccountToken": pulumi.Bool(true),
},
"controller": pulumi.Map{
"enableCustomResources": pulumi.Bool(false),
"appprotect": pulumi.Map{
"enable": pulumi.Bool(false),
},
"appprotectdos": pulumi.Map{
"enable": pulumi.Bool(false),
},
"service": pulumi.Map{
"extraLabels": appLabels,
"publishService": pulumi.Map{
"enabled": pulumi.Bool(true),
},
},
},
},
Version: pulumi.String("0.14.1"),
Version: pulumi.String("4.11.3"),
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion helm-kubernetes-python/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ template:
description: A Python program to deploy a Helm chart onto a Kubernetes cluster
config:
k8sNamespace:
default: nginx-ingress
default: ingress-nginx
description: The Kubernetes namespace to deploy into
22 changes: 9 additions & 13 deletions helm-kubernetes-python/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
config = pulumi.Config()
k8s_namespace = config.get("k8sNamespace", "default")
app_labels = {
"app": "nginx-ingress",
"app": "ingress-nginx",
}

# Create a namespace (user supplies the name of the namespace)
Expand All @@ -19,27 +19,23 @@
# Use Helm to install the Nginx ingress controller
ingresscontroller = kubernetes.helm.v3.Release(
"ingresscontroller",
chart="nginx-ingress",
chart="ingress-nginx",
namespace=ingress_ns.metadata.name,
repository_opts={
"repo": "https://helm.nginx.com/stable",
"repo": "https://kubernetes.github.io/ingress-nginx",
},
skip_crds=True,
values={
"serviceAccount": {
"automountServiceAccountToken": True,
},
"controller": {
"enableCustomResources": False,
"appprotect": {
"enable": False,
},
"appprotectdos": {
"enable": False,
},
"service": {
"extraLabels": app_labels,
"publishService": {
"enabled": True,
},
},
},
version="0.14.1"
version="4.11.3"
)

# Export some values for use elsewhere
Expand Down
2 changes: 1 addition & 1 deletion helm-kubernetes-typescript/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ template:
description: A TypeScript program to deploy a Helm chart onto a Kubernetes cluster
config:
k8sNamespace:
default: nginx-ingress
default: ingress-nginx
description: The Kubernetes namespace to deploy into
32 changes: 15 additions & 17 deletions helm-kubernetes-typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,36 @@ import * as kubernetes from "@pulumi/kubernetes";
const config = new pulumi.Config();
const k8sNamespace = config.get("k8sNamespace") || "default";
const appLabels = {
app: "nginx-ingress",
app: "ingress-nginx",
};

// Create a namespace (user supplies the name of the namespace)
const ingressNs = new kubernetes.core.v1.Namespace("ingressns", {metadata: {
labels: appLabels,
name: k8sNamespace,
}});
const ingressNs = new kubernetes.core.v1.Namespace("ingressns", {
metadata: {
labels: appLabels,
name: k8sNamespace,
}
});

// Use Helm to install the Nginx ingress controller
const ingressController = new kubernetes.helm.v3.Release("ingresscontroller", {
chart: "nginx-ingress",
chart: "ingress-nginx",
namespace: ingressNs.metadata.name,
repositoryOpts: {
repo: "https://helm.nginx.com/stable",
repo: "https://kubernetes.github.io/ingress-nginx",
},
skipCrds: true,
values: {
serviceAccount: {
automountServiceAccountToken: true,
},
controller: {
enableCustomResources: false,
appprotect: {
enable: false,
},
appprotectdos: {
enable: false,
},
service: {
extraLabels: appLabels,
publishService: {
enabled: true,
},
},
},
version: "0.14.1",
version: "4.11.3",
});

// Export some values for use elsewhere
Expand Down
23 changes: 10 additions & 13 deletions helm-kubernetes-yaml/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ template:
description: A Pulumi YAML program to deploy a Helm chart onto a Kubernetes cluster
config:
k8sNamespace:
default: nginx-ingress
default: ingress-nginx
description: The Kubernetes namespace to deploy into

config:
# Use this user-supplied value to create a Kubernetes namespace later
k8sNamespace:
default: nginx-ingress
default: ingress-nginx
type: string

variables:
# Define some labels that will be applied to resources
appLabels:
app: nginx-ingress
app: ingress-nginx

resources:
# Create a namespace (name of the namespace supplied by the user)
Expand All @@ -31,21 +31,18 @@ resources:
ingresscontroller:
type: kubernetes:helm.sh/v3:Release
properties:
chart: nginx-ingress
chart: ingress-nginx
namespace: ${ingressns.metadata.name}
repositoryOpts:
repo: https://helm.nginx.com/stable
repo: https://kubernetes.github.io/ingress-nginx
skipCrds: true
values:
serviceAccount:
automountServiceAccountToken: true
controller:
enableCustomResources: false
appprotect:
enable: false
appprotectdos:
enable: false
service:
extraLabels: ${appLabels}
version: "0.14.1"
publishService:
enabled: true
version: 4.11.3

# Export some values for use elsewhere
outputs:
Expand Down
12 changes: 6 additions & 6 deletions metadata/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@
"description": "A C# program to deploy a Helm chart onto a Kubernetes cluster",
"config": {
"k8sNamespace": {
"default": "nginx-ingress",
"default": "ingress-nginx",
"description": "The Kubernetes namespace to deploy into"
}
}
Expand All @@ -1890,7 +1890,7 @@
"description": "A Go program to deploy a Helm chart onto a Kubernetes cluster",
"config": {
"k8sNamespace": {
"default": "nginx-ingress",
"default": "ingress-nginx",
"description": "The Kubernetes namespace to deploy into"
}
}
Expand All @@ -1903,7 +1903,7 @@
"description": "A Python program to deploy a Helm chart onto a Kubernetes cluster",
"config": {
"k8sNamespace": {
"default": "nginx-ingress",
"default": "ingress-nginx",
"description": "The Kubernetes namespace to deploy into"
}
}
Expand All @@ -1916,7 +1916,7 @@
"description": "A TypeScript program to deploy a Helm chart onto a Kubernetes cluster",
"config": {
"k8sNamespace": {
"default": "nginx-ingress",
"default": "ingress-nginx",
"description": "The Kubernetes namespace to deploy into"
}
}
Expand All @@ -1929,7 +1929,7 @@
"description": "A Pulumi YAML program to deploy a Helm chart onto a Kubernetes cluster",
"config": {
"k8sNamespace": {
"default": "nginx-ingress",
"default": "ingress-nginx",
"description": "The Kubernetes namespace to deploy into"
}
}
Expand Down Expand Up @@ -4585,4 +4585,4 @@
}
}
}
}
}

0 comments on commit 5b4c49e

Please sign in to comment.