From d5d007c85cb90ac892dbcda51a0419267743d9cc Mon Sep 17 00:00:00 2001 From: Balazs Szekeres Date: Tue, 24 Sep 2019 15:31:10 +0200 Subject: [PATCH] Kubernetes ceph role moved to caas-storage Kubernetes ceph role and logic moved to caas-storage repo and rpm Change-Id: I60e5f10b370b454f8a674ed07a82621e147c4699 Signed-off-by: Balazs Szekeres --- ansible/playbooks/kubernetes_ceph.yaml | 23 ----------- ansible/roles/kubernetes_ceph/defaults/main.yaml | 25 ------------ ansible/roles/kubernetes_ceph/meta/main.yaml | 17 -------- .../tasks/create_ceph_auth_secret.yaml | 38 ------------------ .../tasks/create_ceph_storage_class.yaml | 46 ---------------------- ansible/roles/kubernetes_ceph/tasks/main.yaml | 23 ----------- .../kubernetes_ceph/templates/ceph-secret.yaml.j2 | 24 ----------- .../templates/ceph-storageclass.yaml.j2 | 37 ----------------- caas-kubernetes.spec | 4 +- 9 files changed, 1 insertion(+), 236 deletions(-) delete mode 100644 ansible/playbooks/kubernetes_ceph.yaml delete mode 100644 ansible/roles/kubernetes_ceph/defaults/main.yaml delete mode 100644 ansible/roles/kubernetes_ceph/meta/main.yaml delete mode 100644 ansible/roles/kubernetes_ceph/tasks/create_ceph_auth_secret.yaml delete mode 100644 ansible/roles/kubernetes_ceph/tasks/create_ceph_storage_class.yaml delete mode 100644 ansible/roles/kubernetes_ceph/tasks/main.yaml delete mode 100644 ansible/roles/kubernetes_ceph/templates/ceph-secret.yaml.j2 delete mode 100644 ansible/roles/kubernetes_ceph/templates/ceph-storageclass.yaml.j2 diff --git a/ansible/playbooks/kubernetes_ceph.yaml b/ansible/playbooks/kubernetes_ceph.yaml deleted file mode 100644 index f25d1e7..0000000 --- a/ansible/playbooks/kubernetes_ceph.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# 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. - -# cmframework.requires: kubedns.yaml -- hosts: caas_master - strategy: free - become: true - become_user: "{{ users.admin_user_name }}" - roles: - - role: kubernetes_ceph - when: (ceph_configured | default(False)) diff --git a/ansible/roles/kubernetes_ceph/defaults/main.yaml b/ansible/roles/kubernetes_ceph/defaults/main.yaml deleted file mode 100644 index c25df46..0000000 --- a/ansible/roles/kubernetes_ceph/defaults/main.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# 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. - -auth_tokens: - - name: admin - secret_name: ceph-admin - namespace: kube-system - - name: caas - secret_name: ceph-user - namespace: kube-system - - name: caas - secret_name: ceph-user - namespace: default diff --git a/ansible/roles/kubernetes_ceph/meta/main.yaml b/ansible/roles/kubernetes_ceph/meta/main.yaml deleted file mode 100644 index bc8f123..0000000 --- a/ansible/roles/kubernetes_ceph/meta/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# 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. - -dependencies: - - role: manifests diff --git a/ansible/roles/kubernetes_ceph/tasks/create_ceph_auth_secret.yaml b/ansible/roles/kubernetes_ceph/tasks/create_ceph_auth_secret.yaml deleted file mode 100644 index 74314af..0000000 --- a/ansible/roles/kubernetes_ceph/tasks/create_ceph_auth_secret.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# 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: get auth token - become: true - become_user: root - shell: "ceph auth -f json get client.{{ token.name }}" - register: get_auth_token - - - name: extract auth token - set_fact: - ceph_auth_token: "{{ get_auth_token.stdout | from_json | map(attribute='key') | first }}" - - - name: template secret manifest - template: - src: ceph-secret.yaml.j2 - dest: "{{ caas.manifests_directory }}/ceph-{{ token.name }}-secret.yaml" - vars: - name: "{{ token.name }}" - namespace: "{{ token.namespace }}" - - - name: create ceph-{{ token.name }} secret - kubectl: - manifest: "{{ caas.manifests_directory }}/ceph-{{ token.name }}-secret.yaml" - state: present - when: ( nodename | search("caas_master1") ) diff --git a/ansible/roles/kubernetes_ceph/tasks/create_ceph_storage_class.yaml b/ansible/roles/kubernetes_ceph/tasks/create_ceph_storage_class.yaml deleted file mode 100644 index 808050c..0000000 --- a/ansible/roles/kubernetes_ceph/tasks/create_ceph_storage_class.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# 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: get ceph mons - become: true - become_user: root - shell: "ceph mon dump -f json" - register: get_ceph_mons - - - name: parse mons command output - set_fact: - ceph_mons_dump: "{{ get_ceph_mons.stdout | from_json }}" - - name: assemble mons list string - set_fact: - ceph_mons_list: "{{ ceph_mons_dump.mons | map(attribute='addr') | join(',')}}" - - - name: get auth tokens - set_fact: - ceph_admin_token: "{{ auth_tokens | selectattr('name', 'search', 'admin') | first }}" - ceph_user_token: "{{ auth_tokens | selectattr('name', 'search', 'caas') | first }}" - - - name: template storage class manifets - template: - src: ceph-storageclass.yaml.j2 - dest: "{{ caas.manifests_directory }}/ceph-storageclass.yaml" - vars: - name: ceph-storage-class - pool: caas - - - name: create kubernetes storage class - kubectl: - manifest: "{{ caas.manifests_directory }}/ceph-storageclass.yaml" - state: present - when: ( nodename | search("caas_master1") ) diff --git a/ansible/roles/kubernetes_ceph/tasks/main.yaml b/ansible/roles/kubernetes_ceph/tasks/main.yaml deleted file mode 100644 index d048c16..0000000 --- a/ansible/roles/kubernetes_ceph/tasks/main.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -# Copyright 2019 Nokia -# -# 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: create kubernetes secret for Ceph auth tokens - include_tasks: create_ceph_auth_secret.yaml - with_items: "{{ auth_tokens }}" - loop_control: - loop_var: token - - - name: create kubernetes storage class - import_tasks: create_ceph_storage_class.yaml diff --git a/ansible/roles/kubernetes_ceph/templates/ceph-secret.yaml.j2 b/ansible/roles/kubernetes_ceph/templates/ceph-secret.yaml.j2 deleted file mode 100644 index c831bfd..0000000 --- a/ansible/roles/kubernetes_ceph/templates/ceph-secret.yaml.j2 +++ /dev/null @@ -1,24 +0,0 @@ -{# -Copyright 2019 Nokia - -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. -#} ---- -apiVersion: v1 -kind: Secret -metadata: - name: ceph-{{ name }} - namespace: {{ namespace }} -type: kubernetes.io/rbd -data: - key: {{ ceph_auth_token | b64encode }} diff --git a/ansible/roles/kubernetes_ceph/templates/ceph-storageclass.yaml.j2 b/ansible/roles/kubernetes_ceph/templates/ceph-storageclass.yaml.j2 deleted file mode 100644 index d698873..0000000 --- a/ansible/roles/kubernetes_ceph/templates/ceph-storageclass.yaml.j2 +++ /dev/null @@ -1,37 +0,0 @@ -{# -Copyright 2019 Nokia - -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. -#} ---- -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - annotations: - storageclass.kubernetes.io/is-default-class: "true" - name: "{{ name }}" -provisioner: kubernetes.io/rbd -parameters: - monitors: "{{ ceph_mons_list }}" - adminId: "{{ ceph_admin_token.name }}" - adminSecretName: "ceph-{{ ceph_admin_token.name }}" - adminSecretNamespace: "{{ ceph_admin_token.namespace }}" - pool: "{{ pool }}" - userId: "{{ ceph_user_token.name }}" - userSecretName: "ceph-{{ ceph_user_token.name }}" - fsType: ext4 - imageFormat: "2" - imageFeatures: "layering" -reclaimPolicy: Retain -mountOptions: - - debug diff --git a/caas-kubernetes.spec b/caas-kubernetes.spec index 98a2088..bcb42df 100644 --- a/caas-kubernetes.spec +++ b/caas-kubernetes.spec @@ -15,7 +15,7 @@ %define COMPONENT kubernetes %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 1.16.2 -%define RPM_MINOR_VERSION 2 +%define RPM_MINOR_VERSION 3 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} %define KUBERNETESPAUSE_VERSION 3.1 @@ -158,7 +158,6 @@ ln -s %{_playbooks_path}/kube_secret_key_creation.yaml %{_postconfig_path}/ ln -s %{_playbooks_path}/kube_secret_key_distribution.yaml %{_postconfig_path}/ ln -s %{_playbooks_path}/kube_token_creation.yaml %{_postconfig_path}/ ln -s %{_playbooks_path}/kube_token_distribution.yaml %{_postconfig_path}/ -ln -s %{_playbooks_path}/kubernetes_ceph.yaml %{_postconfig_path}/ ln -s %{_playbooks_path}/master_kube_proxy.yaml %{_postconfig_path}/ ln -s %{_playbooks_path}/master_kubelet.yaml %{_postconfig_path}/ ln -s %{_playbooks_path}/service_account_creation.yaml %{_postconfig_path}/ @@ -174,7 +173,6 @@ if [ $1 -eq 0 ]; then rm -f %{_postconfig_path}/kube_secret_key_distribution.yaml rm -f %{_postconfig_path}/kube_token_creation.yaml rm -f %{_postconfig_path}/kube_token_distribution.yaml - rm -f %{_postconfig_path}/kubernetes_ceph.yaml rm -f %{_postconfig_path}/master_kube_proxy.yaml rm -f %{_postconfig_path}/master_kubelet.yaml rm -f %{_postconfig_path}/service_account_creation.yaml -- 2.16.6