diff --git a/buildchain/buildchain/salt_tree.py b/buildchain/buildchain/salt_tree.py index cb768ddad9..1e1c6bf9fa 100644 --- a/buildchain/buildchain/salt_tree.py +++ b/buildchain/buildchain/salt_tree.py @@ -409,6 +409,10 @@ def task(self) -> types.TaskDict: }, ), Path("salt/metalk8s/addons/ui/post-upgrade.sls"), + Path("salt/metalk8s/addons/ui-operator/deployed/init.sls"), + Path("salt/metalk8s/addons/ui-operator/deployed/manifests.sls"), + Path("salt/metalk8s/addons/ui-operator/deployed/namespace.sls"), + Path("salt/metalk8s/addons/ui-operator/post-upgrade.sls"), Path("salt/metalk8s/addons/solutions/deployed/configmap.sls"), Path("salt/metalk8s/addons/solutions/deployed/init.sls"), Path("salt/metalk8s/addons/solutions/deployed/namespace.sls"), diff --git a/salt/metalk8s/addons/ui-operator/deployed/init.sls b/salt/metalk8s/addons/ui-operator/deployed/init.sls new file mode 100644 index 0000000000..9fe0ebbd46 --- /dev/null +++ b/salt/metalk8s/addons/ui-operator/deployed/init.sls @@ -0,0 +1,14 @@ +include: + - .manifests + +Wait for the UI Operator to be Ready: + test.configurable_test_state: + - changes: False + - result: __slot__:salt:metalk8s_kubernetes.check_object_ready( + apiVersion=apps/v1, kind=Deployment, + name=ui-operator, namespace=metalk8s-ui) + - comment: Wait for the UI Operator to be Ready + - retry: + attempts: 30 + - require: + - sls: metalk8s.addons.ui-operator.deployed.manifests diff --git a/salt/metalk8s/addons/ui-operator/deployed/manifests.sls b/salt/metalk8s/addons/ui-operator/deployed/manifests.sls new file mode 100644 index 0000000000..856f38829c --- /dev/null +++ b/salt/metalk8s/addons/ui-operator/deployed/manifests.sls @@ -0,0 +1,69 @@ +{%- from "metalk8s/repo/macro.sls" import build_image_name with context %} + +include: + - .namespace + +{%- set ui_operator_image = build_image_name('ui-operator') %} + +Deploy UI Operator: + metalk8s_kubernetes.object_present: + - manifest: + apiVersion: apps/v1 + kind: Deployment + metadata: + name: ui-operator + namespace: metalk8s-ui + labels: + app.kubernetes.io/name: ui-operator + app.kubernetes.io/managed-by: salt + app.kubernetes.io/part-of: metalk8s + spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: ui-operator + template: + metadata: + labels: + app.kubernetes.io/name: ui-operator + spec: + containers: + - name: ui-operator + image: {{ ui_operator_image }} + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + ports: + - containerPort: 8081 + name: health + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: + requests: + cpu: "10m" + memory: "64Mi" + limits: + cpu: "500m" + memory: "128Mi" + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + securityContext: + runAsNonRoot: true + terminationGracePeriodSeconds: 10 + - require: + - sls: metalk8s.addons.ui-operator.deployed.namespace \ No newline at end of file diff --git a/salt/metalk8s/addons/ui-operator/deployed/namespace.sls b/salt/metalk8s/addons/ui-operator/deployed/namespace.sls new file mode 100644 index 0000000000..52da9e1f0d --- /dev/null +++ b/salt/metalk8s/addons/ui-operator/deployed/namespace.sls @@ -0,0 +1,11 @@ +Create UI Operator Namespace: + metalk8s_kubernetes.object_present: + - manifest: + apiVersion: v1 + kind: Namespace + metadata: + name: metalk8s-ui + labels: + app.kubernetes.io/managed-by: salt + app.kubernetes.io/part-of: metalk8s + heritage: metalk8s diff --git a/salt/metalk8s/addons/ui-operator/post-upgrade.sls b/salt/metalk8s/addons/ui-operator/post-upgrade.sls new file mode 100644 index 0000000000..2f67e35f50 --- /dev/null +++ b/salt/metalk8s/addons/ui-operator/post-upgrade.sls @@ -0,0 +1,2 @@ +include: + - .deployed