weaveworks / weave-gitops-enterprise

This repo provides the enterprise level features for the weave-gitops product, including CAPI cluster creation and team workspaces.
https://docs.gitops.weave.works/
Apache License 2.0
160 stars 29 forks source link

WGE cncf conformance testing 2023 (1.25.5) #2316

Closed foot closed 1 year ago

foot commented 1 year ago

Due: 05-02-2023

Previous goes

Instructions

Plan of attack

foot commented 1 year ago
make request-cluster ARGS="--team team-pesto --cluster-name conformance2023 --weave-mode enterprise"
git add .
git ci -avm "Adds new cluster conformance2023"
git push
foot commented 1 year ago

Create the sp on the team-pesto-use1 resourceGroup as per https://capz.sigs.k8s.io/topics/getting-started.html#prerequisites,

az ad sp create-for-rbac --role contributor --scopes="/subscriptions/ace37984-3d07-4051-9002-d5a52c0ae14b/resourceGroups/team-pesto-use1"

The take the appid etc and create all the vars and follow the rest of the cluster-api quickstart guide https://cluster-api.sigs.k8s.io/user/quick-start.html but also make sure to include:

Enable AKS support when install capz

export EXP_MACHINE_POOL=true
export EXP_AKS=true
clusterctl init --infrastructure azure

Template https://github.com/weaveworks/clusters-config/blob/cluster-conformance2023/eksctl-clusters/clusters/conformance2023/templates/aks.yaml

With lots of defaults, including declaring

    - name: AZURE_RESOURCE_GROUP
      default: "team-pesto-use1"

To match up w/ the sp

foot commented 1 year ago

AKS only support 1.25.5 as latest so we test against that

foot commented 1 year ago

@davidstauffer could you link to the conformance submission PR and then we can close this!

foot commented 1 year ago

https://github.com/cncf/k8s-conformance/pull/2438

foot commented 1 year ago

Branch has been deleted, here is the git history of that branch

commit 2e323dc7a4754b8a412d786dfcdd4ca945d02145
Author: Simon Howe <simon@weave.works>
Date:   Thu Feb 2 17:16:36 2023 +0100

    only 2 worker nodes

diff --git a/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml b/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml
index 3e9e6a9..700b8bd 100644
--- a/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml
+++ b/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml
@@ -2,7 +2,8 @@ apiVersion: gitops.weave.works/v1alpha1
 kind: GitopsCluster
 metadata:
   annotations:
-    templates.weave.works/create-request: '{"repository_url":"https://github.com/weaveworks/clusters-config","head_branch":"wge-create-branch-xmfsek","title":"Creates
+    templates.weave.works/create-request:
+      '{"repository_url":"https://github.com/weaveworks/clusters-config","head_branch":"wge-create-branch-xmfsek","title":"Creates
       resource ","description":"This PR creates a aks-template instance","template_name":"aks-template","parameter_values":{"AZURE_CLIENT_ID":"626d016a-9788-442c-b062-3ed7e64340db","AZURE_CLUSTER_IDENTITY_SECRET_NAME":"cluster-identity-secret","AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE":"default","AZURE_LOCATION":"eastus","AZURE_NODE_MACHINE_TYPE":"Standard_D2s_v3","AZURE_RESOURCE_GROUP":"team-pesto-use1","AZURE_SUBSCRIPTION_ID":"ace37984-3d07-4051-9002-d5a52c0ae14b","AZURE_TENANT_ID":"3747a928-2079-440f-8f0f-ab1be2a7c058","CLUSTER_IDENTITY_NAME":"cluster-identity","CLUSTER_NAME":"pesto-conformance2023","KUBERNETES_VERSION":"1.25.5","NAMESPACE":"default","WORKER_MACHINE_COUNT":"3"},"commit_message":"Creates
       aks-template instance","credentials":{},"template_namespace":"default","template_kind":"GitOpsTemplate"}'
   labels:
@@ -27,7 +28,7 @@ spec:
   clusterNetwork:
     services:
       cidrBlocks:
-      - 192.168.0.0/16
+        - 192.168.0.0/16
   controlPlaneRef:
     apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
     kind: AzureManagedControlPlane
@@ -83,7 +84,7 @@ metadata:
   namespace: default
 spec:
   clusterName: pesto-conformance2023
