feat(argo-cd): Add support for extension (#1050)

* add support for extension

Signed-off-by: Qing Ye <ye.qing@gojek.com>

* add volume mounts

Signed-off-by: Qing Ye <ye.qing@gojek.com>

* add RBAC

Signed-off-by: Qing Ye <ye.qing@gojek.com>

* add more control to extensions values and update readme

Signed-off-by: Qing Ye <ye.qing@gojek.com>

* remove trailing spaces in values file

Signed-off-by: Qing Ye <ye.qing@gojek.com>

* add missing extensions.enabled

Signed-off-by: Qing Ye <ye.qing@gojek.com>

* Update charts/argo-cd/Chart.yaml

Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
Signed-off-by: Qing Ye <ye.qing@gojek.com>

* add comment to extensions values

Signed-off-by: Qing Ye <ye.qing@gojek.com>

Co-authored-by: Qing Ye <ye.qing@gojek.com>
Co-authored-by: Marko Bevc <marko@scalefactory.com>
Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
pull/1053/head argo-cd-3.28.0
YE Qing 2021-12-10 23:22:37 +08:00 committed by GitHub
parent e4d94ad91e
commit 7033883914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 190 additions and 2 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v2.1.7
description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 3.27.1
version: 3.28.0
home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
keywords:
@ -21,4 +21,4 @@ dependencies:
condition: redis-ha.enabled
annotations:
artifacthub.io/changes: |
- "[Added]: Mention declarative set up for Argo CD in README.md"
- "[Added]: add extensions support"

View File

@ -394,6 +394,11 @@ NAME: my-release
| server.containerSecurityContext | object | `{}` | Servers container-level security context |
| server.env | list | `[]` | Environment variables to pass to Argo CD server |
| server.envFrom | list | `[]` (See [values.yaml]) | envFrom to pass to Argo CD server |
| server.extensions.contents | list | `[]` | Extensions to be loaded into the server |
| server.extensions.enabled | bool | `false` | Enable support for extensions |
| server.extensions.image.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy for extensions |
| server.extensions.image.repository | string | `"ghcr.io/argoproj-labs/argocd-extensions"` | Repository to use for extensions image |
| server.extensions.image.tag | string | `"v0.1.0"` | Tag to use for extensions image |
| server.extraArgs | list | `[]` | Additional command line arguments to pass to Argo CD server |
| server.extraContainers | list | `[]` | Additional containers to be added to the server pod |
| server.image.imagePullPolicy | string | `""` (defaults to global.image.imagePullPolicy) | Image pull policy for the Argo CD server |

View File

@ -0,0 +1,96 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
labels:
app.kubernetes.io/name: argocdextensions.argoproj.io
app.kubernetes.io/part-of: argocd
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
name: argocdextensions.argoproj.io
spec:
group: argoproj.io
names:
kind: ArgoCDExtension
listKind: ArgoCDExtensionList
plural: argocdextensions
singular: argocdextension
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ArgoCDExtension is the Schema for the argocdextensions API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ArgoCDExtensionSpec defines the desired state of ArgoCDExtension
properties:
sources:
description: Sources specifies where the extension should come from
items:
description: ExtensionSource specifies where the extension should
be sourced from
properties:
git:
description: Git is specified if the extension should be sourced
from a git repository
properties:
revision:
description: Revision specifies the revision of the Repository
to fetch
type: string
url:
description: URL specifies the Git repository URL to fetch
type: string
type: object
web:
description: Web is specified if the extension should be sourced
from a web file
properties:
url:
description: URK specifies the remote file URL
type: string
type: object
type: object
type: array
required:
- sources
type: object
status:
description: ArgoCDExtensionStatus defines the observed state of ArgoCDExtension
properties:
conditions:
items:
properties:
message:
description: Message contains human-readable message indicating
details about condition
type: string
status:
description: Boolean status describing if the condition is currently
true
type: string
type:
description: Type is an ArgoCDExtension condition type
type: string
required:
- message
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true

View File

@ -75,6 +75,10 @@ spec:
{{- if .Values.server.volumeMounts }}
{{- toYaml .Values.server.volumeMounts | nindent 8}}
{{- end }}
{{- if .Values.server.extensions.enabled }}
- name: extensions
mountPath: /tmp/extensions/
{{- end }}
{{- if .Values.configs.knownHosts }}
- mountPath: /app/config/ssh
name: ssh-known-hosts
@ -132,6 +136,14 @@ spec:
{{- with .Values.server.extraContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- if .Values.server.extensions.enabled }}
- name: argocd-extensions
image: {{ .Values.server.extensions.image.repository }}:{{ .Values.server.extensions.image.tag }}
imagePullPolicy: {{ .Values.server.extensions.image.imagePullPolicy }}
volumeMounts:
- name: extensions
mountPath: /tmp/extensions/
{{- end }}
{{- if .Values.server.nodeSelector }}
nodeSelector:
{{- toYaml .Values.server.nodeSelector | nindent 8 }}
@ -164,6 +176,10 @@ spec:
{{- if .Values.server.volumes }}
{{- toYaml .Values.server.volumes | nindent 6}}
{{- end }}
{{- if .Values.server.extensions.enabled }}
- name: extensions
emptyDir: {}
{{- end }}
- emptyDir: {}
name: static-files
- emptyDir: {}

View File

@ -0,0 +1,15 @@
{{- if .Values.server.extensions.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
name: argocd-server-extensions
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-server-extensions
subjects:
- kind: ServiceAccount
name: argocd-server
{{- end }}

View File

@ -0,0 +1,17 @@
{{- if .Values.server.extensions.enabled }}
{{- range $extension := .Values.server.extensions.contents }}
---
apiVersion: argoproj.io/v1alpha1
kind: ArgoCDExtension
metadata:
name: {{ $extension.name }}
finalizers:
- extensions-finalizer.argocd.argoproj.io
labels:
{{- include "argo-cd.labels" (dict "context" $ "component" $.Values.server.name "name" (printf "%s-extensions" $.Values.server.name)) | nindent 4 }}
spec:
sources:
- web:
url: {{ $extension.url }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,21 @@
{{- if .Values.server.extensions.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
name: argocd-server-extensions
rules:
- apiGroups:
- argoproj.io
resources:
- argocdextensions
verbs:
- create
- get
- list
- watch
- update
- delete
- patch
{{- end }}

View File

@ -1276,6 +1276,24 @@ server:
# name: custom-tools
# subPath: helm
extensions:
# -- Enable support for extensions
## This function in tech preview stage, do expect unstability or breaking changes in newer versions. Bump image.tag if necessary.
enabled: false
image:
# -- Repository to use for extensions image
repository: "ghcr.io/argoproj-labs/argocd-extensions"
# -- Tag to use for extensions image
tag: "v0.1.0"
# -- Image pull policy for extensions
imagePullPolicy: IfNotPresent
# -- Extensions to be loaded into the server
contents: []
# - name: argo-rollouts
# url: https://github.com/argoproj-labs/rollout-extension/releases/download/v0.1.0/extension.tar
## Repo Server
repoServer:
# -- Repo server name