Pārlūkot izejas kodu

replace python-app with exoplanets

Grega Bremec 7 mēneši atpakaļ
vecāks
revīzija
3fdb292ace

+ 197 - 0
labs/monitoring/alerts/exoplanets.yaml

@@ -0,0 +1,197 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+  labels:
+    app: exoplanets-db
+  name: exoplanets-db
+spec:
+  progressDeadlineSeconds: 600
+  replicas: 1
+  revisionHistoryLimit: 10
+  selector:
+    matchLabels:
+      app: exoplanets-db
+  strategy:
+    rollingUpdate:
+      maxSurge: 25%
+      maxUnavailable: 25%
+    type: RollingUpdate
+  template:
+    metadata:
+      labels:
+        app: exoplanets-db
+    spec:
+      containers:
+      - env:
+        - name: POSTGRESQL_ADMIN_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_ADMIN_PASSWORD
+              name: exoplanets
+        - name: POSTGRESQL_DATABASE
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_DATABASE
+              name: exoplanets
+        - name: POSTGRESQL_MAX_CONNECTIONS
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_MAX_CONNECTIONS
+              name: exoplanets
+        - name: POSTGRESQL_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_PASSWORD
+              name: exoplanets
+        - name: POSTGRESQL_USER
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_USER
+              name: exoplanets
+        image: registry.ocp4.example.com:8443/rhel9/postgresql-13
+        imagePullPolicy: IfNotPresent
+        name: postgresql-13
+        ports:
+        - containerPort: 5432
+          protocol: TCP
+        resources:
+          requests:
+            cpu: 25m
+            memory: 50Mi
+          limits:
+            cpu: 100m
+            memory: 250Mi
+        terminationMessagePath: /dev/termination-log
+        terminationMessagePolicy: File
+      dnsPolicy: ClusterFirst
+      restartPolicy: Always
+      schedulerName: default-scheduler
+      securityContext: {}
+      terminationGracePeriodSeconds: 30
+
+---
+apiVersion: v1
+data:
+  POSTGRESQL_ADMIN_PASSWORD: cG9zdGdyZXM=
+  POSTGRESQL_DATABASE: ZGF0YWJhc2U=
+  POSTGRESQL_MAX_CONNECTIONS: MTAwMA==
+  POSTGRESQL_PASSWORD: cGFzc3dvcmQ=
+  POSTGRESQL_USER: dXNlcg==
+kind: Secret
+metadata:
+  name: exoplanets
+type: Opaque
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: exoplanets-db
+  name: exoplanets-db
+spec:
+  ports:
+  - port: 5432
+    protocol: TCP
+    targetPort: 5432
+  selector:
+    app: exoplanets-db
+status:
+  loadBalancer: {}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+  labels:
+    app: exoplanets-app
+  name: exoplanets-app
+spec:
+  progressDeadlineSeconds: 600
+  replicas: 1
+  revisionHistoryLimit: 10
+  selector:
+    matchLabels:
+      app: exoplanets-app
+  strategy:
+    rollingUpdate:
+      maxSurge: 25%
+      maxUnavailable: 25%
+    type: RollingUpdate
+  template:
+    metadata:
+      labels:
+        app: exoplanets-app
+    spec:
+      containers:
+      - env:
+        - name: DB_PORT
+          value: '5432'
+        - name: DB_HOST
+          value: exoplanets-db
+        - name: DB_NAME
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_DATABASE
+              name: exoplanets
+        - name: DB_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_PASSWORD
+              name: exoplanets
+        - name: DB_USER
+          valueFrom:
+            secretKeyRef:
+              key: POSTGRESQL_USER
+              name: exoplanets
+        image: registry.ocp4.example.com:8443/redhattraining/exoplanets:v1.0
+        imagePullPolicy: IfNotPresent
+        name: exoplanets
+        ports:
+        - containerPort: 5432
+          protocol: TCP
+        resources:
+          requests:
+            cpu: 25m
+            memory: 50Mi
+          limits:
+            cpu:  100m
+            memory: 250Mi
+        terminationMessagePath: /dev/termination-log
+        terminationMessagePolicy: File
+      dnsPolicy: ClusterFirst
+      restartPolicy: Always
+      schedulerName: default-scheduler
+      terminationGracePeriodSeconds: 30
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: exoplanets-app
+  name: exoplanets-app
+spec:
+  ports:
+  - port: 8080
+    protocol: TCP
+    targetPort: 8080
+  selector:
+    app: exoplanets-app
+
+---
+apiVersion: route.openshift.io/v1
+kind: Route
+metadata:
+  labels:
+    app: exoplanets-app
+  name: exoplanets
+spec:
+  host: exoplanets-alerts.apps.ocp4.example.com
+  port:
+    targetPort: 8080
+  to:
+    kind: ''
+    name: exoplanets-app

+ 0 - 26
labs/monitoring/alerts/python-app.yaml

@@ -1,26 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  creationTimestamp: null
-  labels:
-    app: python-app
-  name: python-app
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: python-app
-  strategy: {}
-  template:
-    metadata:
-      creationTimestamp: null
-      labels:
-        app: python-app
-    spec:
-      containers:
-      - image: registry.ocp4.example.com:8443/redhattraining/python-load:v0.1
-        name: python-app
-        resources:
-          requests:
-              cpu: 100m
-              memory: 50Mi