Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/openwhisk-standalone/standalone-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ data:
apiVersion: v1
kind: Pod
spec:
imagePullPolicy: Always
imagePullSecrets:
- name: registry-pull-secret

5 changes: 3 additions & 2 deletions deploy/registry/03-registry-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ spec:
selector:
app: registry
ports:
- protocol: TCP
- nodePort: 32000
protocol: TCP
port: 5000
targetPort: 5000
type: ClusterIP
type: NodePort
11 changes: 10 additions & 1 deletion nuvolaris/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,13 @@ def rollout(name, namespace="nuvolaris"):
try:
return kubectl("rollout", "restart", name, namespace=namespace)
except:
return None
return None

def detect_kind():
try:
is_kind = kubectl("get","node/nuvolaris-control-plane",
namespace=None,
jsonpath='{.metadata.labels.nuvolaris\\.io/kube}')
return is_kind and "kind" in is_kind
except:
return False
3 changes: 2 additions & 1 deletion nuvolaris/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def whisk_create(spec, name, **kwargs):
"static": "?", # Minio static endpoint provider
"zookeeper": "?", #Zookeeper configuration
"quota":"?", #Quota configuration
"etcd":"?" #Etcdd configuration
"etcd":"?", #Etcd configuration
"milvus":"?" #Milvus configuration
}

if cfg.get('components.minio') and cfg.get('components.seaweedfs'):
Expand Down
56 changes: 52 additions & 4 deletions nuvolaris/milvus_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,47 @@ def create_milvus_accounts(data: dict):
if cfg.get('components.seaweedfs'):
return create_seaweedfs_milvus_account(data)

def delete_minio_milvus_account(data: dict):
"""
Deletes technical accounts for MINIO
"""
try:
logging.info("removing milvus minio technical accounts.")
minioClient = mutil.MinioClient()
res = util.check(minioClient.remove_user(data["milvus_s3_username"]), "remove_user", True)
return util.check(minioClient.force_bucket_remove(data["milvus_bucket_name"]), "force_bucket_remove", res)

except Exception as ex:
logging.error("Could not delete milvus MINIO accounts", ex)
return False

def delete_seaweedfs_milvus_account(data: dict):
"""
Delete technical accounts for SEAWEEDFS
"""
try:
logging.info("removing milvus seaweedfs technical accounts.")
seaweedfsClient = SeaweedfsClient()
res = util.check(seaweedfsClient.delete_user(data["milvus_s3_username"]), "delete_user", True)
return util.check(seaweedfsClient.force_bucket_remove(data["milvus_bucket_name"]), "force_bucket_remove", res)

except Exception as ex:
logging.error("Could not delete milvus SEAWEEDFS accounts", ex)
return False

def delete_milvus_accounts(data: dict):
""""
Deletes technical accounts for ETCD and MINIO
"""
# currently we use the ETCD root password, so we skip the ETCD user deletion.

logging.info("removing milvus technical accounts.")
if cfg.get('components.minio'):
return delete_minio_milvus_account(data)

if cfg.get('components.seaweedfs'):
return delete_seaweedfs_milvus_account(data)


def create_default_milvus_database(data):
"""
Expand Down Expand Up @@ -258,9 +299,13 @@ def delete_ow_milvus(ucfg):
return res


def delete_by_owner():
spec = kus.build("milvus")
def delete_by_owner(data):
dir = "milvus"
if data['slim']:
dir += "-slim"
spec = kus.build(dir)
res = kube.delete(spec)

logging.info(f"delete milvus: {res}")
return res

Expand All @@ -274,10 +319,13 @@ def delete_by_spec():


def delete(owner=None):
data = util.get_milvus_config_data()
if owner:
return delete_by_owner()
res = delete_by_owner(data)
else:
return delete_by_spec()
res = delete_by_spec()

return delete_milvus_accounts(data)


def patch(status, action, owner=None):
Expand Down
8 changes: 7 additions & 1 deletion nuvolaris/registry_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ def create_internal_registry(data, owner=None):
kust += registrySecret.generateHtPasswordPatch()

#path the registry pull secret
registryPullSecret = ImagePullSecretData(data['registryUsername'],data['registryPassword'],data['repoHostname'])
repoInternalHost = data['repoHostname']
if kube.detect_kind():
# when repo is kind, the registry pull secret will point
# to the node port exposed on the node
repoInternalHost = "127.0.0.1:32000"

registryPullSecret = ImagePullSecretData(data['registryUsername'],data['registryPassword'],repoInternalHost)
registryPullSecret.with_secret_name("registry-pull-secret")
kust += registryPullSecret.generatePullSecretPatch()

Expand Down
2 changes: 1 addition & 1 deletion nuvolaris/secret_imagepull_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def render_template(self,namespace,tpl= "generic-secret-docker-tpl.yaml"):
uses the given template to render a final ImagePull secret template and returns the path to the template
"""
logging.info(f"*** Rendering ImagePull secret template with name {self._data['secret_name']} via template {tpl}")
out = f"/tmp/__{namespace}_{tpl}"
out = f"/tmp/__{namespace}_{self._data['secret_name']}_{tpl}"
file = ntp.spool_template(tpl, out, self._data)
return os.path.abspath(file)

Expand Down
11 changes: 5 additions & 6 deletions tests/kind/milvus_standalone_test.ipy
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ from nuvolaris.user_metadata import UserMetadata

#tu.enable_debug_logging()
### Initial cleanup
!kubectl -n nuvolaris delete all --all
!kubectl -n nuvolaris delete pvc --all
tu.run_proc("kubectl -n nuvolaris delete all --all")
tu.run_proc("kubectl -n nuvolaris delete pvc --all")


# test
assert(cfg.configure(tu.load_sample_config()))
Expand Down Expand Up @@ -94,7 +95,5 @@ assert(milvus.delete())
assert(etcd.delete())
assert(minio.delete())

# final cleanup
!kubectl -n nuvolaris delete all --all
# etcd pvc in particular
!kubectl -n nuvolaris delete pvc --all
tu.run_proc("kubectl -n nuvolaris delete all --all")
tu.run_proc("kubectl -n nuvolaris delete pvc --all")
Loading