infra_config_profile_create_edit_schema,
app_profile_create_edit_schema,
resource_profile_create_edit_schema,
- k8scluster_new_schema,
+ # k8scluster_new_schema,
+ clusterregistration_new_schema,
attach_dettach_profile_schema,
ksu_schema,
oka_schema,
"k8s_version": cls_request["k8s_version"],
"node_size": cls_request["node_size"],
"node_count": cls_request["node_count"],
- "description": cls_request["description"],
+ "bootstrap": cls_request["bootstrap"],
"region_name": region_name,
"resource_group": resource_group,
"infra_controller_profiles": [
"git_name": self.create_gitname(cls_request, session),
"resourceState": "IN_PROGRESS.REQUEST_RECEIVED",
}
+ # Add optional fields if they exist in the request
+ if "description" in cls_request:
+ cls_desc["description"] = cls_request["description"]
return cls_desc
def check_vim(self, session, name):
class K8saddTopic(BaseTopic):
topic = "clusters"
topic_msg = "cluster"
- schema_new = k8scluster_new_schema
+ schema_new = clusterregistration_new_schema
def __init__(self, db, fs, msg, auth):
BaseTopic.__init__(self, db, fs, msg, auth)
operation_params = cls_add_request
step = "filling cluster details from input data"
- cls_add = self._add_cluster(cls_add_request, session)
+ cls_add_request = self._add_cluster(cls_add_request, session)
- step = "creating cluster at database"
+ step = "registering the cluster at database"
self.format_on_new(
- cls_add, session["project_id"], make_public=session["public"]
+ cls_add_request, session["project_id"], make_public=session["public"]
)
- cls_add["current_operation"] = None
+ cls_add_request["current_operation"] = None
op_id = self.format_on_operation(
- cls_add,
+ cls_add_request,
"register",
operation_params,
)
- _id = self.db.create(self.topic, cls_add)
+ _id = self.db.create(self.topic, cls_add_request)
pubkey, privkey = self._generate_age_key()
- cls_add["age_pubkey"] = self.db.encrypt(
+ cls_add_request["age_pubkey"] = self.db.encrypt(
pubkey, schema_version="1.11", salt=_id
)
- cls_add["age_privkey"] = self.db.encrypt(
+ cls_add_request["age_privkey"] = self.db.encrypt(
privkey, schema_version="1.11", salt=_id
)
# TODO: set age_pubkey and age_privkey in the default profiles
- self.db.set_one(self.topic, {"_id": _id}, cls_add)
+ self.db.set_one(self.topic, {"_id": _id}, cls_add_request)
rollback.append({"topic": self.topic, "_id": _id})
self._send_msg("register", {"cluster_id": _id, "operation_id": op_id})
return _id, None
def _add_cluster(self, cls_add_request, session):
cls_add = {
"name": cls_add_request["name"],
- "description": cls_add_request["description"],
"credentials": cls_add_request["credentials"],
"vim_account": cls_add_request["vim_account"],
- "k8s_version": cls_add_request["k8s_version"],
- "nets": cls_add_request["nets"],
+ "bootstrap": cls_add_request["bootstrap"],
"created": "false",
"state": "IN_CREATION",
"operatingState": "PROCESSING",
"git_name": self.create_gitname(cls_add_request, session),
"resourceState": "IN_PROGRESS.REQUEST_RECEIVED",
}
+ # Add optional fields if they exist in the request
+ if "description" in cls_add_request:
+ cls_add["description"] = cls_add_request["description"]
return cls_add
def remove(self, session, _id, dry_run=False, not_send_msg=None):
"k8s_version": string_schema,
"node_size": string_schema,
"node_count": integer0_schema,
- "description": string_schema,
+ "description": description_schema,
"region_name": string_schema,
"resource_group": string_schema,
"infra_controller_profiles": shortname_schema,
"infra_config_profiles": shortname_schema,
"resource_profiles": shortname_schema,
"app_profiles": shortname_schema,
+ "created": string_schema,
+ "state": string_schema,
+ "operatingState": string_schema,
+ "git_name": string_schema,
+ "resourceState": string_schema,
+ "bootstrap": bool_schema,
},
"required": [
"name",
"k8s_version",
"node_size",
"node_count",
- "description",
],
"additionalProperties": False,
}
+clusterregistration_new_schema = {
+ "title": "cluster registration input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "schema_version": schema_version,
+ "schema_type": schema_type,
+ "name": name_schema,
+ "description": description_schema,
+ "credentials": object_schema,
+ "vim_account": string_schema,
+ "bootstrap": bool_schema,
+ },
+ "required": ["name", "credentials", "vim_account"],
+ "additionalProperties": False,
+}
infra_controller_profile_create_new_schema = {
"title": "infra profile creation operation input schema",