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

Fix Dev Override for Kustomize (PROJQUAY-992) #331

Merged
merged 1 commit into from
Oct 8, 2020
Merged
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
Expand Up @@ -112,16 +112,16 @@ spec:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: quay.io/projectquay/quay-operator@sha256:4f88b7231dcac284893e7c6371ee631fccf592b553d0df76e624068bc9bb7553
name: quay-operator
# FIXME(alecmerdler): Kustomize panics because of the extra "magic" `..data/` directories that k8s adds to mounted volumes...
# volumeMounts:
# - mountPath: /workspace/kustomize/overlays/upstream/dev
# name: quay-dev-kustomize
volumeMounts:
- mountPath: /workspace/kustomize/overlays/upstream/dev/kustomization.yaml
subPath: kustomization.yaml
name: quay-dev-kustomize
serviceAccountName: quay-operator
# volumes:
# - name: quay-dev-kustomize
# configMap:
# name: quay-dev-kustomize
# optional: true
volumes:
- name: quay-dev-kustomize
configMap:
name: quay-dev-kustomize
optional: true
permissions:
- rules:
- apiGroups:
Expand Down
57 changes: 57 additions & 0 deletions docs/overrides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Overrides

By leveraging a [feature of Kustomize](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/image.md), we can override the container images that are deployed by the Quay Operator as part of managed components for a `QuayRegistry`.

**NOTE**: This is not supported and should only be used for development/testing as it will likely break between updates.

### Images

The following images can be overwritten:

- `quay.io/projquay/quay`
- `quay.io/projquay/clair`
- `postgres`
- `redis`

### Create Override ConfigMap

Create `ConfigMap` called `quay-dev-kustomize` in the same namespace that the Operator is installed in with the following contents in the `kustomization.yaml` key:

```yaml
# Overlay variant for "dev".
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonAnnotations:
quay-version: dev
bases:
- ../../../tmp
images:
# Replace `newName` with your custom image or leave it the same.
- name: quay.io/projectquay/quay
newName: quay.io/alecmerdler/quay
newTag: dev
- name: quay.io/projectquay/clair
newName: quay.io/alecmerdler/clair
newTag: dev
- name: postgres
newName: postgres
- name: redis
newName: redis
```

Either create this before installing the Operator, or simply restart the Operator `Pod` so that it mounts in the `ConfigMap` as a volume.

### Desired Version

Now when you create a `QuayRegistry` with the `spec.desiredVersion` set to `dev`, it will "inflate" to use these custom images:

```yaml
apiVersion: quay.redhat.com/v1
kind: QuayRegistry
metadata:
name: override
spec:
desiredVersion: dev
```

**NOTE**: This is done at the Operator level, so every `QuayRegistry` will be deployed using these overrides.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ github.com/quay/config-tool/pkg/lib/fieldgroups/database
github.com/quay/config-tool/pkg/lib/fieldgroups/distributedstorage
github.com/quay/config-tool/pkg/lib/fieldgroups/hostsettings
github.com/quay/config-tool/pkg/lib/fieldgroups/redis
github.com/quay/config-tool/pkg/lib/fieldgroups/repomirror
github.com/quay/config-tool/pkg/lib/fieldgroups/securityscanner
github.com/quay/config-tool/pkg/lib/shared
# github.com/rs/xid v1.2.1
Expand Down