diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-name-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-patch-name.json similarity index 100% rename from kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-name-patch.json rename to kubernetes/capi-kustomize/overlays/usw2-cluster1/awscluster-patch-name.json 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/awsmachine-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-patch-name.json new file mode 100644 index 0000000..9f294f8 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/awsmachine-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/cluster-name-patch.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/cluster-patch-name.json similarity index 100% rename from kubernetes/capi-kustomize/overlays/usw2-cluster1/cluster-name-patch.json rename to kubernetes/capi-kustomize/overlays/usw2-cluster1/cluster-patch-name.json diff --git a/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml index 2ebae4e..c8e962e 100644 --- a/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/kustomization.yaml @@ -9,13 +9,25 @@ patchesJson6902: version: v1alpha2 kind: Cluster name: capi-quickstart - path: cluster-name-patch.json + path: cluster-patch-name.json - target: group: infrastructure.cluster.x-k8s.io version: v1alpha2 kind: AWSCluster name: capi-quickstart - path: awscluster-name-patch.json + path: awscluster-patch-name.json + - target: + group: cluster.x-k8s.io + version: v1alpha2 + kind: Machine + name: capi-quickstart-controlplane-0 + path: machine-patch-name.json + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: AWSMachine + name: capi-quickstart-controlplane-0 + path: awsmachine-patch-name.json patches: - target: group: infrastructure.cluster.x-k8s.io @@ -35,3 +47,9 @@ patches: 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-patch-name.json b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-patch-name.json new file mode 100644 index 0000000..74b3011 --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/machine-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/output.yaml b/kubernetes/capi-kustomize/overlays/usw2-cluster1/output.yaml new file mode 100644 index 0000000..75b45ea --- /dev/null +++ b/kubernetes/capi-kustomize/overlays/usw2-cluster1/output.yaml @@ -0,0 +1,121 @@ +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 +kind: KubeadmConfig +metadata: + name: capi-quickstart-controlplane-0 +spec: + clusterConfiguration: + apiServer: + extraArgs: + cloud-provider: aws + controllerManager: + extraArgs: + cloud-provider: aws + initConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: aws + name: '{{ ds.meta_data.hostname }}' +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 +kind: KubeadmConfigTemplate +metadata: + name: capi-quickstart-worker +spec: + template: + spec: + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: aws + name: '{{ ds.meta_data.hostname }}' +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Cluster +metadata: + name: usw2-cluster-1 +spec: + clusterNetwork: + pods: + cidrBlocks: + - 192.168.0.0/16 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSCluster + name: usw2-cluster-1 +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: Machine +metadata: + labels: + cluster.x-k8s.io/cluster-name: usw2-cluster1 + cluster.x-k8s.io/control-plane: "true" + name: usw2-cluster1-cp0 +spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 + kind: KubeadmConfig + name: usw2-cluster1-cp0 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSMachine + name: usw2-cluster1-cp0 + version: v1.15.3 +--- +apiVersion: cluster.x-k8s.io/v1alpha2 +kind: MachineDeployment +metadata: + labels: + cluster.x-k8s.io/cluster-name: usw2-cluster1 + nodepool: nodepool-0 + name: capi-quickstart-worker +spec: + replicas: 1 + selector: + matchLabels: + cluster.x-k8s.io/cluster-name: usw2-cluster1 + nodepool: nodepool-0 + template: + metadata: + labels: + cluster.x-k8s.io/cluster-name: usw2-cluster1 + nodepool: nodepool-0 + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha2 + kind: KubeadmConfigTemplate + name: capi-quickstart-worker + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: AWSMachineTemplate + name: capi-quickstart-worker + version: v1.15.3 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSCluster +metadata: + name: usw2-cluster-1 +spec: + region: us-west-2 + sshKeyName: usw2_rsa_key +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachine +metadata: + name: usw2-cluster1-cp0 +spec: + iamInstanceProfile: controllers.cluster-api-provider-aws.sigs.k8s.io + instanceType: t3.large + sshKeyName: usw2_rsa_key +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: AWSMachineTemplate +metadata: + name: capi-quickstart-worker +spec: + template: + spec: + iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io + instanceType: t3.large + sshKeyName: default