-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not trigger an update when a parameter is added by an OV upgrade. (#…
…1780) * Test adding a required no-default parameter on upgrade. Currently, an operator upgrade that brings in a new required parameter without a default, is impossible if the operator defines both "update" and "upgrade" plans. An upgrade without setting this parameter fails (which is a correct behaviour); however, an attempt to upgrade while setting the previously nonexistent parameter also fails due to both plans being triggered, regardless of the fact that no existing parameter is changed. This test verifies that an upgrade of such an operator is possible together with setting a value for the new required parameter, and that the plan chosen is "upgrade" and not "update". Signed-off-by: Andrei Sekretenko <[email protected]> * Do not trigger an update when a parameter is added by an OV upgrade. Now, parameters added by a new operator version (for example, when a new OV brings in a new required parameter with no default, so that it is necessary to set a value together with upgrade) no longer trigger an update plan. This fixes #1776 Signed-off-by: Andrei Sekretenko <[email protected]>
- Loading branch information
1 parent
77ba62f
commit cc4521e
Showing
15 changed files
with
214 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
origin: deploy | ||
foo: bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: kubectl kudo install --instance update-with-upgrade ./update-with-upgrade-v1 | ||
namespaced: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
origin: upgrade | ||
foo: bar | ||
bar: baz |
5 changes: 5 additions & 0 deletions
5
test/e2e/update-with-upgrade/01-upgrade-operator-version.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: kubectl kudo upgrade --instance update-with-upgrade ./update-with-upgrade-v2 -p bar=baz | ||
namespaced: true |
50 changes: 50 additions & 0 deletions
50
test/e2e/update-with-upgrade/update-with-upgrade-v1/operator.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: kudo.dev/v1beta1 | ||
name: "update-with-upgrade" | ||
operatorVersion: "0.1.0" | ||
kubernetesVersion: 1.13.0 | ||
tasks: | ||
- name: deploy-configmap | ||
kind: Apply | ||
spec: | ||
resources: | ||
- configmap-deployed.yaml | ||
- name: update-configmap | ||
kind: Apply | ||
spec: | ||
resources: | ||
- configmap-updated.yaml | ||
- name: upgrade-configmap | ||
kind: Apply | ||
spec: | ||
resources: | ||
- configmap-upgraded.yaml | ||
plans: | ||
deploy: | ||
strategy: serial | ||
phases: | ||
- name: deploy-configmap | ||
strategy: serial | ||
steps: | ||
- name: deploy-configmap | ||
tasks: | ||
- deploy-configmap | ||
# This should not occur when upgrading the operator: | ||
update: | ||
strategy: serial | ||
phases: | ||
- name: update-configmap | ||
strategy: serial | ||
steps: | ||
- name: update-configmap | ||
tasks: | ||
- update-configmap | ||
# Instead, this should occur when upgrading the operator: | ||
upgrade: | ||
strategy: serial | ||
phases: | ||
- name: upgrade-configmap | ||
strategy: serial | ||
steps: | ||
- name: upgrade-configmap | ||
tasks: | ||
- upgrade-configmap |
5 changes: 5 additions & 0 deletions
5
test/e2e/update-with-upgrade/update-with-upgrade-v1/params.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kudo.dev/v1beta1 | ||
parameters: | ||
- name: foo | ||
required: true | ||
default: "bar" |
9 changes: 9 additions & 0 deletions
9
test/e2e/update-with-upgrade/update-with-upgrade-v1/templates/configmap-deployed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
# This field is used to determine the plan which created the config map | ||
origin: deploy | ||
# This field introduces a dependency on a parameter | ||
foo: "{{ .Params.foo }}" |
9 changes: 9 additions & 0 deletions
9
test/e2e/update-with-upgrade/update-with-upgrade-v1/templates/configmap-updated.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
# This field is used to determine the plan which created the config map | ||
origin: update | ||
# This field introduces a dependency on a parameter | ||
foo: "{{ .Params.foo }}" |
9 changes: 9 additions & 0 deletions
9
test/e2e/update-with-upgrade/update-with-upgrade-v1/templates/configmap-upgraded.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
# This field is used to determine the plan which created the config map | ||
origin: upgrade | ||
# This field introduces a dependency on a parameter | ||
foo: "{{ .Params.foo }}" |
50 changes: 50 additions & 0 deletions
50
test/e2e/update-with-upgrade/update-with-upgrade-v2/operator.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: kudo.dev/v1beta1 | ||
name: "update-with-upgrade" | ||
operatorVersion: "0.2.0" | ||
kubernetesVersion: 1.13.0 | ||
tasks: | ||
- name: deploy-configmap | ||
kind: Apply | ||
spec: | ||
resources: | ||
- configmap-deployed.yaml | ||
- name: update-configmap | ||
kind: Apply | ||
spec: | ||
resources: | ||
- configmap-updated.yaml | ||
- name: upgrade-configmap | ||
kind: Apply | ||
spec: | ||
resources: | ||
- configmap-upgraded.yaml | ||
plans: | ||
deploy: | ||
strategy: serial | ||
phases: | ||
- name: deploy-configmap | ||
strategy: serial | ||
steps: | ||
- name: deploy-configmap | ||
tasks: | ||
- deploy-configmap | ||
# This should not occur when upgrading the operator: | ||
update: | ||
strategy: serial | ||
phases: | ||
- name: update-configmap | ||
strategy: serial | ||
steps: | ||
- name: update-configmap | ||
tasks: | ||
- update-configmap | ||
# Instead, this should occur when upgrading the operator: | ||
upgrade: | ||
strategy: serial | ||
phases: | ||
- name: upgrade-configmap | ||
strategy: serial | ||
steps: | ||
- name: upgrade-configmap | ||
tasks: | ||
- upgrade-configmap |
9 changes: 9 additions & 0 deletions
9
test/e2e/update-with-upgrade/update-with-upgrade-v2/params.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: kudo.dev/v1beta1 | ||
parameters: | ||
- name: foo | ||
required: true | ||
default: "bar" | ||
# NOTE: "bar" intentionally specifies no default, | ||
# so that upgrade is impossible without setting the value. | ||
- name: bar | ||
required: true |
10 changes: 10 additions & 0 deletions
10
test/e2e/update-with-upgrade/update-with-upgrade-v2/templates/configmap-deployed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
# This field is used to determine the plan which created the config map | ||
origin: deploy | ||
# This field introduces a dependency on a parameter | ||
foo: "{{ .Params.foo }}" | ||
bar: "{{ .Params.bar }}" |
10 changes: 10 additions & 0 deletions
10
test/e2e/update-with-upgrade/update-with-upgrade-v2/templates/configmap-updated.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
# This field is used to determine the plan which created the config map | ||
origin: update | ||
# This field introduces a dependency on a parameter | ||
foo: "{{ .Params.foo }}" | ||
bar: "{{ .Params.bar }}" |
10 changes: 10 additions & 0 deletions
10
test/e2e/update-with-upgrade/update-with-upgrade-v2/templates/configmap-upgraded.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test | ||
data: | ||
# This field is used to determine the plan which created the config map | ||
origin: upgrade | ||
# This field introduces a dependency on a parameter | ||
foo: "{{ .Params.foo }}" | ||
bar: "{{ .Params.bar }}" |