Skip to content

Commit dc1684f

Browse files
committed
Replaced deprecated fields in Kustomization
When running `kustomize build`, we currently see some warnings. Get rid of these by using the more modern replacements. See [docs][0]. ``` Warning: 'commonLabels' is deprecated. Please use 'labels' instead. Warning: 'vars' is deprecated. Please use 'replacements' instead. ``` [0]: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/
1 parent aec5d53 commit dc1684f

File tree

4 files changed

+46
-13
lines changed

4 files changed

+46
-13
lines changed

config/acceptance/kustomization.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,26 @@ patchesStrategicMerge:
1212
- overlays/rbac-manager.yaml
1313
- overlays/vault-manager.yaml
1414
- overlays/workloads-manager.yaml
15+
16+
# Sadly we must repeat the replacement as in our root Kustomization, because we've
17+
# overriden the image field, and there's no way to get Kustomize to run the (merged) replacements
18+
# after (merged) patches.
19+
replacements:
20+
- source:
21+
fieldPath: spec.template.spec.containers.[name=manager].image
22+
group: apps
23+
version: v1
24+
kind: StatefulSet
25+
name: theatre-vault-manager
26+
namespace: theatre-system
27+
targets:
28+
- select:
29+
group: apps
30+
kind: StatefulSet
31+
name: vault-manager
32+
version: v1
33+
fieldPaths:
34+
- spec.template.spec.containers.0.args.0
35+
options:
36+
delimiter: =
37+
index: 1

config/acceptance/overlays/vault-manager.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ spec:
1111
- name: manager
1212
image: theatre:latest
1313
imagePullPolicy: Never
14-
args:
15-
- --theatre-image=$(THEATRE_IMAGE)
16-
- --metrics-address=0.0.0.0
1714
resources:
1815
requests:
1916
cpu: "100m"

config/base/kustomization.yaml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ kind: Kustomization
55
namespace: theatre-system
66
namePrefix: theatre-
77

8-
commonLabels:
9-
app: theatre
8+
labels:
9+
- includeSelectors: true
10+
pairs:
11+
app: theatre
1012

1113
resources:
1214
- crds/rbac.crd.gocardless.com_directoryrolebindings.yaml
@@ -22,16 +24,27 @@ resources:
2224
- rbac/leader-election.yaml
2325
- cert-manager/certificate.yaml
2426

25-
vars:
27+
replacements:
2628
# We want our mutating webhook to ensure it only ever configures pods to use
2729
# the same image as it is running itself. If we ensure this, we don't need to
2830
# worry about maintaining compatibility between versions of the webhook and
2931
# theatre-secrets, as both will use the same version and be deployed
3032
# atomically.
31-
- name: THEATRE_IMAGE
32-
objref:
33-
apiVersion: apps/v1
33+
- source:
34+
fieldPath: spec.template.spec.containers.[name=manager].image
35+
group: apps
36+
version: v1
3437
kind: StatefulSet
35-
name: vault-manager
36-
fieldref:
37-
fieldpath: spec.template.spec.containers[0].image
38+
name: theatre-vault-manager
39+
namespace: theatre-system
40+
targets:
41+
- select:
42+
group: apps
43+
kind: StatefulSet
44+
name: vault-manager
45+
version: v1
46+
fieldPaths:
47+
- spec.template.spec.containers.0.args.0
48+
options:
49+
delimiter: =
50+
index: 1

config/base/managers/vault.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ spec:
113113
- command:
114114
- /usr/local/bin/vault-manager
115115
args:
116-
- --theatre-image=$(THEATRE_IMAGE)
116+
- --theatre-image=THEATRE_IMAGE_PLACEHOLDER
117117
- --metrics-address=0.0.0.0
118118
image: eu.gcr.io/gc-containers/gocardless/theatre:latest
119119
imagePullPolicy: Always

0 commit comments

Comments
 (0)