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

[redhat-3.10] pgupgrade: Do not try to scale down clair when unmanaged (PROJQUAY-6457) #893

Open
wants to merge 1 commit into
base: redhat-3.10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
@@ -1,10 +1,8 @@
# Overlay variant for upgrading to current Project Quay release.
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- ./clair-pg-upgrade.job.yaml
- ./clair-pg-old.persistentvolumeclaim.yaml
- ./clair-pg-old.deployment.yaml
patchesStrategicMerge:
- ./clair.deployment.patch.yaml
- ./clair-pg.deployment.patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
patchesStrategicMerge:
- ./clair.deployment.patch.yaml
resources:
- "../base"
6 changes: 5 additions & 1 deletion pkg/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ func KustomizationFor(
}

if ctx.NeedsPgUpgrade {
componentPaths = append(componentPaths, "../components/pgupgrade")
if v1.ComponentIsManaged(quay.Spec.Components, v1.ComponentClair) {
componentPaths = append(componentPaths, "../components/pgupgrade/scale-down-clair")
} else {
componentPaths = append(componentPaths, "../components/pgupgrade/base")
}
}
if ctx.NeedsClairPgUpgrade {
componentPaths = append(componentPaths, "../components/clairpgupgrade")
Expand Down
37 changes: 36 additions & 1 deletion pkg/kustomize/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,42 @@ var kustomizationForTests = []struct {
"../components/clair",
"../components/redis",
"../components/postgres",
"../components/pgupgrade",
"../components/pgupgrade/scale-down-clair",
},
Images: []types.Image{
{Name: "quay.io/projectquay/quay", NewName: "quay", NewTag: "latest"},
{Name: "quay.io/projectquay/clair", NewName: "clair", NewTag: "alpine"},
{Name: "docker.io/library/redis", NewName: "redis", NewTag: "buster"},
{Name: "quay.io/sclorg/postgresql-13-c9s", NewName: "postgres", NewTag: "latest"},
{Name: "centos/postgresql-10-centos7", NewName: "postgres_previous", NewTag: "latest"},
},
SecretGenerator: []types.SecretArgs{},
},
"",
},
{
"ClairPostgresUpgradeUnmanagedClair",
&v1.QuayRegistry{
Spec: v1.QuayRegistrySpec{
Components: []v1.Component{
{Kind: "postgres", Managed: true},
{Kind: "clair", Managed: false},
{Kind: "redis", Managed: true},
},
},
},
quaycontext.QuayRegistryContext{
NeedsPgUpgrade: true,
},
&types.Kustomization{
TypeMeta: types.TypeMeta{
APIVersion: types.KustomizationVersion,
Kind: types.KustomizationKind,
},
Components: []string{
"../components/redis",
"../components/postgres",
"../components/pgupgrade/base",
},
Images: []types.Image{
{Name: "quay.io/projectquay/quay", NewName: "quay", NewTag: "latest"},
Expand Down
Loading