seanblong/test@v0.1.1
cluster-composition

cluster-composition

cluster-composition
seanblong/test@v0.1.1cluster-composition
Type

Composition

Referenced XRD

XCluster

Source Codegithub.com/dexcom-inc/cdo-toolbox
Resources (3)

The following resources are composed to implement the referenced Composite Resource Definition (XRD).

Kind
Group
Version

Subnetwork

compute.gcp.upbound.io
v1beta1

Cluster

container.gcp.upbound.io
v1beta1

NodePool

container.gcp.upbound.io
v1beta1
YAML
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
  name: cluster-composition
  creationTimestamp: null
  labels:
    provider: GCP
spec:
  compositeTypeRef:
    apiVersion: devops.dexcom.io/v1alpha1
    kind: XCluster
  resources:
    - base:
        apiVersion: compute.gcp.upbound.io/v1beta1
        kind: Subnetwork
        spec:
          forProvider:
            deletionPolicy: Orphan
            ipCidrRange: 10.1.0.0/24
            privateIpGoogleAccess: true
            region: us-central1
            secondaryIpRange:
              - ipCidrRange: 10.1.64.0/18
                rangeName: pods
              - ipCidrRange: 10.1.128.0/19
                rangeName: services
          providerConfigRef:
            name: gcp-provider
      patches:
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-%s-subnet"
          toFieldPath: metadata.labels[networks.devops.dexcom.io/network-id]
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-%s-subnet"
          toFieldPath: metadata.name
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: 10.%s.0.0/24
          toFieldPath: spec.forProvider.ipCidrRange
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: 10.%s.64.0/18
          toFieldPath: spec.forProvider.secondaryIpRange[0].ipCidrRange
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: 10.%s.128.0/19
          toFieldPath: spec.forProvider.secondaryIpRange[1].ipCidrRange
        - fromFieldPath: spec.nodeRange
          toFieldPath: spec.forProvider.ipCidrRange
        - fromFieldPath: spec.podRange
          toFieldPath: spec.forProvider.secondaryIpRange[0].ipCidrRange
        - fromFieldPath: spec.serviceRange
          toFieldPath: spec.forProvider.secondaryIpRange[1].ipCidrRange
        - fromFieldPath: spec.region
          toFieldPath: spec.forProvider.region
        - fromFieldPath: spec.networkName
          toFieldPath: spec.forProvider.network
    - base:
        apiVersion: container.gcp.upbound.io/v1beta1
        kind: Cluster
        spec:
          forProvider:
            deletionPolicy: Orphan
            enableIntranodeVisibility: true
            initialNodeCount: 3
            ipAllocationPolicy:
              - clusterSecondaryRangeName: pods
                servicesSecondaryRangeName: services
            location: us-central1
            masterAuthorizedNetworksConfig:
              - cidrBlocks:
                  - cidrBlock: 66.85.67.20/32
                    displayName: Dexcom HQ
            networkPolicy:
              - enabled: true
            networkingMode: VPC_NATIVE
            privateClusterConfig:
              - enablePrivateEndpoint: false
                enablePrivateNodes: true
                masterGlobalAccessConfig:
                  - enabled: true
                masterIpv4CidrBlock: 10.1.160.0/28
            releaseChannel:
              - channel: STABLE
            removeDefaultNodePool: true
            resourceLimits: null
            subnetworkSelector:
              matchControllerRef: true
          providerConfigRef:
            name: gcp-provider
          writeConnectionSecretToRef:
            namespace: upbound-system
      patches:
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-cluster-%s"
          toFieldPath: spec.writeConnectionSecretToRef.name
        - type: ToCompositeFieldPath
          fromFieldPath: status.atProvider.status
          toFieldPath: status.controlPlaneStatus
        - fromFieldPath: spec.networkName
          toFieldPath: spec.forProvider.network
        - fromFieldPath: spec.region
          toFieldPath: spec.forProvider.location
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-cluster-%s"
          toFieldPath: metadata.name
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: 10.%s.160.0/28
          toFieldPath: spec.forProvider.privateClusterConfig[0].masterIpv4CidrBlock
        - fromFieldPath: spec.controlPlaneRange
          toFieldPath: spec.forProvider.privateClusterConfig[0].masterIpv4CidrBlock
      connectionDetails:
        - fromConnectionSecretKey: kubeconfig
      readinessChecks:
        - type: MatchString
          fieldPath: status.atProvider.status
          matchString: RUNNING
    - base:
        apiVersion: container.gcp.upbound.io/v1beta1
        kind: NodePool
        spec:
          forProvider:
            autoscaling:
              - maxNodeCount: 60
                minNodeCount: 1
            clusterSelector:
              matchControllerRef: true
            initialNodeCount: 1
            location: us-central1
            management:
              - autoRepair: true
                autoUpgrade: true
            maxPodsPerNode: 32
            nodeConfig:
              - diskSizeGb: 100
                imageType: COS_CONTAINERD
                machineType: n1-standard-4
                metadata:
                  disable-legacy-endpoints: "true"
                oauthScopes:
                  - https://www.googleapis.com/auth/cloud-platform
                preemptible: false
                shieldedInstanceConfig:
                  - enableIntegrityMonitoring: true
                    enableSecureBoot: true
          providerConfigRef:
            name: gcp-provider
          writeConnectionSecretToRef:
            namespace: upbound-system
      patches:
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-%s-nodepool"
          toFieldPath: metadata.name
        - fromFieldPath: spec.machineType
          toFieldPath: spec.forProvider.nodeConfig[0].machineType
          transforms:
            - type: map
              map:
                large: n1-standard-32
                medium: n1-standard-16
                small: n1-standard-4
        - fromFieldPath: spec.initialNodeCount
          toFieldPath: spec.forProvider.initialNodeCount
        - fromFieldPath: spec.maxNodeCount
          toFieldPath: spec.forProvider.autoscaling[0].maxNodeCount
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-cluster-%s"
          toFieldPath: spec.forProvider.cluster
        - type: CombineFromComposite
          combine:
            variables:
              - fromFieldPath: spec.envDescr
              - fromFieldPath: spec.clusterIndex
            strategy: string
            string:
              fmt: "%s-nodepool-%s"
          toFieldPath: spec.writeConnectionSecretToRef.name
        - type: ToCompositeFieldPath
          fromFieldPath: status.atProvider.status
          toFieldPath: status.controlPlaneStatus
      readinessChecks:
        - type: MatchString
          fieldPath: status.atProvider.status
          matchString: RUNNING
Discover the building blocks for your internal cloud platform.
© 2024 Upbound, Inc.
Solutions