diff --git a/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml b/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml index 32f25129ab..8bd386e276 100644 --- a/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml +++ b/kubernetes/helm-charts/rbd-provisioner/templates/pre-install-check-ceph.yaml @@ -178,4 +178,20 @@ spec: - name: config-volume-{{- $root.Values.global.name }} mountPath: {{ $mount }} {{- end }} -{{- end }} \ No newline at end of file +--- +# This ConfigMap is needed because we're not using ceph's helm chart +apiVersion: v1 +kind: ConfigMap +metadata: + name: ceph-etc + # This is the name of the openstack application's namespace + namespace: openstack +data: + ceph.conf: | + [global] + auth_supported = none + {{ $monitors := $defaults.monitors }}{{ range $index, $element := $monitors}} + [mon.{{- $index }}] + mon_addr = {{ $element }} + {{- end }} +{{- end }} diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py index 3b881510fe..4a86b79876 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py @@ -893,25 +893,43 @@ class AppOperator(object): if self._make_armada_request_with_monitor(app, constants.APP_DELETE_OP): if app.system_app: try: - p1 = subprocess.Popen(['kubectl', 'get', 'pods', '-n', - 'openstack'], - stdout=subprocess.PIPE) - p2 = subprocess.Popen(['awk', '/osh-.*-test/{print $1}'], + # TODO convert these kubectl commands to use the k8s api + p1 = subprocess.Popen( + ['kubectl', '--kubeconfig=/etc/kubernetes/admin.conf', + 'get', 'pvc', '--no-headers', '-n', 'openstack'], + stdout=subprocess.PIPE) + p2 = subprocess.Popen(['awk', '{print $3}'], stdin=p1.stdout, stdout=subprocess.PIPE) - p3 = subprocess.Popen(['xargs', '-i', 'kubectl', - 'delete', 'pods', '-n', 'openstack', - '{}'], stdin=p2.stdout, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + p3 = subprocess.Popen( + ['xargs', '-i', 'kubectl', + '--kubeconfig=/etc/kubernetes/admin.conf', 'delete', + 'pv', '{}', '--wait=false'], + stdin=p2.stdout, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + p1.stdout.close() p2.stdout.close() out, err = p3.communicate() if not err: - LOG.info("Old test pods cleanup completed.") + LOG.info("Persistent Volumes marked for deletion.") except Exception as e: - LOG.exception("Failed to clean up test pods after app " + LOG.exception("Failed to clean up PVs after app " "removal: %s" % e) + + try: + p1 = subprocess.Popen( + ['kubectl', '--kubeconfig=/etc/kubernetes/admin.conf', + 'delete', 'namespace', 'openstack'], + stdout=subprocess.PIPE) + out, err = p1.communicate() + if not err: + LOG.info("Openstack namespace delete completed.") + except Exception as e: + LOG.exception("Failed to clean up openstack namespace " + "after app removal: %s" % e) + self._update_app_status(app, constants.APP_UPLOAD_SUCCESS) LOG.info("Application (%s) remove completed." % app.name) else: