feat: allow for custom registry
This patch adds a simple CLI which can mirror all the images needed
as well as allow for simple override for `atmosphere_image_repository`
for all images.
diff --git a/roles/kubernetes/defaults/main.yml b/roles/kubernetes/defaults/main.yml
index abc45b9..40c25ff 100644
--- a/roles/kubernetes/defaults/main.yml
+++ b/roles/kubernetes/defaults/main.yml
@@ -20,7 +20,7 @@
# .. envvar:: kubernetes_version [[[
#
# Kubernetes version
-kubernetes_version: 1.22.7
+kubernetes_version: 1.22.17
# ]]]
# .. envvar:: kubernetes_kernel_modules [[[
diff --git a/roles/kubernetes/tasks/control-plane.yml b/roles/kubernetes/tasks/control-plane.yml
index 6545c41..9d444d7 100644
--- a/roles/kubernetes/tasks/control-plane.yml
+++ b/roles/kubernetes/tasks/control-plane.yml
@@ -35,8 +35,8 @@
dest: /etc/keepalived/check_apiserver.sh
mode: 0755
- name: Upload Kubernetes manifest
- ansible.builtin.copy:
- src: keepalived.yaml
+ ansible.builtin.template:
+ src: keepalived.yaml.j2
dest: /etc/kubernetes/manifests/keepalived.yaml
owner: root
group: root
@@ -60,8 +60,8 @@
group: root
mode: 0644
- name: Upload Kubernetes manifest
- ansible.builtin.copy:
- src: haproxy.yaml
+ ansible.builtin.template:
+ src: haproxy.yaml.j2
dest: /etc/kubernetes/manifests/haproxy.yaml
owner: root
group: root
diff --git a/roles/kubernetes/files/haproxy.yaml b/roles/kubernetes/templates/haproxy.yaml.j2
similarity index 82%
rename from roles/kubernetes/files/haproxy.yaml
rename to roles/kubernetes/templates/haproxy.yaml.j2
index 0d6ea23..e780b05 100644
--- a/roles/kubernetes/files/haproxy.yaml
+++ b/roles/kubernetes/templates/haproxy.yaml.j2
@@ -5,8 +5,8 @@
namespace: kube-system
spec:
containers:
- - image: haproxy:2.5
- name: haproxy
+ - name: haproxy
+ image: "{{ lookup('vexxhost.atmosphere.image_ref', 'haproxy', output='ref') }}"
livenessProbe:
failureThreshold: 8
httpGet:
diff --git a/roles/kubernetes/files/keepalived.yaml b/roles/kubernetes/templates/keepalived.yaml.j2
similarity index 89%
rename from roles/kubernetes/files/keepalived.yaml
rename to roles/kubernetes/templates/keepalived.yaml.j2
index 5926af8..0312b42 100644
--- a/roles/kubernetes/files/keepalived.yaml
+++ b/roles/kubernetes/templates/keepalived.yaml.j2
@@ -7,7 +7,7 @@
spec:
containers:
- name: keepalived
- image: us-docker.pkg.dev/vexxhost-infra/openstack/keepalived:2.0.19
+ image: "{{ lookup('vexxhost.atmosphere.image_ref', 'keepalived', output='ref') }}"
command: ["keepalived", "-f", "/etc/keepalived/keepalived.conf", "--dont-fork", "--log-console", "--log-detail", "--dump-conf"]
resources: {}
securityContext:
diff --git a/roles/kubernetes/templates/kubeadm.yaml.j2 b/roles/kubernetes/templates/kubeadm.yaml.j2
index e12280b..f4689a0 100644
--- a/roles/kubernetes/templates/kubeadm.yaml.j2
+++ b/roles/kubernetes/templates/kubeadm.yaml.j2
@@ -37,6 +37,9 @@
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
controlPlaneEndpoint: "{{ kubernetes_hostname }}:6443"
+{% if atmosphere_image_repository is defined %}
+imageRepository: "{{ atmosphere_image_repository }}"
+{% endif %}
apiServer:
extraArgs:
oidc-username-claim: email