-  replicas: 3
+  replicas: 2
   template:
     metadata: {}
     spec:

commit 215b8f30dcdfa29a84cd9374adf2d6f0ee441280
Merge: fb9d75b 0140b44
Author: Simon <footless@gmail.com>
Date:   Thu Feb 2 17:07:47 2023 +0100

    Merge pull request #339 from weaveworks/wge-create-branch-xmfsek

    Creates resource

commit 0140b448ef6ebc2cee65da936f77b17c4e8d3ac7
Author: Simon <footless@gmail.com>
Date:   Thu Feb 2 17:07:37 2023 +0100

    Creates aks-template instance

diff --git a/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml b/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml
new file mode 100644
index 0000000..3e9e6a9
--- /dev/null
+++ b/eksctl-clusters/clusters/conformance2023/clusters/default/pesto-conformance2023.yaml
@@ -0,0 +1,176 @@
+apiVersion: gitops.weave.works/v1alpha1
+kind: GitopsCluster
+metadata:
+  annotations:
+    templates.weave.works/create-request: '{"repository_url":"https://github.com/weaveworks/clusters-config","head_branch":"wge-create-branch-xmfsek","title":"Creates
+      resource ","description":"This PR creates a aks-template instance","template_name":"aks-template","parameter_values":{"AZURE_CLIENT_ID":"626d016a-9788-442c-b062-3ed7e64340db","AZURE_CLUSTER_IDENTITY_SECRET_NAME":"cluster-identity-secret","AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE":"default","AZURE_LOCATION":"eastus","AZURE_NODE_MACHINE_TYPE":"Standard_D2s_v3","AZURE_RESOURCE_GROUP":"team-pesto-use1","AZURE_SUBSCRIPTION_ID":"ace37984-3d07-4051-9002-d5a52c0ae14b","AZURE_TENANT_ID":"3747a928-2079-440f-8f0f-ab1be2a7c058","CLUSTER_IDENTITY_NAME":"cluster-identity","CLUSTER_NAME":"pesto-conformance2023","KUBERNETES_VERSION":"1.25.5","NAMESPACE":"default","WORKER_MACHINE_COUNT":"3"},"commit_message":"Creates
+      aks-template instance","credentials":{},"template_namespace":"default","template_kind":"GitOpsTemplate"}'
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023
+  namespace: default
+spec:
+  capiClusterRef:
+    name: pesto-conformance2023
+
+---
+apiVersion: cluster.x-k8s.io/v1beta1
+kind: Cluster
+metadata:
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023
+  namespace: default
+spec:
+  clusterNetwork:
+    services:
+      cidrBlocks:
+      - 192.168.0.0/16
+  controlPlaneRef:
+    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+    kind: AzureManagedControlPlane
+    name: pesto-conformance2023
+  infrastructureRef:
+    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+    kind: AzureManagedCluster
+    name: pesto-conformance2023
+
+---
+apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+kind: AzureManagedControlPlane
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023
+  namespace: default
+spec:
+  identityRef:
+    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+    kind: AzureClusterIdentity
+    name: cluster-identity
+  location: eastus
+  resourceGroupName: team-pesto-use1
+  subscriptionID: ace37984-3d07-4051-9002-d5a52c0ae14b
+  version: 1.25.5
+
+---
+apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+kind: AzureManagedCluster
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023
+  namespace: default
+
+---
+apiVersion: cluster.x-k8s.io/v1beta1
+kind: MachinePool
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023-pool0
+  namespace: default
+spec:
+  clusterName: pesto-conformance2023
+  replicas: 3
+  template:
+    metadata: {}
+    spec:
+      bootstrap:
+        dataSecretName: ""
+      clusterName: pesto-conformance2023
+      infrastructureRef:
+        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+        kind: AzureManagedMachinePool
+        name: pesto-conformance2023-pool0
+      version: 1.25.5
+
+---
+apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+kind: AzureManagedMachinePool
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023-pool0
+  namespace: default
+spec:
+  mode: System
+  name: pool0
+  sku: Standard_D2s_v3
+
+---
+apiVersion: cluster.x-k8s.io/v1beta1
+kind: MachinePool
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023-pool1
+  namespace: default
+spec:
+  clusterName: pesto-conformance2023
+  replicas: 3
+  template:
+    metadata: {}
+    spec:
+      bootstrap:
+        dataSecretName: ""
+      clusterName: pesto-conformance2023
+      infrastructureRef:
+        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+        kind: AzureManagedMachinePool
+        name: pesto-conformance2023-pool1
+      version: 1.25.5
+
+---
+apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+kind: AzureManagedMachinePool
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: pesto-conformance2023-pool1
+  namespace: default
+spec:
+  mode: User
+  name: pool1
+  sku: Standard_D2s_v3
+
+---
+apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+kind: AzureClusterIdentity
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/prune: disabled
+  labels:
+    clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
+    templates.weave.works/template-name: aks-template
+    templates.weave.works/template-namespace: default
+  name: cluster-identity
+  namespace: default
+spec:
+  allowedNamespaces: {}
+  clientID: 626d016a-9788-442c-b062-3ed7e64340db
+  clientSecret:
+    name: cluster-identity-secret
+    namespace: default
+  tenantID: 3747a928-2079-440f-8f0f-ab1be2a7c058
+  type: ServicePrincipal

