Skip to content

Commit fb9e6ba

Browse files
statefulset: Use stateful sets for posgres deployments (PROJQUAY-6672)
- Swap Postgres and Clair Postgres Deployments to StatefulSets
1 parent 62884a1 commit fb9e6ba

File tree

13 files changed

+715
-1026
lines changed

13 files changed

+715
-1026
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,5 @@ jobs:
4343
uses: actions/checkout@v3
4444
- name: OS Dependencies
4545
run: apt-get update && apt-get install -y tar make gcc
46-
- name: Install Kubebuilder
47-
run: |
48-
os=$(go env GOOS)
49-
arch=$(go env GOARCH)
50-
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_${os}_${arch}.tar.gz | tar -xz -C /tmp/
51-
mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder
52-
export PATH=$PATH:/usr/local/kubebuilder/bin
5346
- name: Tests
54-
run: go test -v ./...
47+
run: make test

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ all: manager
1717

1818
# Run tests
1919
test: manifests generate fmt vet envtest ## Run tests.
20-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
20+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./... -coverprofile cover.out
2121

2222
test-e2e:
2323
mkdir -p ./bin
@@ -87,7 +87,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
8787

8888
## Tool Versions
8989
KUSTOMIZE_VERSION ?= v5.2.1
90-
CONTROLLER_TOOLS_VERSION ?= v0.13.0
90+
CONTROLLER_TOOLS_VERSION ?= v0.14.0
9191

9292
.PHONY: kustomize
9393
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
@@ -107,7 +107,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
107107
.PHONY: envtest
108108
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
109109
$(ENVTEST): $(LOCALBIN)
110-
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
110+
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20230216140739-c98506dc3b8e
111111

112112
# This target called from the prepare-release github action.
113113
# CHANNEL - operator channel (eg. stable-3.6, candidate-3.9)

bundle/manifests/quayregistries.crd.yaml

Lines changed: 348 additions & 501 deletions
Large diffs are not rendered by default.

config/crd/bases/quay.redhat.com_quayregistries.yaml

Lines changed: 348 additions & 501 deletions
Large diffs are not rendered by default.

kustomize/components/clairpgupgrade/base/clair-pg.deployment.patch.yaml renamed to kustomize/components/clairpgupgrade/base/clair-pg.statefulset.patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: apps/v1
2-
kind: Deployment
2+
kind: StatefulSet
33
metadata:
44
name: clair-postgres
55
spec:

kustomize/components/clairpgupgrade/base/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ resources:
55
- ./clair-pg-old.persistentvolumeclaim.yaml
66
- ./clair-pg-old.deployment.yaml
77
patchesStrategicMerge:
8-
- ./clair-pg.deployment.patch.yaml
8+
- ./clair-pg.statefulset.patch.yaml
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Clair component adds Clair v4 security scanner and its database.
22
apiVersion: kustomize.config.k8s.io/v1alpha1
33
kind: Component
4-
resources:
4+
resources:
55
- ./postgres.serviceaccount.yaml
66
- ./postgres.persistentvolumeclaim.yaml
7-
- ./postgres.deployment.yaml
7+
- ./postgres.statefulset.yaml
88
- ./postgres.service.yaml
99
- ./clair-postgres-conf-sample.configmap.yaml

kustomize/components/clairpostgres/postgres.deployment.yaml renamed to kustomize/components/clairpostgres/postgres.statefulset.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
apiVersion: apps/v1
2-
kind: Deployment
2+
kind: StatefulSet
33
metadata:
44
name: clair-postgres
55
labels:
66
quay-component: clair-postgres
77
annotations:
88
quay-component: clair-postgres
99
spec:
10+
serviceName: clair-postgres
1011
replicas: 1
11-
strategy:
12-
type: Recreate
1312
selector:
1413
matchLabels:
1514
quay-component: clair-postgres
@@ -57,3 +56,4 @@ spec:
5756
requests:
5857
cpu: 500m
5958
memory: 2Gi
59+
volumeClaimTemplates: []

kustomize/components/pgupgrade/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ resources:
77
- ./quay-pg-old.deployment.yaml
88
patchesStrategicMerge:
99
- ./quay.deployment.patch.yaml
10-
- ./quay-pg.deployment.patch.yaml
10+
- ./quay-pg.statefulset.patch.yaml

kustomize/components/pgupgrade/quay-pg.deployment.patch.yaml renamed to kustomize/components/pgupgrade/quay-pg.statefulset.patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: apps/v1
2-
kind: Deployment
2+
kind: StatefulSet
33
metadata:
44
name: quay-database
55
spec:

0 commit comments

Comments
 (0)