-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Mirantis/templates
Add basic k0smotron+aws template
- Loading branch information
Showing
10 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
charts/hmc-templates/aws/hmc-template-hosted-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/ |
15 changes: 15 additions & 0 deletions
15
charts/hmc-templates/aws/hmc-template-hosted-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,15 @@ | ||
apiVersion: v2 | ||
name: hmc-template-hosted-control-planes | ||
description: | | ||
The HMC template to deploy kubernetes cluster with control plane components | ||
within the management cluster. | ||
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" |
23 changes: 23 additions & 0 deletions
23
charts/hmc-templates/aws/hmc-template-hosted-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,23 @@ | ||
{{- define "cluster.name" -}} | ||
{{- .Values.clusterName | trunc 63 }} | ||
{{- end }} | ||
|
||
{{- define "awsmachinetemplate.name" -}} | ||
{{- include "cluster.name" . }}-mt | ||
{{- end }} | ||
|
||
{{- define "k0smotroncontrolplane.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 }} |
18 changes: 18 additions & 0 deletions
18
charts/hmc-templates/aws/hmc-template-hosted-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,18 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
metadata: | ||
name: {{ include "cluster.name" . }} | ||
annotations: | ||
cluster.x-k8s.io/managed-by: k0smotron | ||
spec: | ||
region: {{ .Values.region }} | ||
# identityRef: | ||
# kind: AWSClusterStaticIdentity | ||
# name: aws-identity-name | ||
network: | ||
vpc: | ||
id: {{ .Values.vpcID }} | ||
{{- with .Values.subnets }} | ||
subnets: | ||
{{- toYaml . | nindent 6 }} | ||
{{- end }} |
21 changes: 21 additions & 0 deletions
21
...ts/hmc-templates/aws/hmc-template-hosted-control-planes/templates/awsmachinetemplate.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,21 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: {{ include "awsmachinetemplate.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
ami: | ||
id: {{ .Values.amiID }} | ||
instanceType: {{ .Values.instanceType }} | ||
# Instance Profile created by `clusterawsadm bootstrap iam create-cloudformation-stack` | ||
iamInstanceProfile: {{ .Values.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 | ||
additionalSecurityGroups: | ||
- id: {{ .Values.securityGroupID }} | ||
{{- if .Values.sshKeyName }} | ||
sshKeyName: {{ .Values.sshKeyName }} | ||
{{- end }} |
17 changes: 17 additions & 0 deletions
17
charts/hmc-templates/aws/hmc-template-hosted-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: K0smotronControlPlane | ||
name: {{ include "k0smotroncontrolplane.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-hosted-control-planes/templates/k0smotroncontrolplane.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: K0smotronControlPlane | ||
metadata: | ||
name: {{ include "k0smotroncontrolplane.name" . }} | ||
spec: | ||
replicas: 3 | ||
# dirty hack | ||
version: {{ .Values.k0s.version | replace "+" "-" }} | ||
{{- with .Values.k0smotron.service }} | ||
service: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
controllerPlaneFlags: | ||
- "--enable-cloud-provider=true" | ||
- "--debug=true" | ||
k0sConfig: | ||
apiVersion: k0s.k0sproject.io/v1beta1 | ||
kind: ClusterConfig | ||
metadata: | ||
name: {{ include "k0sconfig.name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
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" . }} | ||
# Removing the default `node-role.kubernetes.io/control-plane` node selector | ||
# TODO: it does not work | ||
# nodeSelector: "" |
11 changes: 11 additions & 0 deletions
11
...c-templates/aws/hmc-template-hosted-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
charts/hmc-templates/aws/hmc-template-hosted-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.name" . }} |
34 changes: 34 additions & 0 deletions
34
charts/hmc-templates/aws/hmc-template-hosted-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,34 @@ | ||
# Cluster parameters | ||
clusterName: k0s-aws | ||
workersNumber: 2 | ||
|
||
clusterNetwork: | ||
pods: | ||
cidrBlocks: | ||
- "10.244.0.0/16" | ||
services: | ||
cidrBlocks: | ||
- "10.96.0.0/12" | ||
|
||
# AWS cluster parameters | ||
vpcID: "" | ||
region: "" | ||
sshKeyName: "" | ||
subnets: [] | ||
|
||
# AWS machines parameters | ||
amiID: "" | ||
iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: "" | ||
securityGroupID: "" | ||
|
||
# K0smotron parameters | ||
k0smotron: | ||
service: | ||
type: LoadBalancer | ||
apiPort: 6443 | ||
konnectivityPort: 8132 | ||
|
||
# K0s parameters | ||
k0s: | ||
version: v1.27.2+k0s.0 |