commit fb9d75b2e45276c148133cbb1e56b4c6bd9d3a7a
Author: Simon Howe <simon@weave.works>
Date:   Thu Feb 2 17:05:56 2023 +0100

    stringify

diff --git a/eksctl-clusters/clusters/conformance2023/templates/aks.yaml b/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
index 22a93d6..f6cb3db 100644
--- a/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
+++ b/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
@@ -11,29 +11,29 @@ spec:
     - name: CLUSTER_NAME
       default: "pesto-conformance2023"
     - name: AZURE_CLIENT_ID
-      default: 626d016a-9788-442c-b062-3ed7e64340db
+      default: "626d016a-9788-442c-b062-3ed7e64340db"
     - name: AZURE_CLUSTER_IDENTITY_SECRET_NAME
-      default: cluster-identity-secret
+      default: "cluster-identity-secret"
     - name: AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE
-      default: default
+      default: "default"
     - name: AZURE_LOCATION
-      default: eastus
+      default: "eastus"
     - name: AZURE_NODE_MACHINE_TYPE
-      default: Standard_D2s_v3
+      default: "Standard_D2s_v3"
     - name: AZURE_RESOURCE_GROUP
       default: "team-pesto-use1"
     - name: AZURE_SUBSCRIPTION_ID
-      default: ace37984-3d07-4051-9002-d5a52c0ae14b
+      default: "ace37984-3d07-4051-9002-d5a52c0ae14b"
     - name: AZURE_TENANT_ID
-      default: 3747a928-2079-440f-8f0f-ab1be2a7c058
+      default: "3747a928-2079-440f-8f0f-ab1be2a7c058"
     - name: CLUSTER_IDENTITY_NAME
-      default: cluster-identity
+      default: "cluster-identity"
     - name: KUBERNETES_VERSION
-      default: 1.25.5
+      default: "1.25.5"
     - name: NAMESPACE
-      default: default
+      default: "default"
     - name: WORKER_MACHINE_COUNT
-      default: 3
+      default: "3"
   resourcetemplates:
     - content:
         - apiVersion: gitops.weave.works/v1alpha1

commit c497f9d6ff88ec7a03d6554a4894221fed4e8492
Author: Simon Howe <simon@weave.works>
Date:   Thu Feb 2 17:02:47 2023 +0100

    update aks template

diff --git a/eksctl-clusters/clusters/conformance2023/templates/aks.yaml b/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
index b89abdd..22a93d6 100644
--- a/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
+++ b/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
@@ -1,12 +1,39 @@
 apiVersion: templates.weave.works/v1alpha2
 kind: GitOpsTemplate
 metadata:
-  name: cluster-template-development
+  name: aks-template
   namespace: default
   annotations:
     templates.weave.works/inject-prune-annotation: "true"
 spec:
   description: A simple CAPD template
