adding and removing functions as result of merge conflict
This commit is contained in:
parent
8eb8d83bea
commit
c6aa2be273
3 changed files with 23 additions and 28 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue