openstack-helm-infra/roles/deploy-kubeadm-aio-common/tasks/util-kubeadm-aio-run.yaml
Tin Lam 1d903948ae Add label to namespaces
This patch set adds the ability to add a label to the following namespaces:

- kube-public
- kube-system
- default

This was previously done in kubeadm in patch [0] but appears to be
removed as the script moved around. Also, this PS adds this to the
minikube deployment.

[0] https://review.opendev.org/#/c/540131/

Change-Id: I0f06e8ae0cd7742313b447dc2d563c7d92318fb0
Signed-off-by: Tin Lam <tin@irrational.io>
2019-09-13 13:20:07 -05:00

84 lines
3.0 KiB
YAML

# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Run Kubeadm-AIO container
vars:
kubeadm_aio_action: null
kubeadm_kubelet_labels: ""
block:
- name: "performing {{ kubeadm_aio_action }} action"
become: true
become_user: root
docker_container:
name: "kubeadm-{{ kubeadm_aio_action }}"
image: "{{ images.kubernetes.kubeadm_aio }}"
state: started
detach: false
recreate: yes
pid_mode: host
network_mode: host
capabilities: SYS_ADMIN
volumes:
- /sys:/sys:rw
- /run:/run:rw
- /:/mnt/rootfs:rw
- /etc:/etc:rw
env:
CONTAINER_NAME="kubeadm-{{ kubeadm_aio_action }}"
ACTION="{{ kubeadm_aio_action }}"
KUBE_BIND_DEVICE="{{ kubernetes_default_device }}"
KUBE_BIND_ADDR="{{ kubernetes_default_address }}"
USER_UID="{{ playbook_user_id }}"
USER_GID="{{ playbook_group_id }}"
USER_HOME="{{ playbook_user_dir }}"
CNI_ENABLED="{{ kubernetes_cluster_cni }}"
PVC_SUPPORT_CEPH=true
PVC_SUPPORT_NFS=true
NET_SUPPORT_LINUXBRIDGE=true
KUBE_NET_POD_SUBNET="{{ kubernetes_cluster_pod_subnet }}"
KUBE_NET_DNS_DOMAIN="{{ kubernetes_cluster_domain }}"
CONTAINER_RUNTIME=docker
KUBELET_NODE_LABELS="{{ kubeadm_kubelet_labels }}"
KUBE_SELF_HOSTED="{{ kubernetes_selfhosted }}"
KUBE_KEYSTONE_AUTH="{{ kubernetes_keystone_auth }}"
GATE_FQDN_TEST="{{ gate_fqdn_test }}"
GATE_FQDN_TLD="{{ gate_fqdn_tld }}"
GATE_INGRESS_IP="{{ primary_node_default_ip }}"
register: kubeadm_master_deploy
rescue:
- name: "getting logs for {{ kubeadm_aio_action }} action"
command: "docker logs kubeadm-{{ kubeadm_aio_action }}"
become: true
become_user: root
register: out
- name: "dumping logs for {{ kubeadm_aio_action }} action"
debug:
var: out.stdout_lines
- name: "exiting if {{ kubeadm_aio_action }} action failed"
command: exit 1
always:
- name: "removing container for {{ kubeadm_aio_action }} action"
become: true
become_user: root
docker_container:
name: "kubeadm-{{ kubeadm_aio_action }}"
state: absent
- name: add labels to namespaces
command: kubectl label --overwrite namespace {{ item }} name={{ item }}
with_items:
- default
- kube-system
- kube-public
ignore_errors: True