Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod priority #995

Merged
merged 21 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ openshift-lagoon-setup:
oc -n lagoon policy add-role-to-user admin -z openshiftbuilddeploy; \
oc -n lagoon create -f openshift-setup/clusterrole-openshiftbuilddeploy.yaml; \
oc -n lagoon adm policy add-cluster-role-to-user openshiftbuilddeploy -z openshiftbuilddeploy; \
oc -n lagoon create -f openshift-setup/priorityclasses.yaml; \
oc -n lagoon create -f openshift-setup/shared-resource-viewer.yaml; \
oc -n lagoon create -f openshift-setup/policybinding.yaml | oc -n lagoon create -f openshift-setup/rolebinding.yaml; \
oc -n lagoon create serviceaccount docker-host; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -98,6 +100,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
envFrom:
- configMapRef:
name: lagoon-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -81,6 +84,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
envFrom:
- configMapRef:
name: lagoon-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ parameters:
value: ""
- name: ENVIRONMENT_TYPE
description: Which environment type this project is
value: development
- name: ROUTE
description: The main route of this project
value: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ parameters:
- name: PERSISTENT_STORAGE_SIZE
description: Size of the Storage to request
value: "5Gi"
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -77,6 +80,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 3306
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ objects:
selector:
service: ${SERVICE_NAME}
status:
loadBalancer: {}
loadBalancer: {}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ""
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -72,6 +75,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 27017
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -98,6 +101,7 @@ objects:
containers:
- image: ${NGINX_SERVICE_IMAGE}
name: ${NGINX_SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8080
protocol: TCP
Expand Down Expand Up @@ -133,6 +137,7 @@ objects:
memory: 10Mi
- image: ${PHP_SERVICE_IMAGE}
name: ${PHP_SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 9000
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ parameters:
- name: ROUTES_INSECURE
description: Setting of insecure Routes
value: Allow
- name: ENVIRONMENT_TYPE
description: production level of this environment
objects:
- apiVersion: v1
kind: Route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -104,6 +107,7 @@ objects:
containers:
- image: ${NGINX_SERVICE_IMAGE}
name: ${NGINX_SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8080
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -85,6 +88,7 @@ objects:
containers:
- image: ${NGINX_SERVICE_IMAGE}
name: ${NGINX_SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8080
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand All @@ -51,6 +54,7 @@ objects:
project: ${SAFE_PROJECT}
name: ${SERVICE_NAME}
spec:

replicas: 1
selector:
service: ${SERVICE_NAME}
Expand All @@ -76,6 +80,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8080
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -89,6 +92,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 3000
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -76,6 +79,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 3000
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ""
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -71,6 +74,7 @@ objects:
containers:
- image: ${POSTGRES_SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 5432
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ""
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand All @@ -66,6 +69,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 15672
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ parameters:
- name: PERSISTENT_STORAGE_SIZE
description: Size of the Storage to request
value: "1Gi"
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -80,6 +83,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 6379
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ""
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -67,6 +70,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 6379
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ parameters:
- name: PERSISTENT_STORAGE_SIZE
description: Size of the Storage to request
value: "1Gi"
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -74,6 +77,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8149
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -80,6 +83,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8080
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ parameters:
- name: CRONJOBS
description: Oneliner of Cronjobs
value: ''
- name: ENVIRONMENT_TYPE
description: production level of this environment
required: true
objects:
- apiVersion: v1
kind: DeploymentConfig
Expand Down Expand Up @@ -76,6 +79,7 @@ objects:
containers:
- image: ${SERVICE_IMAGE}
name: ${SERVICE_NAME}
priorityClassName: lagoon-priority-${ENVIRONMENT_TYPE}
ports:
- containerPort: 8080
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ else
fi

# Inject Pullable Images into Template
TEMPLATE_IMAGES_PARAMETERS=()
TEMPLATE_ADDITIONAL_PARAMETERS=()
# First check if we need multiple Images in this Template (check for `_SERVICE_IMAGE` - see underline)
if [[ $(oc process --local -f ${OPENSHIFT_TEMPLATE} --parameters | grep _SERVICE_IMAGE) ]]; then
while read line
Expand All @@ -20,13 +20,17 @@ if [[ $(oc process --local -f ${OPENSHIFT_TEMPLATE} --parameters | grep _SERVICE
# Load the Image Hash of the loaded Image
DEPLOYMENT_SERVICETYPE_IMAGE_NAME_HASH="${IMAGE_HASHES[${DEPLOYMENT_SERVICETYPE_IMAGE_NAME}]}"
# Add the Image Hash as Parameter of "[SERVICETYPE]_SERVICE_IMAGE"
TEMPLATE_IMAGES_PARAMETERS+=(-p "${line}=${DEPLOYMENT_SERVICETYPE_IMAGE_NAME_HASH}")
TEMPLATE_ADDITIONAL_PARAMETERS+=(-p "${line}=${DEPLOYMENT_SERVICETYPE_IMAGE_NAME_HASH}")
done < <(oc process --local -f ${OPENSHIFT_TEMPLATE} --parameters | grep _SERVICE_IMAGE | awk '{ print $1 }')
# check if we need a single image to inject
elif [[ $(oc process --local -f ${OPENSHIFT_TEMPLATE} --parameters | grep SERVICE_IMAGE) ]]; then
SERVICE_NAME_IMAGE="${MAP_SERVICE_NAME_TO_IMAGENAME[${SERVICE_NAME}]}"
SERVICE_NAME_IMAGE_HASH="${IMAGE_HASHES[${SERVICE_NAME_IMAGE}]}"
TEMPLATE_IMAGES_PARAMETERS+=(-p "SERVICE_IMAGE=${SERVICE_NAME_IMAGE_HASH}")
TEMPLATE_ADDITIONAL_PARAMETERS+=(-p "SERVICE_IMAGE=${SERVICE_NAME_IMAGE_HASH}")
fi

if [[ $(oc process --local -f ${OPENSHIFT_TEMPLATE} --parameters | grep ENVIRONMENT_TYPE) ]]; then
TEMPLATE_ADDITIONAL_PARAMETERS+=(-p "ENVIRONMENT_TYPE=${ENVIRONMENT_TYPE}")
fi

oc process --local -o yaml --insecure-skip-tls-verify \
Expand All @@ -42,5 +46,5 @@ oc process --local -o yaml --insecure-skip-tls-verify \
-p REGISTRY="${OPENSHIFT_REGISTRY}" \
-p OPENSHIFT_PROJECT=${OPENSHIFT_PROJECT} \
"${TEMPLATE_PARAMETERS[@]}" \
"${TEMPLATE_IMAGES_PARAMETERS[@]}" \
"${TEMPLATE_ADDITIONAL_PARAMETERS[@]}" \
| outputToYaml
Loading