+  params:
+    - name: CLUSTER_NAME
+      default: "pesto-conformance2023"
+    - name: AZURE_CLIENT_ID
+      default: 626d016a-9788-442c-b062-3ed7e64340db
+    - name: AZURE_CLUSTER_IDENTITY_SECRET_NAME
+      default: cluster-identity-secret
+    - name: AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE
+      default: default
+    - name: AZURE_LOCATION
+      default: eastus
+    - name: AZURE_NODE_MACHINE_TYPE
+      default: Standard_D2s_v3
+    - name: AZURE_RESOURCE_GROUP
+      default: "team-pesto-use1"
+    - name: AZURE_SUBSCRIPTION_ID
+      default: ace37984-3d07-4051-9002-d5a52c0ae14b
+    - name: AZURE_TENANT_ID
+      default: 3747a928-2079-440f-8f0f-ab1be2a7c058
+    - name: CLUSTER_IDENTITY_NAME
+      default: cluster-identity
+    - name: KUBERNETES_VERSION
+      default: 1.25.5
+    - name: NAMESPACE
+      default: default
+    - name: WORKER_MACHINE_COUNT
+      default: 3
   resourcetemplates:
     - content:
         - apiVersion: gitops.weave.works/v1alpha1
@@ -47,7 +74,7 @@ spec:
               name: ${CLUSTER_IDENTITY_NAME}
             location: ${AZURE_LOCATION}
             resourceGroupName: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}}
-            sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
+            # sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
             subscriptionID: ${AZURE_SUBSCRIPTION_ID}
             version: ${KUBERNETES_VERSION}
         - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1

commit f97933e408d894e9c9f1f1c06213b42bae95b56e
Author: Simon Howe <simon@weave.works>
Date:   Thu Feb 2 16:38:34 2023 +0100

    0.16.0

diff --git a/eksctl-clusters/apps/enterprise/enterprise-app/release.yaml b/eksctl-clusters/apps/enterprise/enterprise-app/release.yaml
index 7a83e17..9a89b8f 100644
--- a/eksctl-clusters/apps/enterprise/enterprise-app/release.yaml
+++ b/eksctl-clusters/apps/enterprise/enterprise-app/release.yaml
@@ -1,4 +1,3 @@
-
 apiVersion: source.toolkit.fluxcd.io/v1beta2
 kind: HelmRepository
 metadata:
@@ -19,13 +18,13 @@ spec:
   chart:
     spec:
       chart: mccp
-      version: ">= 0.0.0-0"
+      version: 0.16.0
       sourceRef:
         kind: HelmRepository
         name: weave-gitops-enterprise-charts
         namespace: flux-system
   dependsOn:
-  - name: cert-manager
+    - name: cert-manager
   interval: 10m0s
   install:
     crds: CreateReplace
@@ -68,10 +67,10 @@ spec:
           annotations:
             external-dns.alpha.kubernetes.io/hostname: promotions-${CLUSTER_NAME}.eng-sandbox.weave.works
           hosts:
-          - host: promotions-${CLUSTER_NAME}.eng-sandbox.weave.works
-            paths:
-            - path: /
-              pathType: ImplementationSpecific
+            - host: promotions-${CLUSTER_NAME}.eng-sandbox.weave.works
+              paths:
+                - path: /
+                  pathType: ImplementationSpecific
     ingress:
       enabled: true
       className: "public-nginx"

commit 18c64d528c64dc597ba07e2bd3a3cfb3a5e725da
Author: Simon Howe <simon@weave.works>
Date:   Thu Feb 2 16:16:02 2023 +0100

    adds aks template

