Skip to content

Commit

Permalink
propagate k8s version to helm template calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Diaphteiros committed Mar 16, 2023
1 parent 4ea204c commit 9e86c20
Show file tree
Hide file tree
Showing 28 changed files with 55 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/cert-manager/controller/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ component:
imports:
- dns-controller
- namespace
- k8sversion

stubs:
- lib/templates/utilities.yaml
Expand Down
2 changes: 2 additions & 0 deletions components/cert-manager/controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ helm:
source: "chart-checkout/charts/cert-manager"
name: cert-manager
namespace: (( .namespace.name ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
image:
repository: (( .landscape.versions.cert-manager.controller.image_repo || ~~ ))
Expand Down
1 change: 1 addition & 0 deletions components/cert-manager/solver/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ component:
imports:
- dns-controller
- cert-controller: cert-manager/controller
- k8sversion

stubs: []

Expand Down
2 changes: 2 additions & 0 deletions components/cert-manager/solver/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ helm:
source: "git/repo/charts/certificate-dns-bridge"
name: certificate-dns-bridge
namespace: (( imports.cert-controller.export.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
groupName: (( imports.cert-controller.export.groupName ))
solverName: (( imports.cert-controller.export.solverName ))
Expand Down
1 change: 1 addition & 0 deletions components/dashboard/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ component:
- cert: cert-manager/cert
- cert-controller: cert-manager/controller
- dns-controller
- k8sversion
- (( ( .landscape.gardener.network-policies.active || false ) ? "network-policies" :~~ ))
- (( ( .landscape.dashboard.terminals.active || false ) ? "terminals" :~~ ))

Expand Down
2 changes: 2 additions & 0 deletions components/dashboard/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ dashboard:
source: "git/repo/charts/gardener-dashboard"
name: "dashboard"
namespace: (( .landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
global:
apiServerUrl: (( imports.kube_apiserver.export.apiserver_url ))
Expand Down
3 changes: 3 additions & 0 deletions components/dns-controller/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
---
landscape: (( &temporary ))
component:
imports:
- k8sversion

stubs:
- plugins/kubectl/utilities.yaml

Expand Down
2 changes: 2 additions & 0 deletions components/dns-controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ helm:
source: "git/repo/charts/external-dns-management"
name: (( settings.fullname ))
namespace: (( .spec.common.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values: (( .spec.helm ))

kubectl:
Expand Down
1 change: 1 addition & 0 deletions components/etcd/cluster/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ component:
imports:
- (( landscape.etcd.backup.active ? { "backupinfra" = "etcd/backupinfra" } :~~ ))
- namespace
- k8sversion

stubs:
- lib/templates/utilities.yaml
Expand Down
4 changes: 4 additions & 0 deletions components/etcd/cluster/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ etcd:
source: chart
name: garden-etcd-main
namespace: (( .landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
name: (( main.name ))
replicas: 1
Expand Down Expand Up @@ -121,6 +123,8 @@ etcd:
source: chart
name: garden-etcd-events
namespace: (( .landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
name: (( events.name ))
replicas: 1
Expand Down
2 changes: 2 additions & 0 deletions components/gardencontent/seeds/manifests/seed_manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ pluginSpecs:
source: "git/repo/charts/gardener/gardenlet"
name: gardenlet
namespace: garden
flags:
deploy: (( "--kube-version=" configValues.k8sVersion ))
values: (( gardenletSpec ))
seedReady:
kubeconfig: (( configValues.kubeconfigs.virtual ))
Expand Down
3 changes: 3 additions & 0 deletions components/gardencontent/seeds/seeds/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ providerconfig:
shootDefaultNetworks: (( v.shootDefaultNetworks || ~~ ))
settings: (( v.seedSettings || ~~ ))
secretname: (( name "-" v.mode ))
cloudprofile: (( v.cloudprofile || v.name ))
k8sVersion: (( .imports.shoots.export.shoots[v.name].k8sVersion ))

1 change: 1 addition & 0 deletions components/gardencontent/seeds/shoots/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ shoot_template:
<<: (( &template &temporary ))
name: (( e.metadata.name ))
namespace: (( e.metadata.namespace ))
k8sVersion: (( e.spec.kubernetes.version ))

shoots: (( sum[.kubectl.[*].manifests[0]|[]|s,e|-> s *.shoot_template] ))
1 change: 1 addition & 0 deletions components/gardencontent/seeds/soils/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ component:
- gardener_runtime: gardener/extensions
- ingress_dns: ingress-controller
- kube_apiserver: kube-apiserver
- k8sversion

stubs:
- plugins/kubectl/utilities.yaml
Expand Down
1 change: 1 addition & 0 deletions components/gardencontent/seeds/soils/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ providerconfig:
settings: (( v.seedSettings || ~~ ))
secretname: (( name "-" v.mode ))
monitoring: (( landscape.monitoring ))
k8sVersion: (( .imports.k8sversion.export.k8sVersions.soils[v.name] ))

renderedPluginSpecs: (( sum[.iaasSeedsSoils|[]|s,id,v|-> s [ ( "configValues" = *providerconfig ) read( __ctx.DIR "/../manifests/seed_manifests.yaml", "yaml" ).pluginSpecs ]] ))
2 changes: 2 additions & 0 deletions components/gardener/extensions/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ admission:
source: (( "extensions." n "/repo/charts/" name "/charts/application" ))
name: (( admission.fullName(n) ))
namespace: (( .landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.kube_apiserver.export.k8sVersion ))
values: (( *admission.values_template ))
helm_template_runtime:
<<: (( &template ))
Expand Down
1 change: 1 addition & 0 deletions components/gardener/runtime/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ component:
- gardener_virtual: gardener/virtual
- kube_apiserver: "kube-apiserver"
- namespace
- k8sversion

stubs:
- plugins/kubectl/utilities.yaml
Expand Down
2 changes: 2 additions & 0 deletions components/gardener/runtime/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ gardener:
values: (( merge(.imports.gardener_virtual.export.gardener.values, spec) ))
name: gardener
namespace: (( landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
spec:
global:
apiserver:
Expand Down
2 changes: 2 additions & 0 deletions components/gardener/virtual/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ gardener:
source: "git/repo/charts/gardener/controlplane/charts/application"
name: "gardener"
namespace: "garden"
flags:
deploy: (( "--kube-version=" .imports.kube_apiserver.export.k8sVersion ))
values:
global:
apiserver:
Expand Down
1 change: 1 addition & 0 deletions components/identity/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ component:
- ingress-controller
- namespace
- cert: cert-manager/cert
- k8sversion

stubs:
- lib/templates/utilities.yaml
Expand Down
2 changes: 2 additions & 0 deletions components/identity/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ identity:
source: "git/repo/charts/identity"
name: "identity"
namespace: (( .landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
image:
repository: (( .identity_version.image_repo || ~~ ))
Expand Down
1 change: 1 addition & 0 deletions components/ingress-controller/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ landscape: (( &temporary ))
component:
imports:
- dns-controller
- k8sversion

plugins:
- git
Expand Down
2 changes: 1 addition & 1 deletion components/ingress-controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ingresscontroller:
name: "nginx-ingress"
namespace: "kube-system"
flags:
deploy: "--kube-version=1.20.0"
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
fullnameOverride: (( .ingresscontroller.name ))
controller:
Expand Down
1 change: 1 addition & 0 deletions components/kube-apiserver/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ component:
- namespace
- (( ( .landscape.gardener.network-policies.active || false ) ? "network-policies" :~~ ))
- cert-controller: cert-manager/controller
- k8sversion

stubs:
- lib/templates/utilities.yaml
Expand Down
2 changes: 2 additions & 0 deletions components/kube-apiserver/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ kubeapiserver:
name: "garden-kube-apiserver"
namespace: (( .landscape.namespace ))
serviceName: (( name ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
images:
apiserver: (( .landscape.versions.kube-apiserver.image_repo ":" .landscape.versions.kube-apiserver.image_tag ))
Expand Down
12 changes: 10 additions & 2 deletions components/kube-apiserver/export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env: (( &temporary ))

temp:
<<: (( &temporary ))
command:
get_kubeconfig_command:
- kubectl
- --kubeconfig
- (( lookup_file(landscape.clusters.[0].kubeconfig, env.ROOTDIR).[0] ))
Expand All @@ -31,15 +31,23 @@ temp:
- garden-kubeconfig-for-admin
- "-o"
- "jsonpath={.data.kubeconfig}"
get_k8s_version_command:
- kubectl
- --kubeconfig
- (( tempfile(asyaml(export.kubeconfig)) ))
- version
- -o
- yaml

export:
gardener_dns: (( .settings.gardener_dns ))
apiserver_dns: (( .settings.apiserver_dns ))
apiserver_url: (( "https://" apiserver_dns ))
apiserver_url_internal: (( .settings.apiserver_url_internal ))
kube_apiserver_ca: (( .state.kube_apiserver_ca.value ))
kubeconfig: (( parse(base64_decode(exec( temp.command ))) || "" ))
kubeconfig: (( parse(base64_decode(exec( temp.get_kubeconfig_command ))) || "" ))
kubeconfig_internal_merge_snippet: (( .files.kubeconfig_internal_merge_snippet.data ))
k8sVersion: (( ( "raw_version" = exec( temp.get_k8s_version_command ) ) raw_version.serverVersion.major "." raw_version.serverVersion.minor ))

files:
kubeconfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ component:
- grafana: monitoring/grafana
- kube-apiserver
- namespace
- k8sversion

plugins:
- git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ helm:
source: "git/repo/charts/gardener-metrics-exporter"
name: gardener-metrics-exporter
namespace: (( .landscape.namespace ))
flags:
deploy: (( "--kube-version=" .imports.k8sversion.export.k8sVersions.base ))
values:
image:
repository: (( .landscape.versions.monitoring.gardener-metrics-exporter.image_repo || ~~ ))
Expand Down

0 comments on commit 9e86c20

Please sign in to comment.