Skip to content

Commit df6fd2d

Browse files
authored
Merge pull request #76 from projectsyn/no-prune-of-ns-cattle-system
Do not prune the namespace if the SUP is installed in cattle-system
2 parents beee8ca + 7e8f8af commit df6fd2d

File tree

12 files changed

+696
-2
lines changed

12 files changed

+696
-2
lines changed

.cruft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"name": "system-upgrade-controller",
88
"slug": "system-upgrade-controller",
99
"parameter_key": "system_upgrade_controller",
10-
"test_cases": "defaults",
10+
"test_cases": "defaults cattle-system",
1111
"add_lib": "y",
1212
"add_pp": "n",
1313
"add_golden": "y",

Makefile.vars.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
5757
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)
5858

5959
instance ?= defaults
60+
test_instances = tests/defaults.yml tests/cattle-system.yml

component/main.jsonnet

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,20 @@ local sucImage =
2121
else
2222
'%(registry)s/%(repository)s:%(tag)s' % params.images.system_upgrade_controller;
2323

24-
local namespace = kube.Namespace(params.namespace);
24+
local cattleSystemNamespaceNoPrune =
25+
if params.namespace == 'cattle-system' then
26+
{
27+
metadata+: {
28+
annotations+: {
29+
'argocd.argoproj.io/sync-options': 'Prune=false',
30+
},
31+
},
32+
}
33+
else
34+
{};
35+
36+
local namespace = kube.Namespace(params.namespace) +
37+
cattleSystemNamespaceNoPrune;
2538

2639
local serviceaccount = kube.ServiceAccount(params.service_account) {
2740
metadata+: {

tests/cattle-system.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
parameters:
2+
system_upgrade_controller:
3+
namespace: cattle-system

tests/golden/cattle-system/system-upgrade-controller/apps/system-upgrade-controller.yaml

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
annotations:
5+
argocd.argoproj.io/sync-options: Prune=false
6+
labels:
7+
name: cattle-system
8+
name: cattle-system
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
annotations: {}
5+
labels:
6+
name: system-upgrade
7+
name: system-upgrade
8+
namespace: cattle-system
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
annotations: {}
5+
labels:
6+
name: system-upgrade
7+
name: system-upgrade
8+
namespace: cattle-system
9+
roleRef:
10+
apiGroup: rbac.authorization.k8s.io
11+
kind: ClusterRole
12+
name: cluster-admin
13+
subjects:
14+
- kind: ServiceAccount
15+
name: system-upgrade
16+
namespace: cattle-system
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
data:
3+
SYSTEM_UPGRADE_CONTROLLER_DEBUG: 'false'
4+
SYSTEM_UPGRADE_CONTROLLER_THREADS: '2'
5+
SYSTEM_UPGRADE_JOB_ACTIVE_DEADLINE_SECONDS: '900'
6+
SYSTEM_UPGRADE_JOB_BACKOFF_LIMIT: '3'
7+
SYSTEM_UPGRADE_JOB_IMAGE_PULL_POLICY: Always
8+
SYSTEM_UPGRADE_JOB_KUBECTL_IMAGE: rancher/kubectl:v1.17.0
9+
SYSTEM_UPGRADE_JOB_PRIVILEGED: 'true'
10+
SYSTEM_UPGRADE_JOB_TTL_SECONDS_AFTER_FINISH: '900'
11+
SYSTEM_UPGRADE_PLAN_POLLING_INTERVAL: 15m
12+
kind: ConfigMap
13+
metadata:
14+
annotations: {}
15+
labels:
16+
name: default-controller-env
17+
name: default-controller-env
18+
namespace: cattle-system
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
annotations: {}
5+
labels:
6+
app.kubernetes.io/instance: c-green-test-1234
7+
app.kubernetes.io/managed-by: syn
8+
app.kubernetes.io/name: system-upgrade-controller
9+
name: system-upgrade-controller
10+
name: system-upgrade-controller
11+
namespace: cattle-system
12+
spec:
13+
minReadySeconds: 30
14+
replicas: 1
15+
revisionHistoryLimit: 10
16+
selector:
17+
matchLabels:
18+
upgrade.cattle.io/controller: system-upgrade-controller
19+
strategy:
20+
rollingUpdate:
21+
maxSurge: 25%
22+
maxUnavailable: 25%
23+
type: RollingUpdate
24+
template:
25+
metadata:
26+
labels:
27+
upgrade.cattle.io/controller: system-upgrade-controller
28+
spec:
29+
affinity: {}
30+
containers:
31+
- args: []
32+
env:
33+
- name: SYSTEM_UPGRADE_CONTROLLER_NAME
34+
valueFrom:
35+
fieldRef:
36+
fieldPath: metadata.labels['upgrade.cattle.io/controller']
37+
- name: SYSTEM_UPGRADE_CONTROLLER_NAMESPACE
38+
valueFrom:
39+
fieldRef:
40+
fieldPath: metadata.namespace
41+
envFrom:
42+
- configMapRef:
43+
name: default-controller-env
44+
image: docker.io/rancher/system-upgrade-controller:v0.13.1
45+
imagePullPolicy: IfNotPresent
46+
name: system-upgrade-controller
47+
ports: []
48+
resources:
49+
limits:
50+
cpu: 500m
51+
memory: 128Mi
52+
requests:
53+
cpu: 250m
54+
memory: 64Mi
55+
stdin: false
56+
tty: false
57+
volumeMounts:
58+
- mountPath: /etc/ssl
59+
name: etc-ssl
60+
- mountPath: /tmp
61+
name: tmp
62+
imagePullSecrets: []
63+
initContainers: []
64+
serviceAccountName: system-upgrade
65+
terminationGracePeriodSeconds: 30
66+
volumes:
67+
- hostPath:
68+
path: /etc/ssl
69+
type: Directory
70+
name: etc-ssl
71+
- emptyDir: {}
72+
name: tmp

0 commit comments

Comments
 (0)