magnum: support kubeconfig configuration file
If a file {{ node_custom_config }}/magnum/kubeconfig exists, it is copied to /var/lib/magnum/.kube/config in all Magnum Service Containers. At this location, the vexxhost/magnum-cluster-api will loo for the Kubeconfig configuration file to control the Cluster API Control Plane. If the vexxhost/magnum-cluster-api is installed in the Magnum container images, control of a cluster API control plane can then take place via the Magnum API. Depends-On: https://review.opendev.org/c/openstack/kolla/+/902101 Change-Id: I986c5192fe96b9c480a2d8fa87d719a50ce78186
This commit is contained in:
parent
bdd2aa37b2
commit
c939504da6
@ -31,6 +31,33 @@
|
|||||||
when:
|
when:
|
||||||
- magnum_policy.results
|
- magnum_policy.results
|
||||||
|
|
||||||
|
- name: Check if kubeconfig file is supplied
|
||||||
|
stat:
|
||||||
|
path: "{{ node_custom_config }}/magnum/kubeconfig"
|
||||||
|
delegate_to: localhost
|
||||||
|
run_once: True
|
||||||
|
register: magnum_kubeconfig_file
|
||||||
|
|
||||||
|
- name: Copying over kubeconfig file
|
||||||
|
template:
|
||||||
|
src: "{{ node_custom_config }}/magnum/kubeconfig"
|
||||||
|
dest: "{{ node_config_directory }}/{{ item.key }}/kubeconfig"
|
||||||
|
mode: "0660"
|
||||||
|
become: true
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- item.value.enabled | bool
|
||||||
|
- magnum_kubeconfig_file.stat.exists
|
||||||
|
with_dict: "{{ magnum_services }}"
|
||||||
|
notify:
|
||||||
|
- Restart {{ item.key }} container
|
||||||
|
|
||||||
|
- name: Set magnum kubeconfig file's path
|
||||||
|
set_fact:
|
||||||
|
magnum_kubeconfig_file_path: "{{ magnum_kubeconfig_file.stat.path }}"
|
||||||
|
when:
|
||||||
|
- magnum_kubeconfig_file.stat.exists
|
||||||
|
|
||||||
- include_tasks: copy-certs.yml
|
- include_tasks: copy-certs.yml
|
||||||
when:
|
when:
|
||||||
- kolla_copy_ca_into_containers | bool
|
- kolla_copy_ca_into_containers | bool
|
||||||
|
@ -6,7 +6,14 @@
|
|||||||
"dest": "/etc/magnum/magnum.conf",
|
"dest": "/etc/magnum/magnum.conf",
|
||||||
"owner": "magnum",
|
"owner": "magnum",
|
||||||
"perm": "0600"
|
"perm": "0600"
|
||||||
}{% if magnum_policy_file is defined %},
|
}{% if magnum_kubeconfig_file_path is defined %},
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/kubeconfig",
|
||||||
|
"dest": "/var/lib/magnum/.kube/config",
|
||||||
|
"owner": "magnum",
|
||||||
|
"perm": "0600"
|
||||||
|
}{% endif %}
|
||||||
|
{% if magnum_policy_file is defined %},
|
||||||
{
|
{
|
||||||
"source": "{{ container_config_directory }}/{{ magnum_policy_file }}",
|
"source": "{{ container_config_directory }}/{{ magnum_policy_file }}",
|
||||||
"dest": "/etc/magnum/{{ magnum_policy_file }}",
|
"dest": "/etc/magnum/{{ magnum_policy_file }}",
|
||||||
|
@ -6,7 +6,14 @@
|
|||||||
"dest": "/etc/magnum/magnum.conf",
|
"dest": "/etc/magnum/magnum.conf",
|
||||||
"owner": "magnum",
|
"owner": "magnum",
|
||||||
"perm": "0600"
|
"perm": "0600"
|
||||||
}{% if magnum_policy_file is defined %},
|
}{% if magnum_kubeconfig_file_path is defined %},
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/kubeconfig",
|
||||||
|
"dest": "/var/lib/magnum/.kube/config",
|
||||||
|
"owner": "magnum",
|
||||||
|
"perm": "0600"
|
||||||
|
}{% endif %}
|
||||||
|
{% if magnum_policy_file is defined %},
|
||||||
{
|
{
|
||||||
"source": "{{ container_config_directory }}/{{ magnum_policy_file }}",
|
"source": "{{ container_config_directory }}/{{ magnum_policy_file }}",
|
||||||
"dest": "/etc/magnum/{{ magnum_policy_file }}",
|
"dest": "/etc/magnum/{{ magnum_policy_file }}",
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds support for copying in ``{{ node_custom_config }}/magnum/kubeconfig``
|
||||||
|
to Magnum containers for ``magnum-cluster-api`` driver.
|
Loading…
x
Reference in New Issue
Block a user