Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgupgrade: Use different service for postgres old (PROJQUAY-6672) #981

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ kind: Deployment
metadata:
name: clair-postgres-old
labels:
quay-component: clair-postgres
quay-component: clair-postgres-old
annotations:
quay-component: clair-postgres
quay-component: clair-postgres-old
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
quay-component: clair-postgres
quay-component: clair-postgres-old
template:
metadata:
labels:
quay-component: clair-postgres
quay-component: clair-postgres-old
spec:
terminationGracePeriodSeconds: 180
serviceAccountName: clair-postgres
Expand Down
17 changes: 17 additions & 0 deletions kustomize/components/clairpgupgrade/base/clair-pg-old.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: clair-postgres-old
labels:
quay-component: clair-postgres-old
annotations:
quay-component: clair-postgres-old
spec:
type: ClusterIP
ports:
- port: 5432
protocol: TCP
name: postgres
targetPort: 5432
selector:
quay-component: clair-postgres-old
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
valueFrom:
secretKeyRef:
name: clair-config-secret
key: clair-db-host
key: clair-db-old-host
- name: POSTGRESQL_MIGRATION_ADMIN_PASSWORD
value: postgres
- name: POSTGRESQL_SHARED_BUFFERS
Expand All @@ -49,9 +49,9 @@ spec:
cpu: 500m
memory: 2Gi
command:
- "/bin/sh"
- "-c"
- "/bin/sh"
- "-c"
args:
- >
run-postgresql --version || (echo "postgres migration command failed, cleaning up..." && rm -rf /var/lib/pgsql/data/* && exit 1)
- >
run-postgresql --version || (echo "postgres migration command failed, cleaning up..." && rm -rf /var/lib/pgsql/data/* && exit 1)
backoffLimit: 50
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ resources:
- ./clair-pg-upgrade.job.yaml
- ./clair-pg-old.persistentvolumeclaim.yaml
- ./clair-pg-old.deployment.yaml
- ./clair-pg-old.service.yaml
patchesStrategicMerge:
- ./clair-pg.deployment.patch.yaml
1 change: 1 addition & 0 deletions pkg/kustomize/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ func componentConfigFilesFor(log logr.Logger, qctx *quaycontext.QuayRegistryCont
cfgFiles["config.yaml"] = cfg
cfgFiles["01_user_config.yaml"] = configFiles["clair-config.yaml"]
cfgFiles["clair-db-host"] = []byte(strings.TrimSpace(strings.Join([]string{quay.GetName(), "clair-postgres"}, "-")))
cfgFiles["clair-db-old-host"] = []byte(strings.TrimSpace(strings.Join([]string{quay.GetName(), "clair-postgres-old"}, "-")))

return cfgFiles, nil
default:
Expand Down
Loading