Skip to content
Snippets Groups Projects
Verified Commit c6aa2be2 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

adding and removing functions as result of merge conflict

parent 8eb8d83b
No related branches found
No related tags found
1 merge request!55Resolve "Merge dashboard and dashboard-backend repos"
......@@ -21,14 +21,6 @@ CONFIG_DATA = [
}
]
APPS_DATA = [
{"id": 1, "name": "Nextcloud", "enabled": True, "status": "ON for everyone"},
{"id": 2, "name": "Rocketchat", "enabled": True, "status": "ON for everyone"},
{"id": 3, "name": "Wordpress", "enabled": False, "status": "ON for everyone"}
]
APP_DATA = {"id": 1, "name": "Nextcloud", "selected": True, "status": "ON for everyone", "config": CONFIG_DATA},
@api_v1.route('/apps', methods=['GET'])
@jwt_required()
@cross_origin()
......
......@@ -172,26 +172,6 @@ class App(db.Model):
"""Returns the kustomization object for this app"""
return k8s.get_kustomization(self.slug)
@staticmethod
def check_condition(status):
"""
Returns a tuple that has true/false for readiness and a message
Ready, in this case means that the condition's type == "Ready" and its
status == "True". If the condition type "Ready" does not occur, the
status is interpreted as not ready.
The message that is returned is the message that comes with the
condition with type "Ready"
:param status: Kubernetes resource's "status" object.
:type status: dict
"""
for condition in status["conditions"]:
if condition["type"] == "Ready":
return condition["status"] == "True", condition["message"]
return False, "Condition with type 'Ready' not found"
def to_json(self):
"""
represent this object as a json object. Return JSON object
......
......@@ -114,6 +114,29 @@ def get_kubernetes_secret_data(secret_name, namespace):
return secret
def get_kubernetes_config_map_data(config_map_name, namespace):
"""
Get ConfigMap from Kubernetes
:param config_map_name: Name of the ConfigMap
:type config_map_name: string
:param namespace: Namespace of the ConfigMap
:type namespace: string
:return: The contents of a kubernetes ConfigMap or None if the cm does not exist.
:rtype: dict or None
"""
api_instance = client.CoreV1Api()
try:
config_map = api_instance.read_namespaced_config_map(config_map_name, namespace).data
except ApiException as ex:
# 404 is expected when the optional secret does not exist.
if ex.status != 404:
raise ex
return None
return config_map
def store_kubernetes_secret(secret_dict, namespace, update=False):
"""
Stores either a new secret in the cluster, or updates an existing one.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment