Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable TLS for image-cache webserver #56

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions playbooks/setup_management_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,22 @@
debug:
msg: "Login to the management-cluster vm with 'ssh {{ vm_user }}@{{ management_cluster_public_ip }}'"

- name: Define management-cluster node
ansible.builtin.add_host:
ansible_python_interpreter: "{{ vm_python_interpreter | default('/usr/bin/python3') }}"
name: management-cluster
hostname: management-cluster
ansible_user: "{{ vm_user }}"
ansible_host: "{{ management_cluster_public_ip }}"
groups:
- "{{ management_clusterhost_group | default('management_cluster_group') }}"

- hosts: management-cluster
tasks:
- name: Create .kube
file:
path: ~/.kube
state: directory

# TODO - there's likely a better way to do this...
- name: Fetch kubeconfig from management cluster
become: true
fetch:
src: /etc/rancher/rke2/rke2.yaml
flat: true
command:
cmd: "ssh -o StrictHostKeyChecking=no {{ vm_user }}@{{ management_cluster_public_ip }} sudo cat /etc/rancher/rke2/rke2.yaml"
register: kubeconfig

- name: Write ~/.kube/config locally
copy:
content: "{{ kubeconfig.stdout }}"
dest: ~/.kube/config

- hosts: localhost
connection: local
tasks:
- name: Update IP in kubeconfig
replace:
path: ~/.kube/config
Expand Down
4 changes: 2 additions & 2 deletions roles/example-manifests/templates/rke2-agent.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ spec:
matchLabels:
cluster-role: worker
image:
checksum: http://imagecache.local:8080/{{ downstream_cluster_image }}.sha256
checksum: https://imagecache.local:8443/{{ downstream_cluster_image }}.sha256
checksumType: sha256
format: raw
url: http://imagecache.local:8080/{{ downstream_cluster_image }}
url: https://imagecache.local:8443/{{ downstream_cluster_image }}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: Metal3DataTemplate
Expand Down
4 changes: 2 additions & 2 deletions roles/example-manifests/templates/rke2-control-plane.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ spec:
matchLabels:
cluster-role: control-plane
image:
checksum: http://imagecache.local:8080/{{ downstream_cluster_image }}.sha256
checksum: https://imagecache.local:8443/{{ downstream_cluster_image }}.sha256
checksumType: sha256
format: raw
url: http://imagecache.local:8080/{{ downstream_cluster_image }}
url: https://imagecache.local:8443/{{ downstream_cluster_image }}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: Metal3DataTemplate
Expand Down
2 changes: 2 additions & 0 deletions roles/image-cache/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
working_dir: "{{ lookup('env', 'HOME') }}/metal3-demo-files"
image_cache_dir: "{{ working_dir }}/image-cache"
image_cache_conf_dir: "{{ working_dir }}/image-cache-conf"
image_cache_https: true
Loading