kubesphere / ks-devops

This is a cloud-native application that focuses on the DevOps area.
https://kubesphere.io/devops/
Apache License 2.0
158 stars 89 forks source link

Support to set Kustomization parameters of an Application #695

Open LinuxSuRen opened 2 years ago

LinuxSuRen commented 2 years ago

/area console /kind feature

LinuxSuRen commented 2 years ago

/assign @EliChen95

ks-ci-bot commented 2 years ago

@LinuxSuRen: GitHub didn't allow me to assign the following users: EliChen95.

Note that only kubesphere members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide

In response to [this](https://github.com/kubesphere/ks-devops/issues/695#issuecomment-1181231909): >/assign @EliChen95 Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
EliChen95 commented 2 years ago

/assign

LinuxSuRen commented 2 years ago

Basically, this issue requests to allow users to set the parameters like the following kustomize part.

spec:
  argoApp:
    spec:
      source:
        repoURL: 'https://github.com/kubesphere/console'
        path: .
        targetRevision: HEAD
        kustomize:
          namePrefix: my_
          nameSuffix: _end
          images:
            - 'nginx=nginx:latest'
          commonLabels:
            name: rick
          commonAnnotations:
            name: rick
          forceCommonLabels: true
          forceCommonAnnotations: true

and you could get the old image list from the following annotation:

metadata:
  annotations:
    gitops.kubesphere.io/images: >-
      ghcr.io/opensource-f2f/kube-rbac-proxy:v0.8.0,ghcr.io/opensource-f2f/open-podcasts-apiserver:dev,ghcr.io/opensource-f2f/open-podcasts:dev

See the description of above fields from https://github.com/kubesphere/ks-devops/blob/59547bbae728f21875e2229db15753a0d91af2a6/pkg/api/gitops/v1alpha1/application.go#L245

See also https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/

LinuxSuRen commented 2 years ago

By the way, we need to provide an option to choose which Configuration Tool that they want to use. The possible values are: kustomize, helm and auto.

In this case, users need to choose kustomize before setting those parameters.