-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add k0s+aws template with bootstrapped control planes
HMC-16
- Loading branch information
Showing
11 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
charts/hmc-templates/aws/hmc-template-bootstrapped-control-planes/.helmignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
14 changes: 14 additions & 0 deletions
14
charts/hmc-templates/aws/hmc-template-bootstrapped-control-planes/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v2 | ||
name: hmc-template-bootstrapped-control-planes | ||
description: | | ||
The HMC template to deploy kubernetes cluster with bootstrapped control plane nodes. | ||
type: application | ||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.1.0" |
27 changes: 27 additions & 0 deletions
27
charts/hmc-templates/aws/hmc-template-bootstrapped-control-planes/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- define "cluster.name" -}} | ||
{{- .Values.clusterName | trunc 63 }} | ||
{{- end }} | ||
|
||
{{- define "awsmachinetemplate.controlplane.name" -}} | ||
{{- include "cluster.name" . }}-cp-mt | ||
{{- end }} | ||
|
||
{{- define "awsmachinetemplate.worker.name" -}} | ||
{{- include "cluster.name" . }}-worker-mt | ||
{{- end }} | ||
|
||
{{- define "k0scontrolplane.name" -}} | ||
{{- include "cluster.name" . }}-cp | ||
{{- end }} | ||
|
||
{{- define "k0sworkerconfigtemplate.name" -}} | ||
{{- include "cluster.name" . }}-machine-config | ||
{{- end }} | ||
|
||
{{- define "machinedeployment.name" -}} | ||
{{- include "cluster.name" . }}-md | ||
{{- end }} | ||
|
||
{{- define "k0sconfig.name" -}} | ||
{{- include "cluster.name" . }}-k0sconfig | ||
{{- end }} |
9 changes: 9 additions & 0 deletions
9
charts/hmc-templates/aws/hmc-template-bootstrapped-control-planes/templates/awscluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
metadata: | ||
name: {{ include "cluster.name" . }} | ||
spec: | ||
region: {{ .Values.region }} | ||
# identityRef: | ||
# kind: AWSClusterStaticIdentity | ||
# name: aws-identity-name |
19 changes: 19 additions & 0 deletions
19
...s/hmc-template-bootstrapped-control-planes/templates/awsmachinetemplate-controlplane.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: {{ include "awsmachinetemplate.controlplane.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
ami: | ||
id: {{ .Values.controlPlane.amiID }} | ||
instanceType: {{ .Values.controlPlane.instanceType }} | ||
# Instance Profile created by `clusterawsadm bootstrap iam create-cloudformation-stack` | ||
iamInstanceProfile: {{ .Values.controlPlane.iamInstanceProfile }} | ||
cloudInit: | ||
# Makes CAPA use k0s bootstrap cloud-init directly and not via SSM | ||
# Simplifies the VPC setup as we do not need custom SSM endpoints etc. | ||
insecureSkipSecretsManager: true | ||
{{- if .Values.sshKeyName }} | ||
sshKeyName: {{ .Values.sshKeyName }} | ||
{{- end }} |
19 changes: 19 additions & 0 deletions
19
...tes/aws/hmc-template-bootstrapped-control-planes/templates/awsmachinetemplate-worker.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: {{ include "awsmachinetemplate.worker.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
ami: | ||
id: {{ .Values.worker.amiID }} | ||
instanceType: {{ .Values.worker.instanceType }} | ||
# Instance Profile created by `clusterawsadm bootstrap iam create-cloudformation-stack` | ||
iamInstanceProfile: {{ .Values.worker.iamInstanceProfile }} | ||
cloudInit: | ||
# Makes CAPA use k0s bootstrap cloud-init directly and not via SSM | ||
# Simplifies the VPC setup as we do not need custom SSM endpoints etc. | ||
insecureSkipSecretsManager: true | ||
{{- if .Values.sshKeyName }} | ||
sshKeyName: {{ .Values.sshKeyName }} | ||
{{- end }} |
17 changes: 17 additions & 0 deletions
17
charts/hmc-templates/aws/hmc-template-bootstrapped-control-planes/templates/cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: {{ include "cluster.name" . }} | ||
spec: | ||
{{- with .Values.clusterNetwork }} | ||
clusterNetwork: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
controlPlaneRef: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: K0sControlPlane | ||
name: {{ include "k0scontrolplane.name" . }} | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
name: {{ include "cluster.name" . }} |
42 changes: 42 additions & 0 deletions
42
...hmc-templates/aws/hmc-template-bootstrapped-control-planes/templates/k0scontrolplane.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: K0sControlPlane | ||
metadata: | ||
name: {{ include "k0scontrolplane.name" . }} | ||
spec: | ||
replicas: {{ .Values.controlPlaneNumber }} | ||
# dirty hack | ||
version: {{ .Values.k0s.version | replace "+" "-" }} | ||
k0sConfigSpec: | ||
k0s: | ||
apiVersion: k0s.k0sproject.io/v1beta1 | ||
kind: ClusterConfig | ||
metadata: | ||
name: {{ include "k0sconfig.name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
api: | ||
extraArgs: | ||
anonymous-auth: "true" | ||
extensions: | ||
helm: | ||
repositories: | ||
- name: aws-cloud-controller-manager | ||
url: https://kubernetes.github.io/cloud-provider-aws | ||
charts: | ||
- name: aws-cloud-controller-manager | ||
namespace: kube-system | ||
chartname: aws-cloud-controller-manager/aws-cloud-controller-manager | ||
version: "0.0.8" | ||
values: | | ||
args: | ||
- --v=2 | ||
- --cloud-provider=aws | ||
- --cluster-cidr={{ first .Values.clusterNetwork.pods.cidrBlocks }} | ||
- --allocate-node-cidrs=true | ||
- --cluster-name={{ include "cluster.name" . }} | ||
machineTemplate: | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
name: {{ include "awsmachinetemplate.controlplane.name" . }} | ||
namespace: {{ .Release.Namespace }} |
11 changes: 11 additions & 0 deletions
11
...lates/aws/hmc-template-bootstrapped-control-planes/templates/k0sworkerconfigtemplate.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: K0sWorkerConfigTemplate | ||
metadata: | ||
name: {{ include "k0sworkerconfigtemplate.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
version: {{ .Values.k0s.version }} | ||
args: | ||
- --enable-cloud-provider | ||
- --kubelet-extra-args="--cloud-provider=external --hostname-override=$(hostname --fqdn)" |
25 changes: 25 additions & 0 deletions
25
...c-templates/aws/hmc-template-bootstrapped-control-planes/templates/machinedeployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: MachineDeployment | ||
metadata: | ||
name: {{ include "machinedeployment.name" . }} | ||
spec: | ||
clusterName: {{ include "cluster.name" . }} | ||
replicas: {{ .Values.workersNumber }} | ||
selector: | ||
matchLabels: | ||
cluster.x-k8s.io/cluster-name: {{ include "cluster.name" . }} | ||
template: | ||
metadata: | ||
labels: | ||
cluster.x-k8s.io/cluster-name: {{ include "cluster.name" . }} | ||
spec: | ||
clusterName: {{ include "cluster.name" . }} | ||
bootstrap: | ||
configRef: | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: K0sWorkerConfigTemplate | ||
name: {{ include "k0sworkerconfigtemplate.name" . }} | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
name: {{ include "awsmachinetemplate.worker.name" . }} |
31 changes: 31 additions & 0 deletions
31
charts/hmc-templates/aws/hmc-template-bootstrapped-control-planes/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Cluster parameters | ||
clusterName: k0s-aws | ||
controlPlaneNumber: 3 | ||
workersNumber: 2 | ||
|
||
clusterNetwork: | ||
pods: | ||
cidrBlocks: | ||
- "10.244.0.0/16" | ||
services: | ||
cidrBlocks: | ||
- "10.96.0.0/12" | ||
|
||
# AWS cluster parameters | ||
region: "" | ||
sshKeyName: "" | ||
|
||
# AWS machines parameters | ||
controlPlane: | ||
amiID: "" | ||
iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: "" | ||
|
||
worker: | ||
amiID: "" | ||
iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: "" | ||
|
||
# K0s parameters | ||
k0s: | ||
version: v1.27.2+k0s.0 |