Skip to content

Instantly share code, notes, and snippets.

@vrutkovs
Created July 14, 2021 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrutkovs/1199226040a1942fdbcbe5fa76ab4467 to your computer and use it in GitHub Desktop.
Save vrutkovs/1199226040a1942fdbcbe5fa76ab4467 to your computer and use it in GitHub Desktop.
kind: Project
apiVersion: project.openshift.io/v1
metadata:
name: sample-workloads
labels:
kubernetes.io/metadata.name: sample-workloads
spec:
finalizers:
- kubernetes
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
annotations:
description: Keeps track of changes in the application image
name: django-psql-persistent
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
spec:
lookupPolicy:
local: false
---
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
annotations:
description: Defines how to build the application
template.alpha.openshift.io/wait-for-ready: 'true'
name: django-psql-persistent
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
spec:
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: 'django-psql-persistent:latest'
resources: {}
successfulBuildsHistoryLimit: 5
failedBuildsHistoryLimit: 5
strategy:
type: Source
sourceStrategy:
from:
kind: ImageStreamTag
namespace: openshift
name: 'python:3.8-ubi8'
env:
- name: PIP_INDEX_URL
postCommit:
script: ./manage.py test
source:
type: Git
git:
uri: 'https://github.com/sclorg/django-ex.git'
triggers:
- type: ImageChange
- type: ConfigChange
- type: GitHub
github:
secret: djiF8CTdur25NWOCR4oKEysttn8aRdstJ7vGkPs8
runPolicy: Serial
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgresql
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
---
kind: Secret
apiVersion: v1
metadata:
name: django-psql-persistent
namespace: sample-workloads
data:
database-password: cG9zdGdyZXNxbA==
database-user: cG9zdGdyZXNxbA==
django-secret-key: Zm9vYmFy
type: Opaque
---
kind: DeploymentConfig
apiVersion: apps.openshift.io/v1
metadata:
annotations:
description: Defines how to deploy the database
template.alpha.openshift.io/wait-for-ready: 'true'
name: postgresql
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
spec:
strategy:
type: Recreate
resources: {}
activeDeadlineSeconds: 21600
recreateParams:
timeoutSeconds: 600
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- postgresql
from:
kind: ImageStreamTag
name: 'postgresql:12-el8'
namespace: openshift
- type: ConfigChange
replicas: 1
revisionHistoryLimit: 10
test: false
selector:
name: postgresql
template:
metadata:
name: postgresql
creationTimestamp: null
labels:
name: postgresql
spec:
volumes:
- name: postgresql-data
persistentVolumeClaim:
claimName: postgresql
containers:
- resources:
limits:
memory: 512Mi
readinessProbe:
exec:
command:
- /usr/libexec/check-container
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
terminationMessagePath: /dev/termination-log
name: postgresql
livenessProbe:
exec:
command:
- /usr/libexec/check-container
- '--live'
initialDelaySeconds: 120
timeoutSeconds: 10
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
env:
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: django-psql-persistent
key: database-user
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: django-psql-persistent
key: database-password
- name: POSTGRESQL_DATABASE
value: default
ports:
- containerPort: 5432
protocol: TCP
imagePullPolicy: IfNotPresent
volumeMounts:
- name: postgresql-data
mountPath: /var/lib/pgsql/data
terminationMessagePolicy: File
image: ''
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
imagePullSecrets: []
paused: false
---
kind: DeploymentConfig
apiVersion: apps.openshift.io/v1
metadata:
annotations:
description: Defines how to deploy the application server
template.alpha.openshift.io/wait-for-ready: 'true'
name: django-psql-persistent
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
spec:
strategy:
type: Recreate
recreateParams:
timeoutSeconds: 600
resources: {}
activeDeadlineSeconds: 21600
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- django-psql-persistent
from:
kind: ImageStreamTag
namespace: sample-workloads
name: 'django-psql-persistent:latest'
- type: ConfigChange
replicas: 1
revisionHistoryLimit: 10
test: false
selector:
name: django-psql-persistent
template:
metadata:
name: django-psql-persistent
creationTimestamp: null
labels:
name: django-psql-persistent
spec:
containers:
- resources:
limits:
memory: 512Mi
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 3
timeoutSeconds: 3
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
terminationMessagePath: /dev/termination-log
name: django-psql-persistent
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 3
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
env:
- name: DATABASE_SERVICE_NAME
value: postgresql
- name: DATABASE_ENGINE
value: postgresql
- name: DATABASE_NAME
value: default
- name: DATABASE_USER
valueFrom:
secretKeyRef:
name: django-psql-persistent
key: database-user
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: django-psql-persistent
key: database-password
- name: APP_CONFIG
- name: DJANGO_SECRET_KEY
valueFrom:
secretKeyRef:
name: django-psql-persistent
key: django-secret-key
ports:
- containerPort: 8080
protocol: TCP
imagePullPolicy: IfNotPresent
terminationMessagePolicy: File
image: ' '
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
---
kind: Service
apiVersion: v1
metadata:
name: postgresql
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
annotations:
description: Exposes the database server
spec:
ports:
- name: postgresql
protocol: TCP
port: 5432
targetPort: 5432
selector:
name: postgresql
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
---
kind: Service
apiVersion: v1
metadata:
name: django-psql-persistent
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
annotations:
description: Exposes and load balances the application pods
service.alpha.openshift.io/dependencies: '[{"name": "postgresql", "kind": "Service"}]'
spec:
ports:
- name: web
protocol: TCP
port: 8080
targetPort: 8080
selector:
name: django-psql-persistent
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: django-psql-persistent
namespace: sample-workloads
labels:
app: django-psql-persistent
template: django-psql-persistent
spec:
to:
kind: Service
name: django-psql-persistent
weight: 100
wildcardPolicy: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment