Composition
GitOps
The following resources are composed to implement the referenced Composite Resource Definition (XRD).
ProviderConfig
Release
ProviderConfig
Object
Object
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: gitops-argo-cd-gcp
creationTimestamp: null
labels:
provider: argo-gcp
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
identity:
secretRef:
key: creds
name: gcp-creds
namespace: crossplane-system
source: Secret
type: GoogleApplicationCredentials
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
identity:
secretRef:
key: creds
name: gcp-creds
namespace: crossplane-system
source: Secret
type: GoogleApplicationCredentials
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