Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui e2e: Create CAPA cluster from Clusterclass #114

Open
cpinjani opened this issue Feb 18, 2025 · 0 comments
Open

ui e2e: Create CAPA cluster from Clusterclass #114

cpinjani opened this issue Feb 18, 2025 · 0 comments
Labels
area/testing kind/enhancement New feature or request

Comments

@cpinjani
Copy link
Collaborator

Add coverage for cluster creation using clusterclass using create cluster wizard for CAPA Kubeadm
(CAPI UI Extension: v0.8.2)

Template:

apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
  name: quick-start
spec:
  controlPlane:
    ref:
      apiVersion: controlplane.cluster.x-k8s.io/v1beta1
      kind: KubeadmControlPlaneTemplate
      name: quick-start-control-plane
    machineInfrastructure:
      ref:
        kind: AWSMachineTemplate
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
        name: quick-start-control-plane
  infrastructure:
    ref:
      apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
      kind: AWSClusterTemplate
      name: quick-start
  workers:
    machineDeployments:
      - class: default-worker
        template:
          bootstrap:
            ref:
              apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
              kind: KubeadmConfigTemplate
              name: quick-start-worker-bootstraptemplate
          infrastructure:
            ref:
              apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
              kind: AWSMachineTemplate
              name: quick-start-worker-machinetemplate
  variables:
    - name: region
      required: true
      schema:
        openAPIV3Schema:
          type: string
          default: us-east-1
    - name: sshKeyName
      required: true
      schema:
        openAPIV3Schema:
          type: string
          default: default
    - name: controlPlaneMachineType
      required: true
      schema:
        openAPIV3Schema:
          type: string
          default: t3.large
    - name: workerMachineType
      required: true
      schema:
        openAPIV3Schema:
          type: string
          default: t3.large
  patches:
    - name: region
      definitions:
        - selector:
            apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
            kind: AWSClusterTemplate
            matchResources:
              infrastructureCluster: true
          jsonPatches:
            - op: add
              path: /spec/template/spec/region
              valueFrom:
                variable: region
    - name: sshKeyName
      definitions:
        - selector:
            apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
            kind: AWSClusterTemplate
            matchResources:
              infrastructureCluster: true
          jsonPatches:
            - op: add
              path: /spec/template/spec/sshKeyName
              valueFrom:
                variable: sshKeyName
        - selector:
            apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
            kind: AWSMachineTemplate
            matchResources:
              controlPlane: true
              machineDeploymentClass:
                names:
                  - default-worker
          jsonPatches:
            - op: add
              path: /spec/template/spec/sshKeyName
              valueFrom:
                variable: sshKeyName
    - name: controlPlaneMachineType
      definitions:
        - selector:
            apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
            kind: AWSMachineTemplate
            matchResources:
              controlPlane: true
          jsonPatches:
            - op: replace
              path: /spec/template/spec/instanceType
              valueFrom:
                variable: controlPlaneMachineType
    - name: workerMachineType
      definitions:
        - selector:
            apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
            kind: AWSMachineTemplate
            matchResources:
              machineDeploymentClass:
                names:
                  - default-worker
          jsonPatches:
            - op: replace
              path: /spec/template/spec/instanceType
              valueFrom:
                variable: workerMachineType
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSClusterTemplate
metadata:
  name: quick-start
spec:
  template:
    spec: { }
---
kind: KubeadmControlPlaneTemplate
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
  name: quick-start-control-plane
spec:
  template:
    spec:
      kubeadmConfigSpec:
        clusterConfiguration:
          apiServer:
            extraArgs:
              cloud-provider: aws
          controllerManager:
            extraArgs:
              cloud-provider: aws
        initConfiguration:
          nodeRegistration:
            name: '{{ ds.meta_data.local_hostname }}'
            kubeletExtraArgs:
              cloud-provider: aws
        joinConfiguration:
          nodeRegistration:
            name: '{{ ds.meta_data.local_hostname }}'
            kubeletExtraArgs:
              cloud-provider: aws
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
  name: quick-start-control-plane
spec:
  template:
    spec:
      # instanceType is a required field (OpenAPI schema).
      instanceType: REPLACEME
      iamInstanceProfile: "control-plane.cluster-api-provider-aws.sigs.k8s.io"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
  name: quick-start-worker-machinetemplate
spec:
  template:
    spec:
      # instanceType is a required field (OpenAPI schema).
      instanceType: REPLACEME
      iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io"
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
  name: "quick-start-worker-bootstraptemplate"
spec:
  template:
    spec:
      joinConfiguration:
        nodeRegistration:
          name: '{{ ds.meta_data.local_hostname }}'
          kubeletExtraArgs:
            cloud-provider: aws
---
apiVersion: v1
data: ${CNI_RESOURCES}
kind: ConfigMap
metadata:
  name: cni-${CLUSTER_NAME}-crs-0
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
  name: ${CLUSTER_NAME}-crs-0
spec:
  clusterSelector:
    matchLabels:
      cni: ${CLUSTER_NAME}-crs-0
  resources:
  - kind: ConfigMap
    name: cni-${CLUSTER_NAME}-crs-0
  strategy: ApplyOnce
@cpinjani cpinjani added area/testing kind/enhancement New feature or request labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant