-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update Clowder to reconcile on changes to non-app secrets/confi…
…gmaps * Add hashCache to the ClowdEnvironmentReconciliation * Remove all Secrets/ConfigMaps from Environment at start of reconciliation cycle * Embue HashObject with the always flag * Change updateHashCacheForConfigMapAndSecret to try to read in the sec/config and return true if always set * Make managed_kafka add the secret to the cache at the start of reconciliation * Update HashCache tests * Add kuttl tests for managed kafka secrets cc: @psav
- Loading branch information
Showing
14 changed files
with
228 additions
and
17 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
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
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
8 changes: 8 additions & 0 deletions
8
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/00-install.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,8 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: test-clowdapp-watcher-kafka-managed-secret | ||
spec: | ||
finalizers: | ||
- kubernetes |
50 changes: 50 additions & 0 deletions
50
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/01-assert.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: v1 | ||
kind: Secret | ||
metadata: | ||
name: puptoo | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
labels: | ||
app: puptoo | ||
ownerReferences: | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
name: puptoo | ||
type: Opaque | ||
data: | ||
cdappconfig.json: eyJoYXNoQ2FjaGUiOiJlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1OTRiNzlkNjczZjdlZTI1MjNmMzI2YjdjMTBmYTQyYTU2Y2EyNWY2YzEwM2NmZWM1NGRlY2MxODYxNDRlYzE3ZSIsImthZmthIjp7ImJyb2tlcnMiOlt7ImF1dGh0eXBlIjoic2FzbCIsImNhY2VydCI6InNvbWUtcGVtIiwiaG9zdG5hbWUiOiJrYWZrYS1ob3N0LW5hbWUiLCJwb3J0IjoyNzAxNSwic2FzbCI6eyJwYXNzd29yZCI6ImthZmthLXBhc3N3b3JkIiwic2FzbE1lY2hhbmlzbSI6IlBMQUlOIiwic2VjdXJpdHlQcm90b2NvbCI6IlNBU0xfU1NMIiwidXNlcm5hbWUiOiJrYWZrYS11c2VybmFtZSJ9LCJzZWN1cml0eVByb3RvY29sIjoiU0FTTF9TU0wifV0sInRvcGljcyI6W3sibmFtZSI6InRvcGljT25lIiwicmVxdWVzdGVkTmFtZSI6InRvcGljT25lIn0seyJuYW1lIjoidG9waWNUd28iLCJyZXF1ZXN0ZWROYW1lIjoidG9waWNUd28ifV19LCJsb2dnaW5nIjp7ImNsb3Vkd2F0Y2giOnsiYWNjZXNzS2V5SWQiOiIiLCJsb2dHcm91cCI6IiIsInJlZ2lvbiI6IiIsInNlY3JldEFjY2Vzc0tleSI6IiJ9LCJ0eXBlIjoibnVsbCJ9LCJtZXRhZGF0YSI6eyJkZXBsb3ltZW50cyI6W3siaW1hZ2UiOiJxdWF5LmlvL3BzYXYvY2xvd2Rlci1oZWxsbyIsIm5hbWUiOiJwcm9jZXNzb3IifV0sImVudk5hbWUiOiJ0ZXN0LWNsb3dkYXBwLXdhdGNoZXIta2Fma2EtdXNlci1zZWNyZXQiLCJuYW1lIjoicHVwdG9vIn0sIm1ldHJpY3NQYXRoIjoiL21ldHJpY3MiLCJtZXRyaWNzUG9ydCI6OTAwMCwicHJpdmF0ZVBvcnQiOjEwMDAwLCJwdWJsaWNQb3J0Ijo4MDAwLCJ3ZWJQb3J0Ijo4MDAwfQ== | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: puptoo-processor | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
spec: | ||
strategy: | ||
type: RollingUpdate | ||
template: | ||
spec: | ||
serviceAccountName: puptoo-processor | ||
containers: | ||
- env: | ||
- name: ENV_VAR_1 | ||
value: "env_var_1" | ||
- name: ACG_CONFIG | ||
value: /cdapp/cdappconfig.json | ||
--- | ||
apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdEnvironment | ||
metadata: | ||
name: test-clowdapp-watcher-kafka-managed-secret | ||
status: | ||
apps: | ||
- name: puptoo | ||
deployments: | ||
- name: puptoo-processor | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: test-clowdapp-watcher-kafka-managed-secret | ||
labels: | ||
kubernetes.io/metadata.name: test-clowdapp-watcher-kafka-managed-secret |
71 changes: 71 additions & 0 deletions
71
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/01-pods.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,71 @@ | ||
--- | ||
apiVersion: v1 | ||
data: | ||
hostname: a2Fma2EtaG9zdC1uYW1l # kafka-host-name | ||
port: MjcwMTU= # 27015 | ||
username: a2Fma2EtdXNlcm5hbWU= # kafka-username | ||
password: a2Fma2EtcGFzc3dvcmQ= # kafka-password | ||
cacert: c29tZS1wZW0= | ||
kind: Secret | ||
metadata: | ||
name: managed-secret | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
type: Opaque | ||
--- | ||
apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdEnvironment | ||
metadata: | ||
name: test-clowdapp-watcher-kafka-managed-secret | ||
spec: | ||
targetNamespace: test-clowdapp-watcher-kafka-managed-secret | ||
providers: | ||
web: | ||
port: 8000 | ||
mode: operator | ||
metrics: | ||
port: 9000 | ||
mode: operator | ||
path: "/metrics" | ||
kafka: | ||
mode: managed | ||
managedSecretRef: | ||
name: managed-secret | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
managedPrefix: "" | ||
db: | ||
mode: none | ||
logging: | ||
mode: none | ||
objectStore: | ||
mode: none | ||
inMemoryDb: | ||
mode: none | ||
resourceDefaults: | ||
limits: | ||
cpu: 400m | ||
memory: 1024Mi | ||
requests: | ||
cpu: 30m | ||
memory: 512Mi | ||
--- | ||
apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
metadata: | ||
name: puptoo | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
spec: | ||
envName: test-clowdapp-watcher-kafka-managed-secret | ||
deployments: | ||
- name: processor | ||
podSpec: | ||
image: quay.io/psav/clowder-hello | ||
env: | ||
- name: ENV_VAR_1 | ||
value: env_var_1 | ||
kafkaTopics: | ||
- replicas: 3 | ||
partitions: 64 | ||
topicName: topicOne | ||
- replicas: 5 | ||
partitions: 32 | ||
topicName: topicTwo |
10 changes: 10 additions & 0 deletions
10
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/02-json-asserts.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: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: sleep 5 | ||
- script: kubectl get secret --namespace=test-clowdapp-watcher-kafka-managed-secret puptoo -o json > /tmp/test-clowdapp-watcher-kafka-managed-secret | ||
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-clowdapp-watcher-kafka-managed-secret | base64 -d > /tmp/test-clowdapp-watcher-kafka-managed-secret-json | ||
|
||
|
||
- script: jq -r '.kafka.brokers[0].sasl.password == "kafka-password"' -e < /tmp/test-clowdapp-watcher-kafka-managed-secret-json |
15 changes: 15 additions & 0 deletions
15
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/03-assert.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,15 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: puptoo | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
labels: | ||
app: puptoo | ||
ownerReferences: | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
name: puptoo | ||
type: Opaque | ||
data: | ||
cdappconfig.json: eyJoYXNoQ2FjaGUiOiJlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1ZTNlZTVkZTI0MDM4MTFhODI5MzQxMjk0NGZkYzExN2MwMGFlMDk3ZjcxNzZlYjZmZWExNWM0YTgxZjAzYWE0NCIsImthZmthIjp7ImJyb2tlcnMiOlt7ImF1dGh0eXBlIjoic2FzbCIsImNhY2VydCI6InNvbWUtcGVtIiwiaG9zdG5hbWUiOiJrYWZrYS1ob3N0LW5hbWUiLCJwb3J0IjoyNzAxNSwic2FzbCI6eyJwYXNzd29yZCI6ImthZmthLW5ldy1wYXNzd29yZCIsInNhc2xNZWNoYW5pc20iOiJQTEFJTiIsInNlY3VyaXR5UHJvdG9jb2wiOiJTQVNMX1NTTCIsInVzZXJuYW1lIjoia2Fma2EtdXNlcm5hbWUifSwic2VjdXJpdHlQcm90b2NvbCI6IlNBU0xfU1NMIn1dLCJ0b3BpY3MiOlt7Im5hbWUiOiJ0b3BpY09uZSIsInJlcXVlc3RlZE5hbWUiOiJ0b3BpY09uZSJ9LHsibmFtZSI6InRvcGljVHdvIiwicmVxdWVzdGVkTmFtZSI6InRvcGljVHdvIn1dfSwibG9nZ2luZyI6eyJjbG91ZHdhdGNoIjp7ImFjY2Vzc0tleUlkIjoiIiwibG9nR3JvdXAiOiIiLCJyZWdpb24iOiIiLCJzZWNyZXRBY2Nlc3NLZXkiOiIifSwidHlwZSI6Im51bGwifSwibWV0YWRhdGEiOnsiZGVwbG95bWVudHMiOlt7ImltYWdlIjoicXVheS5pby9wc2F2L2Nsb3dkZXItaGVsbG8iLCJuYW1lIjoicHJvY2Vzc29yIn1dLCJlbnZOYW1lIjoidGVzdC1jbG93ZGFwcC13YXRjaGVyLWthZmthLXVzZXItc2VjcmV0IiwibmFtZSI6InB1cHRvbyJ9LCJtZXRyaWNzUGF0aCI6Ii9tZXRyaWNzIiwibWV0cmljc1BvcnQiOjkwMDAsInByaXZhdGVQb3J0IjoxMDAwMCwicHVibGljUG9ydCI6ODAwMCwid2ViUG9ydCI6ODAwMH0= |
13 changes: 13 additions & 0 deletions
13
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/03-pods.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,13 @@ | ||
--- | ||
apiVersion: v1 | ||
data: | ||
hostname: a2Fma2EtaG9zdC1uYW1l # kafka-host-name | ||
port: MjcwMTU= # 27015 | ||
username: a2Fma2EtdXNlcm5hbWU= # kafka-username | ||
password: a2Fma2EtbmV3LXBhc3N3b3Jk # kafka-new-password | ||
cacert: c29tZS1wZW0= | ||
kind: Secret | ||
metadata: | ||
name: managed-secret | ||
namespace: test-clowdapp-watcher-kafka-managed-secret | ||
type: Opaque |
9 changes: 9 additions & 0 deletions
9
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/04-json-asserts.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: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: sleep 5 | ||
- script: kubectl get secret --namespace=test-clowdapp-watcher-kafka-managed-secret puptoo -o json > /tmp/test-clowdapp-watcher-kafka-managed-secret2 | ||
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-clowdapp-watcher-kafka-managed-secret2 | base64 -d > /tmp/test-clowdapp-watcher-kafka-managed-secret2-json | ||
|
||
- script: jq -r '.kafka.brokers[0].sasl.password == "kafka-new-password"' -e < /tmp/test-clowdapp-watcher-kafka-managed-secret2-json |
10 changes: 10 additions & 0 deletions
10
tests/kuttl/test-clowdapp-watcher-kafka-managed-secret/05-delete.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: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
delete: | ||
- apiVersion: v1 | ||
kind: Namespace | ||
name: test-clowdapp-watcher-kafka-managed-secret | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdEnvironment | ||
name: test-clowdapp-watcher-kafka-managed-secret |