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

Allow kustomize image override in Kustomization CRD #193

Closed
somtochiama opened this issue Dec 9, 2020 · 2 comments · Fixed by #194
Closed

Allow kustomize image override in Kustomization CRD #193

somtochiama opened this issue Dec 9, 2020 · 2 comments · Fixed by #194
Assignees
Labels
area/kustomize Kustomize related issues and pull requests

Comments

@somtochiama
Copy link
Member

In a case where the person with control over the syncing(kustomization CRD) does not have control over the config repository where the kustomization.yml reside and they can only refer to it. It would be great want to allow making changes(overriding the images) in the Kustomization CRD

Link to discussion:
(https://github.com/fluxcd/flux2/discussions/135)[https://github.com/fluxcd/flux2/discussions/135]
In particular this comment

In the first, the person with control over the syncing does not have control over the config repository -- they can only refer to it. So they must resort to putting changes into the sync.

@stefanprodan
Copy link
Member

Here is an example that could be used in e2e testing.

Having a public repo and a kustomization for podinfo:

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: podinfo
  namespace: default
spec:
  interval: 5m
  url: https://github.com/stefanprodan/podinfo
  ref:
    branch: master
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
  name: podinfo
  namespace: default
spec:
  interval: 5m
  path: "./kustomize"
  prune: true
  sourceRef:
    kind: GitRepository
    name: podinfo
  validation: client

I want to change the podinfo image tag without modifying podinfo repo, to do that I can override the image with:

apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
  name: podinfo
  namespace: default
spec:
  interval: 5m
  path: "./kustomize"
  prune: true
  sourceRef:
    kind: GitRepository
    name: podinfo
  validation: client
  images:
    - name: ghcr.io/stefanprodan/podinfo
      newName: ghcr.io/stefanprodan/podinfo
      newTag: 5.0.0

@stefanprodan stefanprodan added the area/kustomize Kustomize related issues and pull requests label Dec 9, 2020
@stefanprodan
Copy link
Member

stefanprodan commented Dec 9, 2020

Implementation tasks:

  • add the Image struct and spec.images to Kustomization API (docs+api pkg)
  • implement the images override in the controller reconciliation
  • add e2e tests for the images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kustomize Kustomize related issues and pull requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants