File tree 12 files changed +173
-1
lines changed
simple-deployment-different-selector
12 files changed +173
-1
lines changed Original file line number Diff line number Diff line change @@ -184,13 +184,15 @@ func TestReadAllChartDirectories(t *testing.T) {
184
184
"test_charts/bar" ,
185
185
"test_charts/must-pass-upgrade-install" ,
186
186
"test_charts/mutating-deployment-selector" ,
187
+ "test_charts/simple-deployment" ,
188
+ "test_charts/simple-deployment-different-selector" ,
187
189
"test_charts/mutating-sfs-volumeclaim" ,
188
190
"test_chart_at_root" ,
189
191
}
190
192
for _ , chart := range actual {
191
193
assert .Contains (t , expected , chart )
192
194
}
193
- assert .Len (t , actual , 6 )
195
+ assert .Len (t , actual , 8 )
194
196
assert .Nil (t , err )
195
197
}
196
198
Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ func TestUpgradeChart(t *testing.T) {
141
141
"test_charts/mutating-sfs-volumeclaim" ,
142
142
processError ,
143
143
},
144
+ {
145
+ "change immutable deployment.spec.selector.matchLabels field" ,
146
+ "test_charts/simple-deployment" ,
147
+ "test_charts/simple-deployment-different-selector" ,
148
+ processError ,
149
+ },
144
150
}
145
151
146
152
for _ , tc := range cases {
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ appVersion : " 1.0"
3
+ description : A Helm chart for Kubernetes
4
+ name : nginx
5
+ version : 0.1.0
Original file line number Diff line number Diff line change
1
+ Simple chart with a Deployment having a different selector.
2
+
3
+ The integration test will install first simple-deployment and then try to upgrade
4
+ to simple-deployment-different-selector failing as expected
Original file line number Diff line number Diff line change
1
+ { {/* vim: set filetype= mustache: */} }
2
+ { {/*
3
+ Expand the name of the chart.
4
+ */} }
5
+ { {- define " nginx.name" -} }
6
+ { {- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix " -" -} }
7
+ { {- end -} }
8
+
9
+ { {/*
10
+ Create a default fully qualified app name.
11
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12
+ If release name contains chart name it will be used as a full name.
13
+ */} }
14
+ { {- define " nginx.fullname" -} }
15
+ { {- if .Values.fullnameOverride -} }
16
+ { {- .Values.fullnameOverride | trunc 63 | trimSuffix " -" -} }
17
+ { {- else -} }
18
+ { {- $name := default .Chart.Name .Values.nameOverride -} }
19
+ { {- if contains $name .Release.Name -} }
20
+ { {- .Release.Name | trunc 63 | trimSuffix " -" -} }
21
+ { {- else -} }
22
+ { {- printf " %s-%s" .Release.Name $name | trunc 63 | trimSuffix " -" -} }
23
+ { {- end -} }
24
+ { {- end -} }
25
+ { {- end -} }
26
+
27
+ { {/*
28
+ Create chart name and version as used by the chart label.
29
+ */} }
30
+ { {- define " nginx.chart" -} }
31
+ { {- printf " %s-%s" .Chart.Name .Chart.Version | replace " +" " _" | trunc 63 | trimSuffix " -" -} }
32
+ { {- end -} }
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : {{ include "nginx.fullname" . }}
5
+ labels :
6
+ app.kubernetes.io/name : {{ include "nginx.name" . }}
7
+ helm.sh/chart : {{ include "nginx.chart" . }}
8
+ app.kubernetes.io/instance : {{ .Release.Name }}
9
+ app.kubernetes.io/managed-by : {{ .Release.Service }}
10
+ spec :
11
+ replicas : 1
12
+ selector :
13
+ matchLabels :
14
+ app.kubernetes.io/name : {{ include "nginx.name" . }}
15
+ app.kubernetes.io/instance : {{ .Release.Name }}
16
+ extra : label
17
+ template :
18
+ metadata :
19
+ labels :
20
+ app.kubernetes.io/name : {{ include "nginx.name" . }}
21
+ app.kubernetes.io/instance : {{ .Release.Name }}
22
+ extra : label
23
+ spec :
24
+ containers :
25
+ - name : {{ .Chart.Name }}
26
+ image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
27
+ imagePullPolicy : {{ .Values.image.pullPolicy }}
28
+ ports :
29
+ - name : http
30
+ containerPort : 80
31
+ protocol : TCP
Original file line number Diff line number Diff line change
1
+ # Default values for nginx.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+
5
+ image :
6
+ repository : nginx
7
+ tag : stable
8
+ pullPolicy : IfNotPresent
9
+
10
+ nameOverride : " "
11
+ fullnameOverride : " "
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ appVersion : " 1.0"
3
+ description : A Helm chart for Kubernetes
4
+ name : nginx
5
+ version : 0.1.0
Original file line number Diff line number Diff line change
1
+ Simple chart with a Deployment.
2
+
3
+ The integration test will install first simple-deployment and then try to upgrade
4
+ to simple-deployment-different-selector failing as expected
Original file line number Diff line number Diff line change
1
+ { {/* vim: set filetype= mustache: */} }
2
+ { {/*
3
+ Expand the name of the chart.
4
+ */} }
5
+ { {- define " nginx.name" -} }
6
+ { {- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix " -" -} }
7
+ { {- end -} }
8
+
9
+ { {/*
10
+ Create a default fully qualified app name.
11
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12
+ If release name contains chart name it will be used as a full name.
13
+ */} }
14
+ { {- define " nginx.fullname" -} }
15
+ { {- if .Values.fullnameOverride -} }
16
+ { {- .Values.fullnameOverride | trunc 63 | trimSuffix " -" -} }
17
+ { {- else -} }
18
+ { {- $name := default .Chart.Name .Values.nameOverride -} }
19
+ { {- if contains $name .Release.Name -} }
20
+ { {- .Release.Name | trunc 63 | trimSuffix " -" -} }
21
+ { {- else -} }
22
+ { {- printf " %s-%s" .Release.Name $name | trunc 63 | trimSuffix " -" -} }
23
+ { {- end -} }
24
+ { {- end -} }
25
+ { {- end -} }
26
+
27
+ { {/*
28
+ Create chart name and version as used by the chart label.
29
+ */} }
30
+ { {- define " nginx.chart" -} }
31
+ { {- printf " %s-%s" .Chart.Name .Chart.Version | replace " +" " _" | trunc 63 | trimSuffix " -" -} }
32
+ { {- end -} }
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : {{ include "nginx.fullname" . }}
5
+ labels :
6
+ app.kubernetes.io/name : {{ include "nginx.name" . }}
7
+ helm.sh/chart : {{ include "nginx.chart" . }}
8
+ app.kubernetes.io/instance : {{ .Release.Name }}
9
+ app.kubernetes.io/managed-by : {{ .Release.Service }}
10
+ spec :
11
+ replicas : 1
12
+ selector :
13
+ matchLabels :
14
+ app.kubernetes.io/name : {{ include "nginx.name" . }}
15
+ app.kubernetes.io/instance : {{ .Release.Name }}
16
+ template :
17
+ metadata :
18
+ labels :
19
+ app.kubernetes.io/name : {{ include "nginx.name" . }}
20
+ app.kubernetes.io/instance : {{ .Release.Name }}
21
+ spec :
22
+ containers :
23
+ - name : {{ .Chart.Name }}
24
+ image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
25
+ imagePullPolicy : {{ .Values.image.pullPolicy }}
26
+ ports :
27
+ - name : http
28
+ containerPort : 80
29
+ protocol : TCP
Original file line number Diff line number Diff line change
1
+ # Default values for nginx.
2
+ # This is a YAML-formatted file.
3
+ # Declare variables to be passed into your templates.
4
+
5
+ image :
6
+ repository : nginx
7
+ tag : stable
8
+ pullPolicy : IfNotPresent
9
+
10
+ nameOverride : " "
11
+ fullnameOverride : " "
You can’t perform that action at this time.
0 commit comments