Skip to content

Commit 1b20baf

Browse files
Add Helm support for the --deletion-policy CLI arg (#388)
Description of changes: Adds a new value in `values.yaml` named `deletionPolicy` to support the controller CLI argument `--deletion-policy`. Supports values of `delete` and `retain` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 4e4052d commit 1b20baf

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/aws-controllers-k8s/code-generator
33
go 1.17
44

55
require (
6-
github.com/aws-controllers-k8s/runtime v0.21.0
6+
github.com/aws-controllers-k8s/runtime v0.22.1
77
github.com/aws/aws-sdk-go v1.44.93
88
github.com/dlclark/regexp2 v1.4.0
99
// pin to v0.1.1 due to release problem with v0.1.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
9090
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
9191
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
9292
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
93-
github.com/aws-controllers-k8s/runtime v0.21.0 h1:e9DK88QodwXMLz+QXPXk+8XNetVj4ij+puaVwn9uEVc=
94-
github.com/aws-controllers-k8s/runtime v0.21.0/go.mod h1:k7z4qlf6aK1Kzd4ff49wzcyhDKHjWaUpqxrwgl4uS1o=
93+
github.com/aws-controllers-k8s/runtime v0.22.1 h1:V5AKMBjGmq3sblGYrVYvi+6utW4CiIVotWA60Ym9T84=
94+
github.com/aws-controllers-k8s/runtime v0.22.1/go.mod h1:k7z4qlf6aK1Kzd4ff49wzcyhDKHjWaUpqxrwgl4uS1o=
9595
github.com/aws/aws-sdk-go v1.44.93 h1:hAgd9fuaptBatSft27/5eBMdcA8+cIMqo96/tZ6rKl8=
9696
github.com/aws/aws-sdk-go v1.44.93/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
9797
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=

templates/helm/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ spec:
5555
- "$(ACK_RESOURCE_TAGS)"
5656
- --watch-namespace
5757
- "$(ACK_WATCH_NAMESPACE)"
58+
- --deletion-policy
59+
- "$(DELETION_POLICY)"
5860
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
5961
imagePullPolicy: {{ .Values.image.pullPolicy }}
6062
name: controller
@@ -74,6 +76,8 @@ spec:
7476
value: {{ .Values.aws.endpoint_url | quote }}
7577
- name: ACK_WATCH_NAMESPACE
7678
value: {{ include "watch-namespace" . }}
79+
- name: DELETION_POLICY
80+
value: {{ .Values.deletionPolicy }}
7781
- name: ACK_ENABLE_DEVELOPMENT_LOGGING
7882
value: {{ .Values.log.enable_development_logging | quote }}
7983
- name: ACK_LOG_LEVEL

templates/helm/values.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@
203203
"pattern": "(^$|^.*=.*$)"
204204
}
205205
},
206+
"deletionPolicy": {
207+
"type": "string",
208+
"enum": ["delete", "retain"]
209+
},
206210
"serviceAccount": {
207211
"description": "ServiceAccount settings",
208212
"properties": {

templates/helm/values.yaml.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ resourceTags:
7878
- services.k8s.aws/controller-version=%CONTROLLER_SERVICE%-%CONTROLLER_VERSION%
7979
- services.k8s.aws/namespace=%K8S_NAMESPACE%
8080

81+
# Set to "retain" to keep all AWS resources intact even after the K8s resources
82+
# have been deleted. By default, the ACK controller will delete the AWS resource
83+
# before the K8s resource is removed.
84+
deletionPolicy: delete
85+
8186
serviceAccount:
8287
# Specifies whether a service account should be created
8388
create: true

0 commit comments

Comments
 (0)