-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
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/ |
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,20 @@ | ||
apiVersion: v2 | ||
name: azure-hosted-cp | ||
description: | | ||
An HMC template to deploy a k8s cluster on Azure 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.0.1 | ||
# 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: "1.30.2+k0s.0" | ||
annotations: | ||
hmc.mirantis.com/type: deployment | ||
hmc.mirantis.com/infrastructure-providers: azure | ||
hmc.mirantis.com/controlplane-providers: k0s | ||
hmc.mirantis.com/bootstrap-providers: k0s |
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 @@ | ||
{{- define "cluster.name" -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{- define "azuremachinetemplate.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 }} |
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/v1beta1 | ||
kind: AzureCluster | ||
metadata: | ||
name: {{ include "cluster.name" . }} | ||
# annotations: | ||
# cluster.x-k8s.io/managed-by: k0smotron | ||
spec: | ||
identityRef: | ||
kind: AzureClusterIdentity | ||
name: {{ .Values.clusterIdentity.name }} | ||
namespace: {{ .Values.clusterIdentity.namespace }} | ||
location: {{ .Values.location }} | ||
{{- if .Values.bastion.enabled }} | ||
{{- with .Values.bastion.bastionSpec }} | ||
bastionSpec: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
subscriptionID: {{ .Values.subscriptionID }} |
14 changes: 14 additions & 0 deletions
14
templates/azure-hosted-cp/templates/azuremachinetemplate.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: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: AzureMachineTemplate | ||
metadata: | ||
name: {{ include "azuremachinetemplate.name" . }} | ||
spec: | ||
template: | ||
spec: | ||
osDisk: | ||
diskSizeGB: {{ .Values.rootVolumeSize }} | ||
osType: Linux | ||
{{- if not (quote .Values.sshPublicKey | empty) }} | ||
sshPublicKey: {{ .Values.sshPublicKey }} | ||
{{- end }} | ||
vmSize: {{ .Values.vmSize }} |
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/v1beta1 | ||
kind: AzureCluster | ||
name: {{ include "cluster.name" . }} |
47 changes: 47 additions & 0 deletions
47
templates/azure-hosted-cp/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,47 @@ | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: K0smotronControlPlane | ||
metadata: | ||
name: {{ include "k0smotroncontrolplane.name" . }} | ||
spec: | ||
replicas: {{ .Values.controlPlaneNumber }} | ||
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: k0s | ||
spec: | ||
network: | ||
provider: calico | ||
calico: | ||
mode: vxlan | ||
extensions: | ||
helm: | ||
repositories: | ||
- name: cloud-provider-azure | ||
url: https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo | ||
- name: azuredisk-csi-driver | ||
url: https://raw.githubusercontent.com/kubernetes-sigs/azuredisk-csi-driver/master/charts | ||
charts: | ||
- name: cloud-provider-azure | ||
namespace: kube-system | ||
chartname: cloud-provider-azure/cloud-provider-azure | ||
version: 1.30.4 | ||
values: | | ||
cloudControllerManager: | ||
nodeSelector: | ||
node-role.kubernetes.io/control-plane: null | ||
- name: azuredisk-csi-driver | ||
namespace: kube-system | ||
chartname: azuredisk-csi-driver/azuredisk-csi-driver | ||
version: 1.30.3 | ||
values: | | ||
linux: | ||
kubelet: "/var/lib/k0s/kubelet" |
11 changes: 11 additions & 0 deletions
11
templates/azure-hosted-cp/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" |
26 changes: 26 additions & 0 deletions
26
templates/azure-hosted-cp/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,26 @@ | ||
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: | ||
version: {{ regexReplaceAll "\\+k0s.+$" .Values.k0s.version "" }} | ||
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/v1beta1 | ||
kind: AzureMachineTemplate | ||
name: {{ include "azuremachinetemplate.name" . }} |
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,125 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"description": "An HMC template to deploy a K8s cluster on Azure with control plane components within the management cluster.", | ||
"type": "object", | ||
"required": [ | ||
"controlPlaneNumber", | ||
"workersNumber", | ||
"location", | ||
"vmSize" | ||
], | ||
"properties": { | ||
"controlPlaneNumber": { | ||
"description": "The number of the control plane machines", | ||
"type": "number", | ||
"minimum": 1 | ||
}, | ||
"workersNumber": { | ||
"description": "The number of the worker machines", | ||
"type": "number", | ||
"minimum": 1 | ||
}, | ||
"clusterNetwork": { | ||
"type": "object", | ||
"properties": { | ||
"pods": { | ||
"type": "object", | ||
"properties": { | ||
"cidrBlocks": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
} | ||
}, | ||
"services": { | ||
"type": "object", | ||
"properties": { | ||
"cidrBlocks": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"location": { | ||
"description": "Azure location to deploy the cluster in", | ||
"type": "string" | ||
}, | ||
"bastion": { | ||
"type": "object", | ||
"description": "The configuration of the bastion host", | ||
"required": [], | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean" | ||
} | ||
} | ||
}, | ||
"sshPublicKey": { | ||
"description": "SSH public key in base64 format, which will be used on the machine.", | ||
"type": "string" | ||
}, | ||
"vmSize": { | ||
"description": "The size of instance to create", | ||
"type": "string" | ||
}, | ||
"rootVolumeSize": { | ||
"description": "The size of the root volume of the instance (GB)", | ||
"type": "integer" | ||
}, | ||
"k0smotron": { | ||
"description": "K0smotron parameters", | ||
"type": "object", | ||
"properties": { | ||
"service": { | ||
"description": "The configuration of a K0smotron service", | ||
"properties": { | ||
"type": { | ||
"description": "Ingress methods for a k0smotron service", | ||
"enum": [ | ||
"ClusterIP", | ||
"NodePort", | ||
"LoadBalancer" | ||
], | ||
"type": "string" | ||
}, | ||
"apiPort": { | ||
"description": "The kubernetes API port for a k0smotron service", | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65535 | ||
}, | ||
"konnectivityPort": { | ||
"description": "The konnectivity port", | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65535 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"k0s": { | ||
"description": "K0s parameters", | ||
"type": "object", | ||
"required": [ | ||
"version" | ||
], | ||
"properties": { | ||
"version":{ | ||
"description": "K0s version to use", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
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,38 @@ | ||
# Cluster parameters | ||
controlPlaneNumber: 3 | ||
workersNumber: 2 | ||
|
||
clusterNetwork: | ||
pods: | ||
cidrBlocks: | ||
- "10.244.0.0/16" | ||
services: | ||
cidrBlocks: | ||
- "10.96.0.0/12" | ||
|
||
# AWS cluster parameters | ||
location: "" | ||
subscriptionID: "" | ||
bastion: | ||
enabled: false | ||
bastionSpec: | ||
azureBastion: {} | ||
clusterIdentity: | ||
name: "" | ||
namespace: hmc-system | ||
# AWS machines parameters | ||
|
||
sshPublicKey: "" | ||
vmSize: "" | ||
rootVolumeSize: 30 | ||
|
||
# K0smotron parameters | ||
k0smotron: | ||
service: | ||
type: LoadBalancer | ||
apiPort: 6443 | ||
konnectivityPort: 8132 | ||
|
||
# K0s parameters | ||
k0s: | ||
version: v1.30.2+k0s.0 |
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,8 @@ | ||
apiVersion: hmc.mirantis.com/v1alpha1 | ||
kind: Template | ||
metadata: | ||
name: azure-hosted-cp | ||
spec: | ||
helm: | ||
chartName: azure-hosted-cp | ||
chartVersion: 0.0.1 |