Skip to content

Commit

Permalink
adding downstream official Red Hat container images for components
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmerdler committed Sep 22, 2020
1 parent f6719b9 commit c8aada3
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 9 deletions.
10 changes: 10 additions & 0 deletions api/v1/quayregistry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ const (
QuayVersionDev QuayVersion = "dev"
)

// Downstream versions
const (
QuayVersionThreeDotFourDotZero = "3.4.0"
)

var quayVersions = map[QuayVersion]int{
QuayVersionDev: 0,
QuayVersionQuiGon: 1,
Expand All @@ -62,6 +67,10 @@ func mostRecentVersion() QuayVersion {
return mostRecent
}

var quayDownstreamVersions = map[QuayVersion]int{
QuayVersionThreeDotFourDotZero: 1,
}

var allComponents = []string{
"postgres",
"clair",
Expand Down Expand Up @@ -190,6 +199,7 @@ func ComponentsMatch(firstComponents, secondComponents []Component) bool {

// EnsureDesiredVersion validates that the Operator can managed the `Spec.DesiredVersion` indicated,
// or else sets it to the latest version it can manage if unset.
// FIXME(alecmerdler): Handle downstream `desiredVersion`...
func EnsureDesiredVersion(quay *QuayRegistry) (*QuayRegistry, error) {
updatedQuay := quay.DeepCopy()

Expand Down
2 changes: 1 addition & 1 deletion kustomize/base/config.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
name: quay-extra-certs
containers:
- name: quay-config-editor
image: quay.io/projectquay/config-tool@sha256:9aeff823414c93c3129eb98132affda14adce1d60af23b9e23ce481327591eaf
image: quay.io/alecmerdler/config-tool@sha256:445804de6a5b76dec631fd54a6f302785ce653709181e089cd784706f24391e0
ports:
- containerPort: 8080
protocol: TCP
Expand Down
20 changes: 20 additions & 0 deletions kustomize/overlays/downstream/3.4.0/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Overlay variant for Project Quay "padme" release.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonAnnotations:
quay-version: v3.4.0
bases:
- ../../../tmp
images:
- name: quay.io/projectquay/quay
newName: quay.io/redhat/quay
newTag: v3.4.0
- name: quay.io/projectquay/clair
newName: quay.io/redhat/clair
newTag: v3.4.0
- name: redis
newName: registry.access.redhat.com/rhscl/redis-32-rhel7
- name: postgres
newName: registry.access.redhat.com/rhscl/postgresql-10-rhel7
newTag: 1-35
# FIXME(alecmerdler): Need to handle `redhat-pull-secret` (potentially with a `secretGenerator`?)...
24 changes: 24 additions & 0 deletions kustomize/overlays/downstream/3.4.0/upgrade/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Overlay variant for upgrading to Red Hat Quay "v3.4.0" release.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonAnnotations:
quay-version: v3.4.0
bases:
- ../../../../tmp
patchesStrategicMerge:
# Scale the app deployment to 0 pods in order to run all migrations present in the new container image using the "upgrade" deployment.
- ./quay.deployment.patch.yaml
- ./upgrade.deployment.patch.yaml
images:
- name: quay.io/projectquay/quay
newName: quay.io/redhat/quay
newTag: v3.4.0
- name: quay.io/projectquay/clair
newName: quay.io/redhat/clair
newTag: v3.4.0
- name: redis
newName: registry.access.redhat.com/rhscl/redis-32-rhel7
- name: postgres
newName: registry.access.redhat.com/rhscl/postgresql-10-rhel7
newTag: 1-35
# FIXME(alecmerdler): Need to handle `redhat-pull-secret` (potentially with a `secretGenerator`?)...
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: quay-app
annotations:
quay-upgrade: v3.4.0
spec:
replicas: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: quay-app-upgrade
annotations:
quay-upgrade: v3.4.0
spec:
replicas: 1
13 changes: 12 additions & 1 deletion pkg/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
tlsTerminationKey = "quay-registry-tls-termination"
targetPortKey = "quay-registry-target-port"
managedFieldGroupsKey = "quay-managed-fieldgroups"
overlayModeKey = "OVERLAY_MODE"
)

func kustomizeDir() string {
Expand All @@ -50,10 +51,20 @@ func appDir() string {
}

func overlayDir(desiredVersion v1.QuayVersion) string {
return filepath.Join(kustomizeDir(), "overlays", "upstream", string(desiredVersion))
overlayMode := os.Getenv(overlayModeKey)
if overlayMode != "downstream" {
overlayMode = "upstream"
}

return filepath.Join(kustomizeDir(), "overlays", overlayMode, string(desiredVersion))
}

func upgradeOverlayDir(desiredVersion v1.QuayVersion) string {
overlayMode := os.Getenv(overlayModeKey)
if overlayMode != "downstream" {
overlayMode = "upstream"
}

return filepath.Join(kustomizeDir(), "overlays", "upstream", string(desiredVersion), "upgrade")
}

Expand Down
13 changes: 6 additions & 7 deletions pkg/kustomize/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import (
v1 "github.com/quay/quay-operator/api/v1"
)

const secretKeyLength = 80

// secretKeySecretName is the name of the Secret in which generated secret keys are
// stored.
const secretKeySecretName = "quay-registry-managed-secret-keys"
const (
// secretKeySecretName is the name of the Secret in which generated secret keys are stored.
secretKeySecretName = "quay-registry-managed-secret-keys"
secretKeyLength = 80
)

// SecretKeySecretName returns the name of the Secret in which generated secret keys are
// stored.
// SecretKeySecretName returns the name of the Secret in which generated secret keys are stored.
func SecretKeySecretName(quay *v1.QuayRegistry) string {
return quay.GetName() + "-" + secretKeySecretName
}
Expand Down

0 comments on commit c8aada3

Please sign in to comment.