Skip to content

Commit 28f469d

Browse files
[CCM] add Hetzner hcloud
Signed-off-by: Ahmad Murzahmatov <[email protected]>
1 parent 70f8266 commit 28f469d

17 files changed

Lines changed: 948 additions & 0 deletions

‎packages/system/hcloud/Chart.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v2
2+
name: hcloud-cloud-controller-manager
3+
type: application
4+
version: 1.26.0 # Placeholder, the actual version will be automatically set during the build process

‎packages/system/hcloud/Makefile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export NAME=hcloud-ccm
2+
export NAMESPACE=kube-system
3+
4+
include ../../../scripts/package.mk
5+
6+
update:
7+
rm -rf charts
8+
mkdir -p charts
9+
curl -sSL https://github.com/hetznercloud/hcloud-cloud-controller-manager/archive/refs/heads/master.tar.gz/ | \
10+
tar xzvf - --strip 2 -C charts hcloud-cloud-controller-manager-main/chart
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
# Source: hcloud-cloud-controller-manager/templates/serviceaccount.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: hcloud-cloud-controller-manager
7+
namespace: kube-system
8+
---
9+
# Source: hcloud-cloud-controller-manager/templates/clusterrolebinding.yaml
10+
kind: ClusterRoleBinding
11+
apiVersion: rbac.authorization.k8s.io/v1
12+
metadata:
13+
name: "system:hcloud-cloud-controller-manager"
14+
roleRef:
15+
apiGroup: rbac.authorization.k8s.io
16+
kind: ClusterRole
17+
name: cluster-admin
18+
subjects:
19+
- kind: ServiceAccount
20+
name: hcloud-cloud-controller-manager
21+
namespace: kube-system
22+
---
23+
# Source: hcloud-cloud-controller-manager/templates/deployment.yaml
24+
apiVersion: apps/v1
25+
kind: Deployment
26+
metadata:
27+
name: hcloud-cloud-controller-manager
28+
namespace: kube-system
29+
spec:
30+
replicas: 1
31+
revisionHistoryLimit: 2
32+
selector:
33+
matchLabels:
34+
app.kubernetes.io/instance: 'hcloud-hccm'
35+
app.kubernetes.io/name: 'hcloud-cloud-controller-manager'
36+
template:
37+
metadata:
38+
labels:
39+
app.kubernetes.io/instance: 'hcloud-hccm'
40+
app.kubernetes.io/name: 'hcloud-cloud-controller-manager'
41+
spec:
42+
serviceAccountName: hcloud-cloud-controller-manager
43+
dnsPolicy: Default
44+
tolerations:
45+
# Allow HCCM itself to schedule on nodes that have not yet been initialized by HCCM.
46+
- key: "node.cloudprovider.kubernetes.io/uninitialized"
47+
value: "true"
48+
effect: "NoSchedule"
49+
- key: "CriticalAddonsOnly"
50+
operator: "Exists"
51+
52+
# Allow HCCM to schedule on control plane nodes.
53+
- key: "node-role.kubernetes.io/master"
54+
effect: NoSchedule
55+
operator: Exists
56+
- key: "node-role.kubernetes.io/control-plane"
57+
effect: NoSchedule
58+
operator: Exists
59+
60+
- key: "node.kubernetes.io/not-ready"
61+
effect: "NoExecute"
62+
containers:
63+
- name: hcloud-cloud-controller-manager
64+
args:
65+
- "--allow-untagged-cloud"
66+
- "--cloud-provider=hcloud"
67+
- "--route-reconciliation-period=30s"
68+
- "--webhook-secure-port=0"
69+
- "--leader-elect=false"
70+
env:
71+
- name: HCLOUD_TOKEN
72+
valueFrom:
73+
secretKeyRef:
74+
key: token
75+
name: hcloud
76+
- name: ROBOT_PASSWORD
77+
valueFrom:
78+
secretKeyRef:
79+
key: robot-password
80+
name: hcloud
81+
optional: true
82+
- name: ROBOT_USER
83+
valueFrom:
84+
secretKeyRef:
85+
key: robot-user
86+
name: hcloud
87+
optional: true
88+
image: docker.io/hetznercloud/hcloud-cloud-controller-manager:v1.26.0 # x-releaser-pleaser-version
89+
ports:
90+
- name: metrics
91+
containerPort: 8233
92+
resources:
93+
requests:
94+
cpu: 100m
95+
memory: 50Mi
96+
priorityClassName: "system-cluster-critical"
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
# Source: hcloud-cloud-controller-manager/templates/serviceaccount.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: hcloud-cloud-controller-manager
7+
namespace: kube-system
8+
---
9+
# Source: hcloud-cloud-controller-manager/templates/clusterrolebinding.yaml
10+
kind: ClusterRoleBinding
11+
apiVersion: rbac.authorization.k8s.io/v1
12+
metadata:
13+
name: "system:hcloud-cloud-controller-manager"
14+
roleRef:
15+
apiGroup: rbac.authorization.k8s.io
16+
kind: ClusterRole
17+
name: cluster-admin
18+
subjects:
19+
- kind: ServiceAccount
20+
name: hcloud-cloud-controller-manager
21+
namespace: kube-system
22+
---
23+
# Source: hcloud-cloud-controller-manager/templates/daemonset.yaml
24+
apiVersion: apps/v1
25+
kind: DaemonSet
26+
metadata:
27+
name: hcloud-cloud-controller-manager
28+
namespace: kube-system
29+
spec:
30+
revisionHistoryLimit: 2
31+
selector:
32+
matchLabels:
33+
app.kubernetes.io/instance: 'hcloud-hccm'
34+
app.kubernetes.io/name: 'hcloud-cloud-controller-manager'
35+
template:
36+
metadata:
37+
labels:
38+
app.kubernetes.io/instance: 'hcloud-hccm'
39+
app.kubernetes.io/name: 'hcloud-cloud-controller-manager'
40+
pod-label: pod-label
41+
annotations:
42+
pod-annotation: pod-annotation
43+
spec:
44+
serviceAccountName: hcloud-cloud-controller-manager
45+
dnsPolicy: Default
46+
tolerations:
47+
# Allow HCCM itself to schedule on nodes that have not yet been initialized by HCCM.
48+
- key: "node.cloudprovider.kubernetes.io/uninitialized"
49+
value: "true"
50+
effect: "NoSchedule"
51+
- key: "CriticalAddonsOnly"
52+
operator: "Exists"
53+
54+
# Allow HCCM to schedule on control plane nodes.
55+
- key: "node-role.kubernetes.io/master"
56+
effect: NoSchedule
57+
operator: Exists
58+
- key: "node-role.kubernetes.io/control-plane"
59+
effect: NoSchedule
60+
operator: Exists
61+
62+
- key: "node.kubernetes.io/not-ready"
63+
effect: "NoExecute"
64+
65+
- effect: NoSchedule
66+
key: example-key
67+
operator: Exists
68+
nodeSelector:
69+
70+
foo: bar
71+
containers:
72+
- name: hcloud-cloud-controller-manager
73+
command:
74+
- "/bin/hcloud-cloud-controller-manager"
75+
- "--allow-untagged-cloud"
76+
- "--cloud-provider=hcloud"
77+
- "--route-reconciliation-period=30s"
78+
- "--webhook-secure-port=0"
79+
env:
80+
- name: HCLOUD_TOKEN
81+
valueFrom:
82+
secretKeyRef:
83+
key: token
84+
name: hcloud
85+
- name: ROBOT_PASSWORD
86+
valueFrom:
87+
secretKeyRef:
88+
key: robot-password
89+
name: hcloud
90+
optional: true
91+
- name: ROBOT_USER
92+
valueFrom:
93+
secretKeyRef:
94+
key: robot-user
95+
name: hcloud
96+
optional: true
97+
image: docker.io/hetznercloud/hcloud-cloud-controller-manager:v1.26.0 # x-releaser-pleaser-version
98+
ports:
99+
- name: metrics
100+
containerPort: 8233
101+
resources:
102+
requests:
103+
cpu: 100m
104+
memory: 50Mi
105+
volumeMounts:
106+
- mountPath: /var/run/secrets/hcloud
107+
name: token-volume
108+
readOnly: true
109+
priorityClassName: system-cluster-critical
110+
volumes:
111+
- name: token-volume
112+
secret:
113+
secretName: hcloud-token
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
kind: DaemonSet
2+
3+
monitoring:
4+
podMonitor:
5+
labels:
6+
environment: staging
7+
annotations:
8+
release: kube-prometheus-stack
9+
10+
additionalTolerations:
11+
- key: "example-key"
12+
operator: "Exists"
13+
effect: "NoSchedule"
14+
15+
nodeSelector:
16+
foo: bar
17+
18+
affinity:
19+
nodeAffinity:
20+
requiredDuringSchedulingIgnoredDuringExecution:
21+
nodeSelectorTerms:
22+
- matchExpressions:
23+
- key: topology.kubernetes.io/zone
24+
operator: In
25+
values:
26+
- antarctica-east1
27+
- antarctica-west1
28+
preferredDuringSchedulingIgnoredDuringExecution:
29+
- weight: 1
30+
preference:
31+
matchExpressions:
32+
- key: another-node-label-key
33+
operator: In
34+
values:
35+
- another-node-label-value
36+
37+
podLabels:
38+
pod-label: pod-label
39+
40+
podAnnotations:
41+
pod-annotation: pod-annotation
42+
43+
extraVolumeMounts:
44+
- name: token-volume
45+
readOnly: true
46+
mountPath: /var/run/secrets/hcloud
47+
48+
extraVolumes:
49+
- name: token-volume
50+
secret:
51+
secretName: hcloud-token
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v2
2+
name: hcloud-cloud-controller-manager
3+
type: application
4+
version: 1.26.0 # x-releaser-pleaser-version
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# hcloud-cloud-controller-manager Helm Chart
2+
3+
This Helm chart is the recommended installation method for [hcloud-cloud-controller-manager](https://github.com/hetznercloud/hcloud-cloud-controller-manager).
4+
5+
## Quickstart
6+
7+
First, [install Helm 3](https://helm.sh/docs/intro/install/).
8+
9+
The following snippet will deploy hcloud-cloud-controller-manager to the kube-system namespace.
10+
11+
```sh
12+
# Sync the Hetzner Cloud helm chart repository to your local computer.
13+
helm repo add hcloud https://charts.hetzner.cloud
14+
helm repo update hcloud
15+
16+
# Install the latest version of the hcloud-cloud-controller-manager chart.
17+
helm install hccm hcloud/hcloud-cloud-controller-manager -n kube-system
18+
19+
# If you want to install hccm with private networking support (see main Deployment guide for more info).
20+
helm install hccm hcloud/hcloud-cloud-controller-manager -n kube-system --set networking.enabled=true
21+
```
22+
23+
Please note that additional configuration is necessary. See the main [Deployment](https://github.com/hetznercloud/hcloud-cloud-controller-manager#deployment) guide.
24+
25+
If you're unfamiliar with Helm it would behoove you to peep around the documentation. Perhaps start with the [Quickstart Guide](https://helm.sh/docs/intro/quickstart/)?
26+
27+
### Upgrading from static manifests
28+
29+
If you previously installed hcloud-cloud-controller-manager with this command:
30+
31+
```sh
32+
kubectl apply -f https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases/latest/download/ccm.yaml
33+
```
34+
35+
You can uninstall that same deployment, by running the following command:
36+
37+
```sh
38+
kubectl delete -f https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases/latest/download/ccm.yaml
39+
```
40+
41+
Then you can follow the Quickstart installation steps above.
42+
43+
## Configuration
44+
45+
This chart aims to be highly flexible. Please review the [values.yaml](./values.yaml) for a full list of configuration options.
46+
47+
If you've already deployed hccm using the `helm install` command above, you can easily change configuration values:
48+
49+
```sh
50+
helm upgrade hccm hcloud/hcloud-cloud-controller-manager -n kube-system --set monitoring.podMonitor.enabled=true
51+
```
52+
53+
### Multiple replicas / DaemonSet
54+
55+
You can choose between different deployment options. By default the chart will deploy a single replica as a Deployment.
56+
57+
If you want to change the replica count you can adjust the value `replicaCount` inside the helm values.
58+
If you have more than 1 replica leader election will be turned on automatically.
59+
60+
If you want to deploy hccm as a DaemonSet you can set `kind` to `DaemonSet` inside the values.
61+
To adjust on which nodes the DaemonSet should be deployed you can use the `nodeSelector` and `additionalTolerations` values.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ if (and $.Values.monitoring.enabled $.Values.monitoring.podMonitor.enabled) }}
2+
{{ if not ($.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PodMonitor") }}
3+
WARNING: monitoring.podMonitoring.enabled=true but PodMonitor could not be installed: the CRD was not detected.
4+
{{ end }}
5+
{{ end }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- define "hcloud-cloud-controller-manager.name" -}}
2+
{{- $.Values.nameOverride | default $.Chart.Name | trunc 63 | trimSuffix "-" }}
3+
{{- end }}
4+
5+
{{- define "hcloud-cloud-controller-manager.selectorLabels" -}}
6+
{{- tpl (toYaml $.Values.selectorLabels) $ }}
7+
{{- end }}

0 commit comments

Comments
 (0)