Skip to content

Commit 941b50c

Browse files
kvapsmyasnikovdaniil
authored andcommitted
fix(kubernetes-nodes)!: drop the kubectl image override
images.kubectl picked the image of the talos-reconcile and pre-delete unpin Jobs. Both run in the management cluster under service accounts that read the pool's Talos and cluster CA secrets and patch its CAPI objects, so a tenant-chosen image ran with access the apps API never grants. The image now always comes from images/kubectl.tag. Assisted-by: LLM Signed-off-by: Andrei Kvapil <[email protected]>
1 parent af20694 commit 941b50c

9 files changed

Lines changed: 55 additions & 60 deletions

File tree

‎api/apps/v1alpha1/kubernetesnodes/types.go‎

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/kubernetesnodes/zz_generated.deepcopy.go‎

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/apps/kubernetes-nodes/README.md‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,3 @@ the parent cluster `kubernetes-<cluster>` in the same namespace, plus a
105105
| `proxmox.pool` | Proxmox resource pool the worker VMs are added to. Set the same pool on every node pool of a tenant cluster and grant the tenant's tokens their privileges on `/pool/<name>`: that is the one ACL path that follows every VM capmox creates, replacements included. The pool must exist on the hypervisor; capmox does not create it. Empty adds the workers to no pool. | `string` | `""` |
106106
| `proxmox.dnsServers` | Nameservers written into the worker machineconfig. On kubevirt the workers use the management cluster's CoreDNS, which they reach over the pod network; an off-cluster Proxmox worker cannot, so it needs reachable resolvers of its own. Required when `substrate` is `proxmox`. Keep in sync with the parent kubernetes chart's `proxmox.dnsServers`. | `[]string` | `[]` |
107107

108-
109-
### Images
110-
111-
| Name | Description | Type | Value |
112-
| ---------------- | -------------------------------------------------------------------------------------------------------------- | -------- | ----- |
113-
| `images` | Optional image overrides for air-gapped or rate-limited registries. | `object` | `{}` |
114-
| `images.kubectl` | Image used by the talos-reconcile and pre-delete unpin Jobs (kubectl). Empty falls back to images/kubectl.tag. | `string` | `""` |
115-

‎packages/apps/kubernetes-nodes/templates/pre-delete-unpin.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{{- $clusterName := include "kubernetes-nodes.clusterName" . }}
1515
{{- $groupName := include "kubernetes-nodes.groupName" . }}
1616
{{- $base := printf "%s-%s" $clusterName $groupName }}
17-
{{- $kubectlImage := default ($.Files.Get "images/kubectl.tag" | trim) $.Values.images.kubectl }}
17+
{{- $kubectlImage := $.Files.Get "images/kubectl.tag" | trim }}
1818
---
1919
apiVersion: v1
2020
kind: ServiceAccount

‎packages/apps/kubernetes-nodes/templates/talos-reconcile-job.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ spec:
386386
{{- $_ := set $jobContext "dnsDomain" $dnsDomain }}
387387
{{- $_ := set $jobContext "tctName" $tctName }}
388388
{{- $_ := set $jobContext "tctSpec" $tctSpec }}
389-
{{- $_ := set $jobContext "kubectlImage" (default ($.Files.Get "images/kubectl.tag" | trim) $.Values.images.kubectl) }}
389+
{{- $_ := set $jobContext "kubectlImage" ($.Files.Get "images/kubectl.tag" | trim) }}
390390
{{- $jobSpec := include "kubernetes-nodes.talos-reconcile-job-spec" $jobContext }}
391391
{{- $jobHash := $jobSpec | sha256sum | trunc 6 }}
392392
{{- $jobName := printf "%s-talos-reconcile-%s" $.Release.Name $groupName | trunc 56 | trimSuffix "-" }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
suite: kubectl image of the pool Jobs
2+
3+
# Both Jobs run in the management cluster under service accounts that read the
4+
# pool's Talos secrets and patch its CAPI objects, so the image they run comes
5+
# from images/kubectl.tag and nothing in the values can replace it.
6+
7+
templates:
8+
- templates/talos-reconcile-job.yaml
9+
- templates/pre-delete-unpin.yaml
10+
11+
release:
12+
name: kubernetes-nodes-myk8s-md0
13+
namespace: tenant-test
14+
15+
set:
16+
cluster: myk8s
17+
_cluster:
18+
cluster-domain: cozy.local
19+
version: "v1.35"
20+
minReplicas: 0
21+
maxReplicas: 3
22+
instanceType: ""
23+
diskSize: 20Gi
24+
storageClass: replicated
25+
roles: []
26+
resources:
27+
cpu: "2"
28+
memory: 4Gi
29+
images:
30+
kubectl: registry.example.test/kubectl:6.6.6
31+
32+
tests:
33+
- it: keeps the bundled kubectl image in the talos-reconcile Job when values carry an image override
34+
template: templates/talos-reconcile-job.yaml
35+
documentSelector:
36+
path: kind
37+
value: Job
38+
asserts:
39+
- matchRegex:
40+
path: spec.template.spec.containers[0].image
41+
pattern: '^docker\.io/alpine/k8s:[^@]+@sha256:[0-9a-f]{64}$'
42+
43+
- it: keeps the bundled kubectl image in the pre-delete unpin Job when values carry an image override
44+
template: templates/pre-delete-unpin.yaml
45+
documentSelector:
46+
path: kind
47+
value: Job
48+
asserts:
49+
- matchRegex:
50+
path: spec.template.spec.containers[0].image
51+
pattern: '^docker\.io/alpine/k8s:[^@]+@sha256:[0-9a-f]{64}$'

‎packages/apps/kubernetes-nodes/values.schema.json‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -402,18 +402,6 @@
402402
}
403403
}
404404
}
405-
},
406-
"images": {
407-
"description": "Optional image overrides for air-gapped or rate-limited registries.",
408-
"type": "object",
409-
"default": {},
410-
"properties": {
411-
"kubectl": {
412-
"description": "Image used by the talos-reconcile and pre-delete unpin Jobs (kubectl). Empty falls back to images/kubectl.tag.",
413-
"type": "string",
414-
"default": ""
415-
}
416-
}
417405
}
418406
}
419407
}

‎packages/apps/kubernetes-nodes/values.yaml‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,3 @@ proxmox:
184184
storage: ""
185185
pool: ""
186186
dnsServers: []
187-
188-
##
189-
## @section Images
190-
##
191-
192-
## @typedef {struct} Images - Optional image overrides for chart-internal helpers.
193-
## @field {string} [kubectl] - Image used by the talos-reconcile and pre-delete unpin Jobs (kubectl). Empty falls back to images/kubectl.tag.
194-
195-
## @param {Images} images - Optional image overrides for air-gapped or rate-limited registries.
196-
images:
197-
kubectl: ""

‎packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)