Skip to content

Commit

Permalink
Merge pull request #371 from alexander-demicev/awsfixes
Browse files Browse the repository at this point in the history
Make CAPA templates variables compatible with clusterctl
  • Loading branch information
alexander-demicev authored Jul 24, 2024
2 parents 927ff83 + f5c48c2 commit 6e6a86e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 45 deletions.
6 changes: 2 additions & 4 deletions samples/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ We will use the `internal` one for this guide, however the same steps apply for
You will need to set the following environment variables:

```bash
export CLUSTER_NAMESPACE="cluster-namespace"
export CLUSTER_NAME="cluster-name"
export CABPR_CP_REPLICAS=3
export CABPR_WK_REPLICAS=1
export CONTROL_PLANE_MACHINE_COUNT=3
export WORKER_MACHINE_COUNT=1
export RKE2_VERSION=v1.26.0+rke2r1
export AWS_NODE_MACHINE_TYPE=t3a.large
export AWS_CONTROL_PLANE_MACHINE_TYPE=t3a.large
Expand Down
30 changes: 15 additions & 15 deletions samples/aws/external/cluster-template-external-cloud-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
labels:
ccm: external
csi: external
Expand All @@ -25,7 +25,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
bastion:
enabled: true
Expand Down Expand Up @@ -67,7 +67,7 @@ apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
version: ${RKE2_VERSION}
preRKE2Commands:
Expand All @@ -79,7 +79,7 @@ spec:
kind: AWSMachineTemplate
name: ${CLUSTER_NAME}-control-plane
nodeDrainTimeout: 2m
replicas: 3
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
serverConfig:
cloudProviderName: external
cni: calico
Expand All @@ -97,7 +97,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -113,10 +113,10 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${CABPR_WK_REPLICAS}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
Expand All @@ -141,7 +141,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -157,7 +157,7 @@ apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -168,7 +168,7 @@ apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: crs-ccm
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterSelector:
matchLabels:
Expand All @@ -182,7 +182,7 @@ apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: crs-csi
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterSelector:
matchLabels:
Expand Down Expand Up @@ -372,7 +372,7 @@ metadata:
labels:
type: generated
name: cloud-controller-manager-addon
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: v1
data:
Expand Down Expand Up @@ -1018,14 +1018,14 @@ metadata:
labels:
type: generated
name: aws-ebs-csi-driver-addon
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSClusterControllerIdentity
metadata:
name: default
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
allowedNamespaces:
list:
- ${CLUSTER_NAMESPACE}
- ${NAMESPACE}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
labels:
ccm: external
csi: external
Expand All @@ -25,7 +25,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
bastion:
enabled: true
Expand Down Expand Up @@ -67,7 +67,7 @@ apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
version: ${RKE2_VERSION}
preRKE2Commands:
Expand All @@ -77,7 +77,7 @@ spec:
kind: AWSMachineTemplate
name: ${CLUSTER_NAME}-control-plane
nodeDrainTimeout: 2m
replicas: 3
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
serverConfig:
cloudProviderName: external
cni: calico
Expand All @@ -95,7 +95,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -110,10 +110,10 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${CABPR_WK_REPLICAS}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
Expand All @@ -138,7 +138,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -153,13 +153,13 @@ apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: crs-ccm
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterSelector:
matchLabels:
Expand All @@ -173,7 +173,7 @@ apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: crs-csi
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterSelector:
matchLabels:
Expand Down Expand Up @@ -363,7 +363,7 @@ metadata:
labels:
type: generated
name: cloud-controller-manager-addon
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: v1
data:
Expand Down Expand Up @@ -1009,14 +1009,14 @@ metadata:
labels:
type: generated
name: aws-ebs-csi-driver-addon
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSClusterControllerIdentity
metadata:
name: default
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
allowedNamespaces:
list:
- ${CLUSTER_NAMESPACE}
- ${NAMESPACE}
22 changes: 11 additions & 11 deletions samples/aws/internal/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterNetwork:
pods:
Expand All @@ -22,7 +22,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
bastion:
enabled: true
Expand Down Expand Up @@ -64,7 +64,7 @@ apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
version: ${RKE2_VERSION}
preRKE2Commands:
Expand All @@ -76,7 +76,7 @@ spec:
kind: AWSMachineTemplate
name: ${CLUSTER_NAME}-control-plane
nodeDrainTimeout: 2m
replicas: 3
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
serverConfig:
cloudProviderName: aws
cni: calico
Expand All @@ -94,7 +94,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: ${CLUSTER_NAME}-control-plane
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -110,10 +110,10 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${CABPR_WK_REPLICAS}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
Expand All @@ -138,7 +138,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -154,7 +154,7 @@ apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
template:
spec:
Expand All @@ -165,9 +165,9 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSClusterControllerIdentity
metadata:
name: default
namespace: ${CLUSTER_NAMESPACE}
namespace: ${NAMESPACE}
spec:
allowedNamespaces:
list:
- ${CLUSTER_NAMESPACE}
- ${NAMESPACE}

0 comments on commit 6e6a86e

Please sign in to comment.