Skip to content

Commit

Permalink
added vacuum and repack
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed May 10, 2024
1 parent a917f64 commit ed37442
Show file tree
Hide file tree
Showing 49 changed files with 222 additions and 34 deletions.
2 changes: 1 addition & 1 deletion component/class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ parameters:
appcat:
registry: ghcr.io
repository: vshn/appcat
tag: v4.69.0
tag: vacuum_repack
apiserver:
registry: ghcr.io
repository: vshn/appcat-apiserver
Expand Down
5 changes: 5 additions & 0 deletions component/component/rbac_e2e.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ local e2eClusterRole = kube.ClusterRole('appcat:e2e') + {
resources: [ 'namespaces' ],
verbs: [ 'delete' ],
},
{
apiGroups: [ 'batch' ],
resources: [ 'jobs', 'cronjobs', 'jobs/finalizers', 'cronjobs/finalizers' ],
verbs: [ 'get', 'list', 'create', 'delete' ],
}
],
};

Expand Down
2 changes: 2 additions & 0 deletions component/component/vshn_services.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ local maintenanceRole = kube.ClusterRole(maintenanceRoleName) {
],
};


local maintenanceClusterRoleBinding = kube.ClusterRoleBinding('crossplane:appcat:job:helm:maintenance') + {
roleRef_: maintenanceRole,
subjects_: [ maintenanceServiceAccount ],
};


if params.services.vshn.enabled then {
'10_namespace_vshn_control': controlNamespace,
'10_rbac_helm_service_maintenance_sa': maintenanceServiceAccount,
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
data:
controlNamespace: syn-appcat-control
defaultPlan: standard-1
imageTag: v4.69.0
imageTag: vacuum_repack
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 @@ -23,7 +23,7 @@ spec:
env:
- name: PLANS_NAMESPACE
value: syn-appcat
image: ghcr.io/vshn/appcat:v4.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0-func
package: ghcr.io/vshn/appcat:vacuum_repack-func
runtimeConfigRef:
name: function-appcat
Original file line number Diff line number Diff line change
Expand Up @@ -5647,6 +5647,11 @@ spec:
settings.
type: object
x-kubernetes-preserve-unknown-fields: true
repackEnabled:
default: true
description: This is default option if neither repack
or vacuum are selected
type: boolean
serviceLevel:
default: besteffort
description: ServiceLevel defines the service level
Expand All @@ -5656,6 +5661,9 @@ spec:
- besteffort
- guaranteed
type: string
vacuumEnabled:
default: false
type: boolean
type: object
size:
description: Size contains settings to control the sizing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5103,6 +5103,11 @@ spec:
description: PGSettings contains additional PostgreSQL settings.
type: object
x-kubernetes-preserve-unknown-fields: true
repackEnabled:
default: true
description: This is default option if neither repack or
vacuum are selected
type: boolean
serviceLevel:
default: besteffort
description: ServiceLevel defines the service level of this
Expand All @@ -5112,6 +5117,9 @@ spec:
- besteffort
- guaranteed
type: string
vacuumEnabled:
default: false
type: boolean
type: object
size:
default: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
chartRepository: https://codecentric.github.io/helm-charts
chartVersion: 2.3.0
controlNamespace: syn-appcat-control
imageTag: v4.69.0
imageTag: vacuum_repack
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 @@ -31,7 +31,7 @@ spec:
chartRepository: https://charts.bitnami.com/bitnami
chartVersion: 11.6.2
controlNamespace: syn-appcat-control
imageTag: v4.69.0
imageTag: vacuum_repack
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 @@ -653,7 +653,7 @@ spec:
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
externalDatabaseConnectionsEnabled: 'true'
imageTag: v4.69.0
imageTag: vacuum_repack
isOpenshift: 'false'
loadbalancerAnnotations: |
foo: bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ spec:
emailAlertingSmtpHost: smtp.eu.mailgun.org:465
emailAlertingSmtpUsername: [email protected]
externalDatabaseConnectionsEnabled: 'true'
imageTag: v4.69.0
imageTag: vacuum_repack
isOpenshift: 'false'
loadbalancerAnnotations: |
foo: bar
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.69.0
imageTag: vacuum_repack
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 @@ -23,7 +23,7 @@ spec:
env:
- name: PLANS_NAMESPACE
value: syn-appcat
image: ghcr.io/vshn/appcat:v4.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
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: "true"
- name: APPCAT_SLI_VSHNMARIADB
value: "true"
image: ghcr.io/vshn/appcat:v4.69.0
image: ghcr.io/vshn/appcat:vacuum_repack
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 1 addition & 1 deletion package/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
image:
registry: ghcr.io
repository: vshn/appcat
tag: v4.69.0
tag: vacuum_repack
components:
appcat:
url: https://github.com/vshn/component-appcat.git
Expand Down
30 changes: 30 additions & 0 deletions tests/e2e/common/scripts/trigger-maintenance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

type="$1"
name="$2"
to_be_found="$3"

ns=$(kubectl -n "$NAMESPACE" get "$type" "$name" -oyaml | yq -r '.status.instanceNamespace')

kubectl -n "$ns" delete job --ignore-not-found=true --now=true vacuum databasesrepack
kubectl -n "$ns" create job --from cronjob/maintenancejob test

# wait until job is done
kubectl -n "$ns" wait --for=condition=complete --timeout=240s job/test

if [ "$to_be_found" == "r" ]; then
kubectl -n "$ns" get job
kubectl -n "$ns" get job databasesrepack
elif [ "$to_be_found" == "v" ]; then
kubectl -n "$ns" get job
kubectl -n "$ns" get job vacuum
elif [ "$to_be_found" == "b" ]; then
kubectl -n "$ns" get job
kubectl -n "$ns" get job databasesrepack
kubectl -n "$ns" get job vacuum
else
echo "Invalid argument"
exit 1
fi
2 changes: 2 additions & 0 deletions tests/e2e/postgresql/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ spec:
retention: 6
instances: 1
service:
vacuumEnabled: true
repackEnabled: true
majorVersion: "15"
serviceLevel: besteffort
size:
Expand Down
Loading

0 comments on commit ed37442

Please sign in to comment.