The following resources are composed to implement the referenced Composite Resource Definition (XRD).
Cluster
NodePool
ProviderConfig
Release
ProviderConfig
Object
Object
Object
Object
Object
Object
Object
Object
Object
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: cluster-google-official
creationTimestamp: null
labels:
cluster: gke
provider: google-official
spec:
compositeTypeRef:
apiVersion: devopstoolkitseries.com/v1alpha1
kind: CompositeCluster
patchSets:
- name: metadata
patches:
- fromFieldPath: metadata.labels
resources:
- name: gkecluster
base:
apiVersion: container.gcp.upbound.io/v1beta1
kind: Cluster
spec:
forProvider:
initialClusterVersion: latest
initialNodeCount: 1
location: us-east1
management:
- autoRepair: true
autoUpgrade: true
removeDefaultNodePool: true
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.id
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: "%s-cluster"
- fromFieldPath: spec.claimRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: spec.parameters.version
toFieldPath: spec.forProvider.minMasterVersion
- type: ToCompositeFieldPath
fromFieldPath: metadata.name
toFieldPath: status.clusterName
- type: ToCompositeFieldPath
fromFieldPath: status.message
toFieldPath: status.controlPlaneStatus
connectionDetails:
- fromConnectionSecretKey: kubeconfig
- name: value
fromConnectionSecretKey: kubeconfig
- name: nodepool
base:
apiVersion: container.gcp.upbound.io/v1beta1
kind: NodePool
spec:
forProvider:
autoscaling:
- enabled: true
maxNodeCount: 3
clusterSelector:
matchControllerRef: true
locations:
- us-east1-b
- us-east1-c
- us-east1-d
management:
- autoRepair: true
autoUpgrade: true
nodeConfig:
- oauthScopes:
- https://www.googleapis.com/auth/cloud-platform
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: spec.parameters.version
toFieldPath: spec.forProvider.version
- fromFieldPath: spec.parameters.minNodeCount
toFieldPath: spec.forProvider.initialNodeCount
- fromFieldPath: spec.parameters.minNodeCount
toFieldPath: spec.forProvider.autoscaling[0].minNodeCount
- fromFieldPath: spec.parameters.nodeSize
toFieldPath: spec.forProvider.nodeConfig[0].machineType
transforms:
- type: map
map:
large: e2-standard-16
medium: e2-standard-4
small: e2-standard-2
- type: ToCompositeFieldPath
fromFieldPath: status.message
toFieldPath: status.nodePoolStatus
- name: helm
base:
apiVersion: helm.crossplane.io/v1beta1
kind: ProviderConfig
spec:
credentials:
secretRef:
key: kubeconfig
name: kubeconfig
namespace: crossplane-system
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.claimRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: spec.id
toFieldPath: spec.credentials.secretRef.name
transforms:
- type: string
string:
fmt: "%s-cluster"
readinessChecks:
- type: None
- name: crossplane
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: crossplane
repository: https://charts.crossplane.io/stable
version: 1.13.2
namespace: crossplane-system
rollbackLimit: 3
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-crossplane"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: kubernetes
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
spec:
credentials:
secretRef:
key: kubeconfig
name: kubeconfig
namespace: crossplane-system
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.claimRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: spec.id
toFieldPath: spec.credentials.secretRef.name
transforms:
- type: string
string:
fmt: "%s-cluster"
readinessChecks:
- type: None
- name: ns-production
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: v1
kind: Namespace
metadata:
name: production
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-ns-production"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: ns-dev
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: v1
kind: Namespace
metadata:
name: dev
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-ns-dev"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: k8s-provider-sa
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: v1
kind: ServiceAccount
metadata:
name: provider-kubernetes
namespace: crossplane-system
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-k8s-provider-sa"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: k8s-provider-crb
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: provider-kubernetes
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: provider-kubernetes
namespace: crossplane-system
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-k8s-provider-crb"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: k8s-provider-cc
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: pkg.crossplane.io/v1alpha1
kind: ControllerConfig
metadata:
name: provider-kubernetes
spec:
serviceAccountName: provider-kubernetes
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-k8s-provider-cc"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: kubernetes-provider
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: crossplane-kubernetes-provider
spec:
controllerConfigRef:
name: provider-kubernetes
package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.9.0
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-kubernetes-provider"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: helm-provider
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: crossplane-helm-provider
spec:
controllerConfigRef:
name: provider-kubernetes
package: xpkg.upbound.io/crossplane-contrib/provider-helm:v0.15.0
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-helm-provider"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: config-app
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: crossplane-config-app
spec:
controllerConfigRef:
name: provider-kubernetes
package: xpkg.upbound.io/devops-toolkit/dot-application:v0.5.39
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-config-app"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- name: config-sql
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
spec:
forProvider:
manifest:
apiVersion: pkg.crossplane.io/v1
kind: Configuration
metadata:
name: crossplane-config-sql
spec:
controllerConfigRef:
name: provider-kubernetes
package: xpkg.upbound.io/devops-toolkit/dot-sql:v0.8.11
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-config-sql"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
writeConnectionSecretsToNamespace: crossplane-system