diff --git a/kubernetes/capi-kustomize/README.md b/kubernetes/capi-kustomize/README.md new file mode 100644 index 0000000..bfc6a28 --- /dev/null +++ b/kubernetes/capi-kustomize/README.md @@ -0,0 +1,3 @@ +# Using Kustomize with Cluster API + +These files were created as examples to accompany [this blog post](https://blog.scottlowe.org/2019/11/04/using-kustomize-with-cluster-api-manifests/) on using `kustomize` with Cluster API (CAPI) manifests. diff --git a/kubernetes/capi-kustomize/base/cluster.yaml b/kubernetes/capi-kustomize/base/cluster.yaml new file mode 100644 index 0000000..4198dce --- /dev/null +++ b/kubernetes/capi-kustomize/base/cluster.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Cluster +metadata: + name: capi-quickstart +spec: + clusterNetwork: + pods: + cidrBlocks: ["192.168.0.0/16"] + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSCluster + name: capi-quickstart +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSCluster +metadata: + name: capi-quickstart +spec: + region: us-west-2 + sshKeyName: default diff --git a/kubernetes/capi-kustomize/base/controlplane.yaml b/kubernetes/capi-kustomize/base/controlplane.yaml new file mode 100644 index 0000000..7fcfd79 --- /dev/null +++ b/kubernetes/capi-kustomize/base/controlplane.yaml @@ -0,0 +1,138 @@ +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + name: capi-quickstart-controlplane-0 + labels: + cluster.x-k8s.io/control-plane: "true" + cluster.x-k8s.io/cluster-name: "capi-quickstart" +spec: + version: v1.15.3 + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-0 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-0 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: capi-quickstart-controlplane-0 +spec: + instanceType: m5.large + iamInstanceProfile: "controllers.cluster-api-provider-aws.sigs.k8s.io" + sshKeyName: default +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 +kind: KubeadmConfig +metadata: + name: capi-quickstart-controlplane-0 +spec: + initConfiguration: + nodeRegistration: + name: '{{ ds.meta_data.hostname }}' + kubeletExtraArgs: + cloud-provider: aws + clusterConfiguration: + apiServer: + extraArgs: + cloud-provider: aws + controllerManager: + extraArgs: + cloud-provider: aws +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + name: capi-quickstart-controlplane-1 + labels: + cluster.x-k8s.io/control-plane: "true" + cluster.x-k8s.io/cluster-name: "capi-quickstart" +spec: + version: v1.15.3 + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-1 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-1 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: capi-quickstart-controlplane-1 +spec: + instanceType: m5.large + iamInstanceProfile: "controllers.cluster-api-provider-aws.sigs.k8s.io" + sshKeyName: default +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 +kind: KubeadmConfig +metadata: + name: capi-quickstart-controlplane-1 +spec: + initConfiguration: + nodeRegistration: + name: '{{ ds.meta_data.hostname }}' + kubeletExtraArgs: + cloud-provider: aws + clusterConfiguration: + apiServer: + extraArgs: + cloud-provider: aws + controllerManager: + extraArgs: + cloud-provider: aws +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + name: capi-quickstart-controlplane-2 + labels: + cluster.x-k8s.io/control-plane: "true" + cluster.x-k8s.io/cluster-name: "capi-quickstart" +spec: + version: v1.15.3 + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-2 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-2 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: capi-quickstart-controlplane-2 +spec: + instanceType: m5.large + iamInstanceProfile: "controllers.cluster-api-provider-aws.sigs.k8s.io" + sshKeyName: default +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 +kind: KubeadmConfig +metadata: + name: capi-quickstart-controlplane-2 +spec: + initConfiguration: + nodeRegistration: + name: '{{ ds.meta_data.hostname }}' + kubeletExtraArgs: + cloud-provider: aws + clusterConfiguration: + apiServer: + extraArgs: + cloud-provider: aws + controllerManager: + extraArgs: + cloud-provider: aws diff --git a/kubernetes/capi-kustomize/base/kustomization.yaml b/kubernetes/capi-kustomize/base/kustomization.yaml new file mode 100644 index 0000000..8c5ad0d --- /dev/null +++ b/kubernetes/capi-kustomize/base/kustomization.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - cluster.yaml + - controlplane.yaml + - workers.yaml diff --git a/kubernetes/capi-kustomize/base/workers.yaml b/kubernetes/capi-kustomize/base/workers.yaml new file mode 100644 index 0000000..782b787 --- /dev/null +++ b/kubernetes/capi-kustomize/base/workers.yaml @@ -0,0 +1,53 @@ +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: MachineDeployment +metadata: + name: capi-quickstart-worker + labels: + cluster.x-k8s.io/cluster-name: capi-quickstart + nodepool: nodepool-0 +spec: + replicas: 3 + selector: + matchLabels: + cluster.x-k8s.io/cluster-name: capi-quickstart + nodepool: nodepool-0 + template: + metadata: + labels: + cluster.x-k8s.io/cluster-name: capi-quickstart + nodepool: nodepool-0 + spec: + version: v1.15.3 + bootstrap: + configRef: + name: capi-quickstart-worker + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 + kind: KubeadmConfigTemplate + infrastructureRef: + name: capi-quickstart-worker + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSMachineTemplate +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachineTemplate +metadata: + name: capi-quickstart-worker +spec: + template: + spec: + instanceType: m5.large + iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io" + sshKeyName: default +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 +kind: KubeadmConfigTemplate +metadata: + name: capi-quickstart-worker +spec: + template: + spec: + joinConfiguration: + nodeRegistration: + name: '{{ ds.meta_data.hostname }}' + kubeletExtraArgs: + cloud-provider: aws diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awscluster-patch.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/awscluster-patch.json new file mode 100644 index 0000000..7be8cf2 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awscluster-patch.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster-1" }, + { "op": "replace", "path": "/spec/region", "value": "us-east-2" }, + { "op": "replace", "path": "/spec/sshKeyName", "value": "use2_rsa_key" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp0-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp0-patch-name.json new file mode 100644 index 0000000..1492d3f --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp0-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster1-cp0" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp1-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp1-patch-name.json new file mode 100644 index 0000000..ff53679 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp1-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster1-cp1" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp2-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp2-patch-name.json new file mode 100644 index 0000000..dc914a3 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-cp2-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster1-cp2" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-details.yaml b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-details.yaml new file mode 100644 index 0000000..68f5048 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachine-details.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: .* +spec: + sshKeyName: use2_rsa_key + # Uncomment following line to change instance type + #instanceType: m5.xlarge diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachinetemplate-details.yaml b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachinetemplate-details.yaml new file mode 100644 index 0000000..80f3c83 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachinetemplate-details.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachineTemplate +metadata: + name: .* +spec: + template: + spec: + sshKeyName: use2_rsa_key + # Uncomment following line to change instance type + #instanceType: m5.xlarge diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachinetemplate-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachinetemplate-patch-name.json new file mode 100644 index 0000000..55d174b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/awsmachinetemplate-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-c1-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/cluster-patch.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/cluster-patch.json new file mode 100644 index 0000000..5eb8885 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/cluster-patch.json @@ -0,0 +1,4 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster-1" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "use2-cluster-1" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/kubeadmconfigtemplate-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/kubeadmconfigtemplate-patch-name.json new file mode 100644 index 0000000..55d174b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/kubeadmconfigtemplate-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-c1-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/kustomization.yaml b/kubernetes/capi-kustomize/overlays/use2-cluster1/kustomization.yaml new file mode 100644 index 0000000..ef2ca4a --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/kustomization.yaml @@ -0,0 +1,115 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patchesJson6902: + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Cluster + name: capi-quickstart + path: cluster-patch.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSCluster + name: capi-quickstart + path: awscluster-patch.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-0 + path: machine-cp0-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-0 + path: awsmachine-cp0-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-0 + path: awsmachine-cp0-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-1 + path: machine-cp1-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-1 + path: awsmachine-cp1-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-1 + path: awsmachine-cp1-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-2 + path: machine-cp2-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-2 + path: awsmachine-cp2-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-2 + path: awsmachine-cp2-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + path: awsmachinetemplate-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: MachineDeployment + name: capi-quickstart-worker + path: machinedeployment-patch.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfigTemplate + name: capi-quickstart-worker + path: kubeadmconfigtemplate-patch-name.json +patches: + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + path: awsmachinetemplate-details.yaml + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: .* + path: machine-labels.yaml + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: MachineDeployment + name: .* + path: machinedeployment-labels.yaml + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: .* + path: awsmachine-details.yaml diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp0-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp0-patch-name.json new file mode 100644 index 0000000..a0bb57d --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp0-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster1-cp0" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "use2-cluster1-cp0" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "use2-cluster1-cp0" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp1-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp1-patch-name.json new file mode 100644 index 0000000..d46f27b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp1-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster1-cp1" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "use2-cluster1-cp1" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "use2-cluster1-cp1" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp2-patch-name.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp2-patch-name.json new file mode 100644 index 0000000..2b749e2 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-cp2-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-cluster1-cp2" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "use2-cluster1-cp2" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "use2-cluster1-cp2" } +] diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-labels.yaml b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-labels.yaml new file mode 100644 index 0000000..2c4250b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/machine-labels.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + name: .* + labels: + cluster.x-k8s.io/cluster-name: "use2-cluster1" diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/machinedeployment-labels.yaml b/kubernetes/capi-kustomize/overlays/use2-cluster1/machinedeployment-labels.yaml new file mode 100644 index 0000000..0faee99 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/machinedeployment-labels.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: MachineDeployment +kind: MachineDeployment +metadata: + name: .* + labels: + cluster.x-k8s.io/cluster-name: "use2-cluster1" + nodepool: "use2-c1-nodepool0" +spec: + selector: + matchLabels: + cluster.x-k8s.io/cluster-name: "use2-cluster1" + nodepool: "use2-c1-nodepool0" + template: + metadata: + labels: + cluster.x-k8s.io/cluster-name: "use2-cluster1" + nodepool: "use2-c1-nodepool0" diff --git a/kubernetes/capi-kustomize/overlays/use2-cluster1/machinedeployment-patch.json b/kubernetes/capi-kustomize/overlays/use2-cluster1/machinedeployment-patch.json new file mode 100644 index 0000000..a476008 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/use2-cluster1/machinedeployment-patch.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "use2-c1-nodepool0" }, + { "op": "replace", "path": "/spec/template/spec/bootstrap/configRef/name", "value": "use2-c1-nodepool0" }, + { "op": "replace", "path": "/spec/template/spec/infrastructureRef/name", "value": "use2-c1-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-patch.json new file mode 100644 index 0000000..092ae41 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-patch.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster-1" }, + { "op": "replace", "path": "/spec/region", "value": "us-west-2" }, + { "op": "replace", "path": "/spec/sshKeyName", "value": "usw2_rsa_key" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp0-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp0-patch-name.json new file mode 100644 index 0000000..9f294f8 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp0-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster1-cp0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp1-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp1-patch-name.json new file mode 100644 index 0000000..fd68b45 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp1-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster1-cp1" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp2-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp2-patch-name.json new file mode 100644 index 0000000..e502831 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-cp2-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster1-cp2" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-details.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-details.yaml new file mode 100644 index 0000000..b047848 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-details.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: .* +spec: + sshKeyName: usw2_rsa_key + # Uncomment following line to change instance type + #instanceType: m5.xlarge diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachinetemplate-details.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachinetemplate-details.yaml new file mode 100644 index 0000000..9a4664a --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachinetemplate-details.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachineTemplate +metadata: + name: .* +spec: + template: + spec: + sshKeyName: usw2_rsa_key + # Uncomment following line to change instance type + #instanceType: m5.xlarge diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachinetemplate-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachinetemplate-patch-name.json new file mode 100644 index 0000000..e65a5c5 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachinetemplate-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-c1-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/cluster-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/cluster-patch.json new file mode 100644 index 0000000..19c2579 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/cluster-patch.json @@ -0,0 +1,4 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster-1" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster-1" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/kubeadmconfigtemplate-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/kubeadmconfigtemplate-patch-name.json new file mode 100644 index 0000000..e65a5c5 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/kubeadmconfigtemplate-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-c1-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml new file mode 100644 index 0000000..ef2ca4a --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml @@ -0,0 +1,115 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patchesJson6902: + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Cluster + name: capi-quickstart + path: cluster-patch.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSCluster + name: capi-quickstart + path: awscluster-patch.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-0 + path: machine-cp0-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-0 + path: awsmachine-cp0-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-0 + path: awsmachine-cp0-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-1 + path: machine-cp1-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-1 + path: awsmachine-cp1-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-1 + path: awsmachine-cp1-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-2 + path: machine-cp2-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-2 + path: awsmachine-cp2-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-2 + path: awsmachine-cp2-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + path: awsmachinetemplate-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: MachineDeployment + name: capi-quickstart-worker + path: machinedeployment-patch.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfigTemplate + name: capi-quickstart-worker + path: kubeadmconfigtemplate-patch-name.json +patches: + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + path: awsmachinetemplate-details.yaml + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: .* + path: machine-labels.yaml + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: MachineDeployment + name: .* + path: machinedeployment-labels.yaml + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: .* + path: awsmachine-details.yaml diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp0-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp0-patch-name.json new file mode 100644 index 0000000..74b3011 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp0-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster1-cp0" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "usw2-cluster1-cp0" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster1-cp0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp1-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp1-patch-name.json new file mode 100644 index 0000000..df4d15b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp1-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster1-cp1" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "usw2-cluster1-cp1" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster1-cp1" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp2-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp2-patch-name.json new file mode 100644 index 0000000..087a203 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-cp2-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster1-cp2" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "usw2-cluster1-cp2" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster1-cp2" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-labels.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-labels.yaml new file mode 100644 index 0000000..31df16a --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-labels.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + name: .* + labels: + cluster.x-k8s.io/cluster-name: "usw2-cluster1" diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/machinedeployment-labels.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machinedeployment-labels.yaml new file mode 100644 index 0000000..f248bfd --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machinedeployment-labels.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: MachineDeployment +kind: MachineDeployment +metadata: + name: .* + labels: + cluster.x-k8s.io/cluster-name: "usw2-cluster1" + nodepool: "usw2-c1-nodepool0" +spec: + selector: + matchLabels: + cluster.x-k8s.io/cluster-name: "usw2-cluster1" + nodepool: "usw2-c1-nodepool0" + template: + metadata: + labels: + cluster.x-k8s.io/cluster-name: "usw2-cluster1" + nodepool: "usw2-c1-nodepool0" diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/machinedeployment-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machinedeployment-patch.json new file mode 100644 index 0000000..725b861 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machinedeployment-patch.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-c1-nodepool0" }, + { "op": "replace", "path": "/spec/template/spec/bootstrap/configRef/name", "value": "usw2-c1-nodepool0" }, + { "op": "replace", "path": "/spec/template/spec/infrastructureRef/name", "value": "usw2-c1-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awscluster-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awscluster-patch.json new file mode 100644 index 0000000..199c553 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awscluster-patch.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster-2" }, + { "op": "replace", "path": "/spec/region", "value": "us-west-2" }, + { "op": "replace", "path": "/spec/sshKeyName", "value": "usw2_rsa_key" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp0-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp0-patch-name.json new file mode 100644 index 0000000..f58a733 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp0-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster2-cp0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp1-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp1-patch-name.json new file mode 100644 index 0000000..a4c88f1 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp1-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster2-cp1" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp2-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp2-patch-name.json new file mode 100644 index 0000000..be3c82b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-cp2-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster2-cp2" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-details.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-details.yaml new file mode 100644 index 0000000..b047848 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachine-details.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: .* +spec: + sshKeyName: usw2_rsa_key + # Uncomment following line to change instance type + #instanceType: m5.xlarge diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachinetemplate-details.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachinetemplate-details.yaml new file mode 100644 index 0000000..574f7d6 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachinetemplate-details.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachineTemplate +metadata: + name: .* +spec: + template: + spec: + sshKeyName: usw2_rsa_key + # Uncomment following line to change instance type + instanceType: m5.xlarge diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachinetemplate-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachinetemplate-patch-name.json new file mode 100644 index 0000000..1304d82 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/awsmachinetemplate-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-c2-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/cluster-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/cluster-patch.json new file mode 100644 index 0000000..8d82c20 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/cluster-patch.json @@ -0,0 +1,4 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster-2" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster-2" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/kubeadmconfigtemplate-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/kubeadmconfigtemplate-patch-name.json new file mode 100644 index 0000000..1304d82 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/kubeadmconfigtemplate-patch-name.json @@ -0,0 +1,3 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-c2-nodepool0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/kustomization.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster2/kustomization.yaml new file mode 100644 index 0000000..ef2ca4a --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/kustomization.yaml @@ -0,0 +1,115 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patchesJson6902: + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Cluster + name: capi-quickstart + path: cluster-patch.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSCluster + name: capi-quickstart + path: awscluster-patch.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-0 + path: machine-cp0-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-0 + path: awsmachine-cp0-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-0 + path: awsmachine-cp0-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-1 + path: machine-cp1-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-1 + path: awsmachine-cp1-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-1 + path: awsmachine-cp1-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-2 + path: machine-cp2-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-2 + path: awsmachine-cp2-patch-name.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfig + name: capi-quickstart-controlplane-2 + path: awsmachine-cp2-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + path: awsmachinetemplate-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: MachineDeployment + name: capi-quickstart-worker + path: machinedeployment-patch.json + - target: + group: bootstrap.cluster.x-k8s.io + version: v1alpha2 + kind: KubeadmConfigTemplate + name: capi-quickstart-worker + path: kubeadmconfigtemplate-patch-name.json +patches: + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + path: awsmachinetemplate-details.yaml + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: .* + path: machine-labels.yaml + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: MachineDeployment + name: .* + path: machinedeployment-labels.yaml + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: .* + path: awsmachine-details.yaml diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp0-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp0-patch-name.json new file mode 100644 index 0000000..d33c92b --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp0-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster2-cp0" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "usw2-cluster2-cp0" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster2-cp0" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp1-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp1-patch-name.json new file mode 100644 index 0000000..ae03922 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp1-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster2-cp1" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "usw2-cluster2-cp1" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster2-cp1" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp2-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp2-patch-name.json new file mode 100644 index 0000000..a3909e7 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-cp2-patch-name.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-cluster2-cp2" }, + { "op": "replace", "path": "/spec/bootstrap/configRef/name", "value": "usw2-cluster2-cp2" }, + { "op": "replace", "path": "/spec/infrastructureRef/name", "value": "usw2-cluster2-cp2" } +] diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-labels.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-labels.yaml new file mode 100644 index 0000000..9faff97 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machine-labels.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + name: .* + labels: + cluster.x-k8s.io/cluster-name: "usw2-cluster2" diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/machinedeployment-labels.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machinedeployment-labels.yaml new file mode 100644 index 0000000..fba484c --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machinedeployment-labels.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: MachineDeployment +kind: MachineDeployment +metadata: + name: .* + labels: + cluster.x-k8s.io/cluster-name: "usw2-cluster2" + nodepool: "usw2-c2-nodepool0" +spec: + selector: + matchLabels: + cluster.x-k8s.io/cluster-name: "usw2-cluster2" + nodepool: "usw2-c2-nodepool0" + template: + metadata: + labels: + cluster.x-k8s.io/cluster-name: "usw2-cluster2" + nodepool: "usw2-c2-nodepool0" diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster2/machinedeployment-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machinedeployment-patch.json new file mode 100644 index 0000000..47391c4 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster2/machinedeployment-patch.json @@ -0,0 +1,5 @@ +[ + { "op": "replace", "path": "/metadata/name", "value": "usw2-c2-nodepool0" }, + { "op": "replace", "path": "/spec/template/spec/bootstrap/configRef/name", "value": "usw2-c2-nodepool0" }, + { "op": "replace", "path": "/spec/template/spec/infrastructureRef/name", "value": "usw2-c2-nodepool0" } +]