diff --git a/eksctl-clusters/clusters/conformance2023/templates/aks.yaml b/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
new file mode 100644
index 0000000..b89abdd
--- /dev/null
+++ b/eksctl-clusters/clusters/conformance2023/templates/aks.yaml
@@ -0,0 +1,128 @@
+apiVersion: templates.weave.works/v1alpha2
+kind: GitOpsTemplate
+metadata:
+  name: cluster-template-development
+  namespace: default
+  annotations:
+    templates.weave.works/inject-prune-annotation: "true"
+spec:
+  description: A simple CAPD template
+  resourcetemplates:
+    - content:
+        - apiVersion: gitops.weave.works/v1alpha1
+          kind: GitopsCluster
+          metadata:
+            name: "${CLUSTER_NAME}"
+            namespace: "${NAMESPACE}"
+          spec:
+            capiClusterRef:
+              name: "${CLUSTER_NAME}"
+        - apiVersion: cluster.x-k8s.io/v1beta1
+          kind: Cluster
+          metadata:
+            name: ${CLUSTER_NAME}
+            namespace: default
+          spec:
+            clusterNetwork:
+              services:
+                cidrBlocks:
+                  - 192.168.0.0/16
+            controlPlaneRef:
+              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+              kind: AzureManagedControlPlane
+              name: ${CLUSTER_NAME}
+            infrastructureRef:
+              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+              kind: AzureManagedCluster
+              name: ${CLUSTER_NAME}
+        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+          kind: AzureManagedControlPlane
+          metadata:
+            name: ${CLUSTER_NAME}
+            namespace: default
+          spec:
+            identityRef:
+              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+              kind: AzureClusterIdentity
+              name: ${CLUSTER_IDENTITY_NAME}
+            location: ${AZURE_LOCATION}
+            resourceGroupName: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}}
+            sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
+            subscriptionID: ${AZURE_SUBSCRIPTION_ID}
+            version: ${KUBERNETES_VERSION}
+        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+          kind: AzureManagedCluster
+          metadata:
+            name: ${CLUSTER_NAME}
+            namespace: default
+        - apiVersion: cluster.x-k8s.io/v1beta1
+          kind: MachinePool
+          metadata:
+            name: ${CLUSTER_NAME}-pool0
+            namespace: default
+          spec:
+            clusterName: ${CLUSTER_NAME}
+            replicas: ${WORKER_MACHINE_COUNT}
+            template:
+              metadata: {}
+              spec:
+                bootstrap:
+                  dataSecretName: ""
+                clusterName: ${CLUSTER_NAME}
+                infrastructureRef:
+                  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+                  kind: AzureManagedMachinePool
+                  name: ${CLUSTER_NAME}-pool0
+                version: ${KUBERNETES_VERSION}
+        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+          kind: AzureManagedMachinePool
+          metadata:
+            name: ${CLUSTER_NAME}-pool0
+            namespace: default
+          spec:
+            mode: System
+            name: pool0
+            sku: ${AZURE_NODE_MACHINE_TYPE}
+        - apiVersion: cluster.x-k8s.io/v1beta1
+          kind: MachinePool
+          metadata:
+            name: ${CLUSTER_NAME}-pool1
+            namespace: default
+          spec:
+            clusterName: ${CLUSTER_NAME}
+            replicas: ${WORKER_MACHINE_COUNT}
+            template:
+              metadata: {}
+              spec:
+                bootstrap:
+                  dataSecretName: ""
+                clusterName: ${CLUSTER_NAME}
+                infrastructureRef:
+                  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+                  kind: AzureManagedMachinePool
+                  name: ${CLUSTER_NAME}-pool1
+                version: ${KUBERNETES_VERSION}
+        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+          kind: AzureManagedMachinePool
+          metadata:
+            name: ${CLUSTER_NAME}-pool1
+            namespace: default
+          spec:
+            mode: User
+            name: pool1
+            sku: ${AZURE_NODE_MACHINE_TYPE}
+        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
+          kind: AzureClusterIdentity
+          metadata:
+            labels:
+              clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
+            name: ${CLUSTER_IDENTITY_NAME}
+            namespace: default
+          spec:
+            allowedNamespaces: {}
+            clientID: ${AZURE_CLIENT_ID}
+            clientSecret:
+              name: ${AZURE_CLUSTER_IDENTITY_SECRET_NAME}
+              namespace: ${AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE}
+            tenantID: ${AZURE_TENANT_ID}
+            type: ServicePrincipal
foot commented 1 year ago

Template:

apiVersion: templates.weave.works/v1alpha2
kind: GitOpsTemplate
metadata:
  name: aks-template
  namespace: default
  annotations:
    templates.weave.works/inject-prune-annotation: "true"
