Composition
GitOps
The following resources are composed to implement the referenced Composite Resource Definition (XRD).
ProviderConfig
Release
ProviderConfig
Object
Object
Object
Object
Object
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: gitops-argo-cd
creationTimestamp: null
labels:
provider: argo
spec:
compositeTypeRef:
apiVersion: devopstoolkitseries.com/v1alpha1
kind: GitOps
patchSets:
- name: metadata
patches:
- fromFieldPath: metadata.labels
resources:
- name: helm
base:
apiVersion: helm.crossplane.io/v1beta1
kind: ProviderConfig
spec:
credentials:
secretRef:
key: kubeconfig
source: Secret
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.parameters.kubeConfig.secretNamespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: spec.parameters.kubeConfig.secretName
toFieldPath: spec.credentials.secretRef.name
- fromFieldPath: spec.parameters.kubeConfig.secretKey
toFieldPath: spec.credentials.secretRef.key
readinessChecks:
- type: None
- name: argocd
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: argo-cd
repository: https://argoproj.github.io/argo-helm
version: 3.26.3
namespace: argocd
set:
- name: server.extraArgs
value: "{--insecure}"
- name: controller.args.appResyncPeriod
value: "30"
- name: configs.secret.argocdServerAdminPassword
value: $2a$10$m3eTlEdRen0nS86c5Zph5u/bDFQMcWZYdG3NVdiyaACCqoxLJaz16
- name: configs.secret.argocdServerAdminPasswordMtime
value: 2021-11-08T15:04:05Z
rollbackLimit: 3
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-argocd"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: kubernetes
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
spec:
credentials:
secretRef:
key: kubeconfig
source: Secret
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.parameters.kubeConfig.secretNamespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: spec.parameters.kubeConfig.secretName
toFieldPath: spec.credentials.secretRef.name
- fromFieldPath: spec.parameters.kubeConfig.secretKey
toFieldPath: spec.credentials.secretRef.key
readinessChecks:
- type: None
- name: argocd-project
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
name: production
namespace: argocd
spec:
clusterResourceWhitelist:
- group: "*"
kind: "*"
description: Production project
destinations:
- namespace: "*"
server: "*"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
sourceRepos:
- "*"
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-argocd-project"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: argocd-app
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
name: production-apps
namespace: argocd
spec:
destination:
namespace: production
server: https://kubernetes.default.svc
project: production
source:
path: apps
targetRevision: HEAD
syncPolicy:
automated:
allowEmpty: true
prune: true
selfHeal: true
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-argocd-app"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.gitOpsRepo
toFieldPath: spec.forProvider.manifest.spec.source.repoURL
- name: argocd-project-dev
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
name: dev
namespace: argocd
spec:
clusterResourceWhitelist:
- group: "*"
kind: "*"
description: Dev project
destinations:
- namespace: "*"
server: "*"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
sourceRepos:
- "*"
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-argocd-project-dev"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: argocd-app-dev
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
name: dev-apps
namespace: argocd
spec:
destination:
namespace: dev
server: https://kubernetes.default.svc
project: dev
source:
path: apps-dev
targetRevision: HEAD
syncPolicy:
automated:
allowEmpty: true
prune: true
selfHeal: true
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-argocd-app-dev"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.gitOpsRepo
toFieldPath: spec.forProvider.manifest.spec.source.repoURL
- name: ns-prod
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: v1
kind: Namespace
metadata:
name: infra
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-ns-infra"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name