Skip to content

Commit

Permalink
Fix pointer leaks by using generics
Browse files Browse the repository at this point in the history
We re-used the same pointer for every single reconcile of any given
service type. This could lead to leaking settings between the instances.
Resulting in instances enabling features that aren't actually enabled in
the claim belonging to the instance.

This change gets rid of the pointer by leveraging generics and reflect.
  • Loading branch information
Kidswiss committed Aug 26, 2024
1 parent aa715bb commit 4f66742
Show file tree
Hide file tree
Showing 46 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ parameters:
appcat:
registry: ghcr.io
repository: vshn/appcat
tag: v4.92.0
tag: v4.92.2
functionAppcat:
registry: ${appcat:images:appcat:registry}
repository: ${appcat:images:appcat:repository}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
env:
- name: PLANS_NAMESPACE
value: syn-appcat
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
2 changes: 1 addition & 1 deletion tests/golden/minio/appcat/appcat/10_function_appcat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
emailAlertingSmtpFromAddress: [email protected]
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
imageTag: v4.92.0
imageTag: v4.92.2
isOpenshift: 'false'
maintenanceSA: helm-based-service-maintenance
minioChartRepository: https://charts.min.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
env:
- name: PLANS_NAMESPACE
value: syn-appcat
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
envFrom:
- secretRef:
name: appcat-sla-reports-creds
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
name: sla-reporter
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
externalDatabaseConnectionsEnabled: 'false'
imageTag: v4.92.0
imageTag: v4.92.2
initContainers: '{"clusterReconciliationCycle": {"limits": {"cpu": "300m",
"memory": "200Mi"}, "requests": {"cpu": "100m", "memory": "100Mi"}}, "pgbouncerAuthFile":
{"limits": {"cpu": "300m", "memory": "500Mi"}, "requests": {"cpu": "100m",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ spec:
emailAlertingSmtpFromAddress: [email protected]
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
imageTag: v4.92.0
imageTag: v4.92.2
isOpenshift: 'true'
maintenanceSA: helm-based-service-maintenance
ownerGroup: vshn.appcat.vshn.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
value: "false"
- name: APPCAT_SLI_VSHNMARIADB
value: "false"
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 1 addition & 1 deletion tests/golden/vshn/appcat/appcat/10_function_appcat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ kind: Function
metadata:
name: function-appcat
spec:
package: ghcr.io/vshn/appcat:v4.92.0-func
package: ghcr.io/vshn/appcat:v4.92.2-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
emailAlertingSmtpFromAddress: [email protected]
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
imageTag: v4.92.0
imageTag: v4.92.2
ingress_annotations: |
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
cert-manager.io/cluster-issuer: letsencrypt-staging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
emailAlertingSmtpFromAddress: [email protected]
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
imageTag: v4.92.0
imageTag: v4.92.2
isOpenshift: 'false'
maintenanceSA: helm-based-service-maintenance
mode: standalone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
emailAlertingSmtpFromAddress: [email protected]
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
imageTag: v4.92.0
imageTag: v4.92.2
ingress_annotations: |
cert-manager.io/cluster-issuer: letsencrypt-staging
nginx.ingress.kubernetes.io/enable-cors: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
externalDatabaseConnectionsEnabled: 'true'
imageTag: v4.92.0
imageTag: v4.92.2
initContainers: '{"clusterReconciliationCycle": {"limits": {"cpu": "300m",
"memory": "200Mi"}, "requests": {"cpu": "100m", "memory": "100Mi"}}, "pgbouncerAuthFile":
{"limits": {"cpu": "300m", "memory": "500Mi"}, "requests": {"cpu": "100m",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ spec:
emailAlertingSmtpFromAddress: [email protected]
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
imageTag: v4.92.0
imageTag: v4.92.2
isOpenshift: 'false'
maintenanceSA: helm-based-service-maintenance
ownerGroup: vshn.appcat.vshn.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --secure-port=9443
- --tls-cert-file=/apiserver.local.config/certificates/tls.crt
- --tls-private-key-file=/apiserver.local.config/certificates/tls.key
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
env:
- name: PLANS_NAMESPACE
value: syn-appcat
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
envFrom:
- secretRef:
name: appcat-sla-reports-creds
image: ghcr.io/vshn/appcat:v4.92.0
image: ghcr.io/vshn/appcat:v4.92.2
name: sla-reporter
resources:
limits:
Expand Down
Loading

0 comments on commit 4f66742

Please sign in to comment.