- self.log.error("osm system cluster has not been properly initialized for helm connector, "
- "helm-chart id is not defined")
- raise N2VCException("osm system cluster has not been properly initialized for helm connector")
+ try:
+ # backward compatibility for existing clusters that have not been initialized for helm v3
+ cluster_id = db_k8cluster.get("_id")
+ k8s_credentials = yaml.safe_dump(db_k8cluster.get("credentials"))
+ k8s_hc_id, uninstall_sw = await self._k8sclusterhelm3.init_env(k8s_credentials,
+ reuse_cluster_uuid=cluster_id)
+ db_k8scluster_update = {"_admin.helm-chart-v3.error_msg": None,
+ "_admin.helm-chart-v3.id": k8s_hc_id,
+ "_admin.helm-chart-v3}.created": uninstall_sw,
+ "_admin.helm-chart-v3.operationalState": "ENABLED"}
+ self.update_db_2("k8sclusters", cluster_id, db_k8scluster_update)
+ except Exception as e:
+ self.log.error("error initializing helm-v3 cluster: {}".format(str(e)))
+ raise N2VCException("K8s system cluster '{}' has not been initialized for helm-chart-v3".format(
+ cluster_id))