infrastructure/k8s/roles/hcloud/tasks/main.yml

52 lines
1.4 KiB
YAML
Raw Normal View History

2023-01-21 17:25:18 +00:00
---
- name: Create Hcloud token secret
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: hcloud
namespace: kube-system
data:
token: "{{ HcloudToken | b64encode }}"
network: "{{ 'k8s-net' | b64encode }}"
- name: Deploy CSI driver
kubernetes.core.k8s:
state: present
definition: "{{ item }}"
loop: "{{ lookup('ansible.builtin.template', 'hcloud-csi.yml.j2') | ansible.builtin.from_yaml_all | list }}"
- name: Add Hcloud chart repo
kubernetes.core.helm_repository:
name: hcloud
repo_url: https://charts.hetzner.cloud
2023-01-21 17:25:18 +00:00
- name: Deploy cloud-controller-manager
kubernetes.core.helm:
name: hccm
chart_ref: hcloud/hcloud-cloud-controller-manager
release_namespace: kube-system
chart_version: "1.17.0"
release_values: "{{ lookup('template', 'values.hccm.yml.j2') | from_yaml }}"
2023-01-21 17:25:18 +00:00
- name: Create CSI controller PodMonitor
kubernetes.core.k8s:
state: present
definition:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: hcloud-csi-controller
namespace: kube-system
labels:
prometheus: default
spec:
selector:
matchLabels:
app: hcloud-csi-controller
podMetricsEndpoints:
- port: metrics
path: /