-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add playbooks for deploying a CAPI management cluster only (#82)
* First pass at CAPI mgmt cluster only * Changes to disable ingress controller on CAPI mgmt only clusters * Allow number of control plane nodes to be changed * Add check for machine deployments running
- Loading branch information
Showing
6 changed files
with
166 additions
and
90 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,14 @@ | ||
##### | ||
# This playbook turns the target Kubernetes cluster into a CAPI management cluster | ||
##### | ||
|
||
- hosts: azimuth_deploy | ||
roles: | ||
- role: stackhpc.azimuth_ops.alertmanager_config | ||
when: >- | ||
alertmanager_config_slack_webhook_url is defined and | ||
alertmanager_config_slack_webhook_url | ||
- role: stackhpc.azimuth_ops.certmanager | ||
- role: stackhpc.azimuth_ops.clusterapi | ||
environment: | ||
KUBECONFIG: "{{ kubeconfig_path | default('') }}" |
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
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,21 @@ | ||
##### | ||
# This playbook uses Terraform and Cluster API to provision a CAPI management cluster | ||
# The CAPI management cluster can be either single-node or HA | ||
##### | ||
|
||
|
||
# Provision the Kubernetes cluster onto which Azimuth will be deployed | ||
- import_playbook: stackhpc.azimuth_ops.provision_cluster | ||
|
||
|
||
# Install Azimuth | ||
- import_playbook: stackhpc.azimuth_ops.deploy_capi_mgmt | ||
vars: | ||
# In HA mode, use the kubeconfig for the HA cluster | ||
# In single node mode, use the default kubeconfig file | ||
kubeconfig_path: >- | ||
{{- | ||
"{}/kubeconfig-{}.yaml".format(ansible_env.HOME, capi_cluster_release_name) | ||
if install_mode == 'ha' | ||
else "" | ||
}} |
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,86 @@ | ||
##### | ||
# This playbook uses Terraform and Cluster API to provision infrastructure onto which Azimuth is deployed | ||
##### | ||
|
||
|
||
# Provision the node using Terraform | ||
- hosts: terraform_provision | ||
roles: | ||
- stackhpc.azimuth_ops.infra | ||
vars: | ||
infra_ansible_groups: [k3s, azimuth_deploy] | ||
|
||
|
||
# Configure the node as a K3S cluster | ||
- hosts: k3s | ||
tasks: | ||
- include_role: | ||
name: stackhpc.azimuth_ops.community_images | ||
|
||
- block: | ||
- include_role: | ||
name: stackhpc.azimuth_ops.k3s | ||
|
||
- name: Get installed Kubernetes version | ||
command: k3s kubectl version --output json | ||
changed_when: false | ||
register: k3s_kubectl_version | ||
|
||
- name: Set kubectl version fact | ||
set_fact: | ||
kubectl_version: "{{ (k3s_kubectl_version.stdout | from_json).serverVersion.gitVersion.split('+') | first }}" | ||
|
||
- include_role: | ||
name: stackhpc.azimuth_ops.kubectl | ||
|
||
- include_role: | ||
name: stackhpc.azimuth_ops.helm | ||
|
||
- include_role: | ||
name: stackhpc.azimuth_ops.kustomize | ||
|
||
- name: Slurp kubeconfig file | ||
slurp: | ||
src: /etc/rancher/k3s/k3s.yaml | ||
register: k3s_kubeconfig | ||
become: yes | ||
|
||
- name: Ensure kube config directory exists | ||
file: | ||
path: "{{ ansible_env.HOME }}/.kube" | ||
state: directory | ||
mode: u=rwx,g=rx,o=rx | ||
|
||
- name: Write kubeconfig file | ||
copy: | ||
content: "{{ k3s_kubeconfig.content | b64decode }}" | ||
dest: "{{ ansible_env.HOME }}/.kube/config" | ||
mode: u=rwx,g=,o= | ||
|
||
# For a single node install, we put the monitoring and ingress controller on the K3S cluster | ||
- block: | ||
# Must be done before NGINX ingress so that the ServiceMonitor CRD exists | ||
- include_role: | ||
name: stackhpc.azimuth_ops.kube_prometheus_stack | ||
|
||
- include_role: | ||
name: stackhpc.azimuth_ops.ingress_nginx | ||
when: "ingress_controller_enabled | default(true)" | ||
when: install_mode == 'singlenode' | ||
|
||
# Configure the K3S cluster as a Cluster API management cluster when doing a HA installation | ||
- block: | ||
- include_role: | ||
name: stackhpc.azimuth_ops.certmanager | ||
vars: | ||
certmanager_monitoring_enabled: no | ||
certmanager_acmehttp01issuer_enabled: no | ||
|
||
- include_role: | ||
name: stackhpc.azimuth_ops.clusterapi | ||
|
||
- include_role: | ||
name: stackhpc.azimuth_ops.capi_cluster | ||
vars: | ||
capi_cluster_kubeconfig_path: "{{ ansible_env.HOME }}/kubeconfig-{{ capi_cluster_release_name }}.yaml" | ||
when: install_mode == 'ha' |
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
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