spec:
  description: A simple CAPD template
  params:
    - name: CLUSTER_NAME
      default: "pesto-conformance2023"
    - name: AZURE_CLIENT_ID
      default: "626d016a-9788-442c-b062-3ed7e64340db"
    - name: AZURE_CLUSTER_IDENTITY_SECRET_NAME
      default: "cluster-identity-secret"
    - name: AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE
      default: "default"
    - name: AZURE_LOCATION
      default: "eastus"
    - name: AZURE_NODE_MACHINE_TYPE
      default: "Standard_D2s_v3"
    - name: AZURE_RESOURCE_GROUP
      default: "team-pesto-use1"
    - name: AZURE_SUBSCRIPTION_ID
      default: "ace37984-3d07-4051-9002-d5a52c0ae14b"
    - name: AZURE_TENANT_ID
      default: "3747a928-2079-440f-8f0f-ab1be2a7c058"
    - name: CLUSTER_IDENTITY_NAME
      default: "cluster-identity"
    - name: KUBERNETES_VERSION
      default: "1.25.5"
    - name: NAMESPACE
      default: "default"
    - name: WORKER_MACHINE_COUNT
      default: "3"
  resourcetemplates:
    - content:
        - apiVersion: gitops.weave.works/v1alpha1
          kind: GitopsCluster
          metadata:
            name: "${CLUSTER_NAME}"
            namespace: "${NAMESPACE}"
          spec:
            capiClusterRef:
              name: "${CLUSTER_NAME}"
        - apiVersion: cluster.x-k8s.io/v1beta1
          kind: Cluster
          metadata:
            name: ${CLUSTER_NAME}
            namespace: default
          spec:
            clusterNetwork:
              services:
                cidrBlocks:
                  - 192.168.0.0/16
            controlPlaneRef:
              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
              kind: AzureManagedControlPlane
              name: ${CLUSTER_NAME}
            infrastructureRef:
              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
              kind: AzureManagedCluster
              name: ${CLUSTER_NAME}
        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: AzureManagedControlPlane
          metadata:
            name: ${CLUSTER_NAME}
            namespace: default
          spec:
            identityRef:
              apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
              kind: AzureClusterIdentity
              name: ${CLUSTER_IDENTITY_NAME}
            location: ${AZURE_LOCATION}
            resourceGroupName: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}}
            # sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
            subscriptionID: ${AZURE_SUBSCRIPTION_ID}
            version: ${KUBERNETES_VERSION}
        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: AzureManagedCluster
          metadata:
            name: ${CLUSTER_NAME}
            namespace: default
        - apiVersion: cluster.x-k8s.io/v1beta1
          kind: MachinePool
          metadata:
            name: ${CLUSTER_NAME}-pool0
            namespace: default
          spec:
            clusterName: ${CLUSTER_NAME}
            replicas: ${WORKER_MACHINE_COUNT}
            template:
              metadata: {}
              spec:
                bootstrap:
                  dataSecretName: ""
                clusterName: ${CLUSTER_NAME}
                infrastructureRef:
                  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
                  kind: AzureManagedMachinePool
                  name: ${CLUSTER_NAME}-pool0
                version: ${KUBERNETES_VERSION}
        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: AzureManagedMachinePool
          metadata:
            name: ${CLUSTER_NAME}-pool0
            namespace: default
          spec:
            mode: System
            name: pool0
            sku: ${AZURE_NODE_MACHINE_TYPE}
        - apiVersion: cluster.x-k8s.io/v1beta1
          kind: MachinePool
          metadata:
            name: ${CLUSTER_NAME}-pool1
            namespace: default
          spec:
            clusterName: ${CLUSTER_NAME}
            replicas: ${WORKER_MACHINE_COUNT}
            template:
              metadata: {}
              spec:
                bootstrap:
                  dataSecretName: ""
                clusterName: ${CLUSTER_NAME}
                infrastructureRef:
                  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
                  kind: AzureManagedMachinePool
                  name: ${CLUSTER_NAME}-pool1
                version: ${KUBERNETES_VERSION}
        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: AzureManagedMachinePool
          metadata:
            name: ${CLUSTER_NAME}-pool1
            namespace: default
          spec:
            mode: User
            name: pool1
            sku: ${AZURE_NODE_MACHINE_TYPE}
        - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: AzureClusterIdentity
          metadata:
            labels:
              clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
            name: ${CLUSTER_IDENTITY_NAME}
            namespace: default
          spec:
            allowedNamespaces: {}
            clientID: ${AZURE_CLIENT_ID}
            clientSecret:
              name: ${AZURE_CLUSTER_IDENTITY_SECRET_NAME}
              namespace: ${AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE}
            tenantID: ${AZURE_TENANT_ID}
            type: ServicePrincipal