Skip to content

Commit 0d2f2a5

Browse files
authored
replace plaintext password with secret ref (#8)
Domain.spec.advancedSecurityOptions.MasterUserOptions.MasterUserPassword field was plaintext. This PR replaces that plaintext field with a SecretKeyReference field, allowing Kubernetes secrets to replace those plaintext values. Closes Issue aws-controllers-k8s/community#1088 Signed-off-by: Jay Pipes <[email protected]> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent ba369ba commit 0d2f2a5

18 files changed

+197
-16
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2021-11-05T21:04:24Z"
3-
build_hash: 0a8fc32cdf2d33693e919e4a59da05599b9f916e
2+
build_date: "2021-12-08T14:01:10Z"
3+
build_hash: 5ffa7aecf6b688da8c06f91bdc7b342ea2848c3f
44
go_version: go1.17
5-
version: v0.15.1
6-
api_directory_checksum: 550c87ef2158e5b3d58bc5a8ff5d3367c192b04a
5+
version: v0.15.2
6+
api_directory_checksum: 8df06e8cb192495e377044abcf87854cdb929eed
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.40.51
99
generator_config_info:
10-
file_checksum: bd75f4fe50f216466e8e62e7f5c40bd1550da7e3
10+
file_checksum: 387dff40ea37afcdbb465ca305c08d320e2558f4
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ resources:
2929
template_path: hooks/domain/sdk_update_pre_build_request.go.tpl
3030
sdk_delete_pre_build_request:
3131
template_path: hooks/domain/sdk_delete_pre_build_request.go.tpl
32+
fields:
33+
AdvancedSecurityOptions.MasterUserOptions.MasterUserPassword:
34+
is_secret: true

apis/v1alpha1/types.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/opensearchservice.services.k8s.aws_domains.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,23 @@ spec:
6666
masterUserName:
6767
type: string
6868
masterUserPassword:
69-
type: string
69+
description: SecretKeyReference combines a k8s corev1.SecretReference
70+
with a specific key within the referred-to Secret
71+
properties:
72+
key:
73+
description: Key is the key within the secret
74+
type: string
75+
name:
76+
description: Name is unique within a namespace to reference
77+
a secret resource.
78+
type: string
79+
namespace:
80+
description: Namespace defines the space within which
81+
the secret name must be unique.
82+
type: string
83+
required:
84+
- key
85+
type: object
7086
type: object
7187
sAMLOptions:
7288
description: The SAML application configuration for the domain.

config/rbac/cluster-role-controller.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ rules:
2222
- get
2323
- list
2424
- watch
25+
- apiGroups:
26+
- ""
27+
resources:
28+
- secrets
29+
verbs:
30+
- get
31+
- list
32+
- watch
2533
- apiGroups:
2634
- opensearchservice.services.k8s.aws
2735
resources:

generator.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ resources:
2929
template_path: hooks/domain/sdk_update_pre_build_request.go.tpl
3030
sdk_delete_pre_build_request:
3131
template_path: hooks/domain/sdk_delete_pre_build_request.go.tpl
32+
fields:
33+
AdvancedSecurityOptions.MasterUserOptions.MasterUserPassword:
34+
is_secret: true

helm/crds/opensearchservice.services.k8s.aws_domains.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,23 @@ spec:
6666
masterUserName:
6767
type: string
6868
masterUserPassword:
69-
type: string
69+
description: SecretKeyReference combines a k8s corev1.SecretReference
70+
with a specific key within the referred-to Secret
71+
properties:
72+
key:
73+
description: Key is the key within the secret
74+
type: string
75+
name:
76+
description: Name is unique within a namespace to reference
77+
a secret resource.
78+
type: string
79+
namespace:
80+
description: Namespace defines the space within which
81+
the secret name must be unique.
82+
type: string
83+
required:
84+
- key
85+
type: object
7086
type: object
7187
sAMLOptions:
7288
description: The SAML application configuration for the domain.

helm/templates/cluster-role-controller.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ rules:
2828
- get
2929
- list
3030
- watch
31+
- apiGroups:
32+
- ""
33+
resources:
34+
- secrets
35+
verbs:
36+
- get
37+
- list
38+
- watch
3139
- apiGroups:
3240
- opensearchservice.services.k8s.aws
3341
resources:

pkg/resource/domain/sdk.go

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)