Skip to content

Commit

Permalink
Merge pull request #152 from bcgov/i5okie/dc-deprecation
Browse files Browse the repository at this point in the history
Migrate DeploymentConfigs to Deployments
  • Loading branch information
i5okie authored Jan 28, 2025
2 parents 8309bb2 + ce291e6 commit 85575b0
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 283 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
*_DeploymentConfig.json
*_Deployment.json
*_BuildConfig.json
*.crt
*.key
Expand All @@ -12,4 +13,4 @@
# Visual Studio Code
.vscode
.idea/*
.vs
.vs
35 changes: 10 additions & 25 deletions openshift/templates/agent/agent-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ objects:
protocol: TCP
targetPort: ${{AGENT_WS_PORT}}
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}

- kind: Route
apiVersion: v1
Expand Down Expand Up @@ -202,8 +203,8 @@ objects:
admin-api-key: ${ADMIN_API_KEY}
type: Opaque

- kind: DeploymentConfig
apiVersion: v1
- kind: Deployment
apiVersion: apps/v1
metadata:
name: ${NAME}${SUFFIX}
labels:
Expand All @@ -213,17 +214,13 @@ objects:
app-group: ${APP_GROUP}
role: ${ROLE}
env: ${TAG_NAME}
annotations:
description: Defines how to deploy the application server
app.openshift.io/connects-to: >-
[{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${WALLET_HOST}${SUFFIX}"},
{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${API_HOST}${SUFFIX}"}]
spec:
replicas: 1
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}
strategy:
type: Rolling
type: RollingUpdate
template:
metadata:
name: ${NAME}${SUFFIX}
Expand Down Expand Up @@ -346,7 +343,7 @@ objects:
value: ${TAILS_FILES_DIR}
- name: TAILS_SERVER_BASE_URL
value: ${TAILS_SERVER_BASE_URL}
image:
image: image-registry.openshift-image-registry.svc:5000/${IMAGE_NAMESPACE}/${NAME}:${TAG_NAME}
ports:
- containerPort: ${{AGENT_ADMIN_PORT}}
protocol: TCP
Expand All @@ -355,7 +352,6 @@ objects:
volumeMounts:
- name: ${NAME}${SUFFIX}-tails
mountPath: "${TAILS_FILES_DIR}"

readinessProbe:
timeoutSeconds: 30
initialDelaySeconds: 3
Expand Down Expand Up @@ -388,17 +384,6 @@ objects:
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${NAME}${SUFFIX}
from:
kind: ImageStreamTag
name: ${NAME}:${TAG_NAME}
namespace: ${IMAGE_NAMESPACE}

- kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v1
Expand All @@ -413,8 +398,8 @@ objects:
env: ${TAG_NAME}
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
apiVersion: apps/v1
kind: Deployment
name: ${NAME}${SUFFIX}
minReplicas: ${{MIN_REPLICAS}}
maxReplicas: ${{MAX_REPLICAS}}
Expand Down
36 changes: 10 additions & 26 deletions openshift/templates/api/api-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,13 @@ objects:
protocol: TCP
targetPort: 8080
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}

- kind: DeploymentConfig
apiVersion: v1
- kind: Deployment
apiVersion: apps/v1
metadata:
name: ${NAME}${SUFFIX}
annotations:
description: Defines how to deploy the application server
app.openshift.io/connects-to: >-
[{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${AGENT_HOST}${SUFFIX}"},
{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${DATABASE_HOST}${SUFFIX}"},
{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${MSG_QUEUE_HOST}${SUFFIX}"},
{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${SOLR_HOST}${SUFFIX}"}]
labels:
name: ${NAME}${SUFFIX}
app: ${APP_NAME}${SUFFIX}
Expand All @@ -127,21 +121,11 @@ objects:
env: ${TAG_NAME}
spec:
strategy:
type: Rolling
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${NAME}${SUFFIX}
from:
kind: ImageStreamTag
namespace: ${IMAGE_NAMESPACE}
name: ${NAME}:${TAG_NAME}
- type: ConfigChange
type: RollingUpdate
replicas: 1
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}
template:
metadata:
name: ${NAME}${SUFFIX}
Expand All @@ -155,7 +139,7 @@ objects:
spec:
containers:
- name: ${NAME}${SUFFIX}
image: " "
image: image-registry.openshift-image-registry.svc:5000/${IMAGE_NAMESPACE}/${NAME}:${TAG_NAME}
ports:
- containerPort: 8080
protocol: TCP
Expand Down Expand Up @@ -313,8 +297,8 @@ objects:
env: ${TAG_NAME}
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v2
kind: DeploymentConfig
apiVersion: apps/v1
kind: Deployment
name: ${NAME}${SUFFIX}
minReplicas: ${{MIN_REPLICAS}}
maxReplicas: ${{MAX_REPLICAS}}
Expand Down
4 changes: 2 additions & 2 deletions openshift/templates/backup/backup-deploy.overrides.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CONFIG_MAP_NAME=backup-conf-bc
SOURCE_FILE=$( dirname "$0" )/config/backup.conf

OUTPUT_FORMAT=json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_DeploymentConfig.json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_Deployment.json

printStatusMsg "Generating ConfigMap; ${CONFIG_MAP_NAME} ..."
generateConfigMap "${CONFIG_MAP_NAME}" "${SOURCE_FILE}" "${OUTPUT_FORMAT}" "${OUTPUT_FILE}"
Expand All @@ -30,4 +30,4 @@ else
fi

SPECIALDEPLOYPARMS="--param-file=${_overrideParamFile}"
echo ${SPECIALDEPLOYPARMS}
echo ${SPECIALDEPLOYPARMS}
25 changes: 5 additions & 20 deletions openshift/templates/backup/backup-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ objects:
stringData:
webhook-url: ${WEBHOOK_URL}
type: Opaque
- kind: DeploymentConfig
apiVersion: v1
- kind: Deployment
apiVersion: apps/v1
metadata:
name: ${NAME}${SUFFIX}
labels:
Expand All @@ -64,28 +64,13 @@ objects:
app-group: ${APP_GROUP}
role: ${ROLE}
env: ${TAG_NAME}
annotations:
description: Defines how to deploy the application server
app.openshift.io/connects-to: >-
[{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${WALLET_DB_HOST}${SUFFIX}"},
{"apiVersion":"apps.openshift.io/v1","kind":"DeploymentConfig","name":"${DATABASE_HOST}${SUFFIX}"}]
spec:
strategy:
type: Recreate
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${NAME}${SUFFIX}
from:
kind: ImageStreamTag
namespace: ${IMAGE_NAMESPACE}
name: ${SOURCE_IMAGE_NAME}:${TAG_NAME}
replicas: 1
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}
template:
metadata:
name: ${NAME}${SUFFIX}
Expand All @@ -112,7 +97,7 @@ objects:
path: ${CONFIG_FILE_NAME}
containers:
- name: ${NAME}${SUFFIX}
image: ""
image: image-registry.openshift-image-registry.svc:5000/${IMAGE_NAMESPACE}/${NAME}:${TAG_NAME}
ports: []
env:
- name: BACKUP_STRATEGY
Expand Down
8 changes: 4 additions & 4 deletions openshift/templates/db/db-deploy.overrides.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ fi
CONFIG_MAP_NAME=${LOGGING_CONFIG_MAP_NAME:-db-logging-conf-bc}
SOURCE_FILE=$( dirname "$0" )/config/postgresql-cfg/logging.conf
OUTPUT_FORMAT=json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_DeploymentConfig.json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_Deployment.json
printStatusMsg "Generating ConfigMap; ${CONFIG_MAP_NAME} ..."
generateConfigMap "${CONFIG_MAP_NAME}" "${SOURCE_FILE}" "${OUTPUT_FORMAT}" "${OUTPUT_FILE}"

CONFIG_MAP_NAME=${AUTOVACUMM_CONFIG_MAP_NAME:-db-autovacuum-conf-bc}
SOURCE_FILE=$( dirname "$0" )/config/postgresql-cfg/autovacuum.conf
OUTPUT_FORMAT=json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_DeploymentConfig.json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_Deployment.json
printStatusMsg "Generating ConfigMap; ${CONFIG_MAP_NAME} ..."
generateConfigMap "${CONFIG_MAP_NAME}" "${SOURCE_FILE}" "${OUTPUT_FORMAT}" "${OUTPUT_FILE}"

CONFIG_MAP_NAME=${DBCONNECTIONS_CONFIG_MAP_NAME:-db-connections-conf-bc}
SOURCE_FILE=$( dirname "$0" )/config/postgresql-cfg/dbconnections.conf
OUTPUT_FORMAT=json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_DeploymentConfig.json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_Deployment.json
printStatusMsg "Generating ConfigMap; ${CONFIG_MAP_NAME} ..."
generateConfigMap "${CONFIG_MAP_NAME}" "${SOURCE_FILE}" "${OUTPUT_FORMAT}" "${OUTPUT_FILE}"

Expand All @@ -47,4 +47,4 @@ else
fi

SPECIALDEPLOYPARMS="--param-file=${_overrideParamFile}"
echo ${SPECIALDEPLOYPARMS}
echo ${SPECIALDEPLOYPARMS}
25 changes: 8 additions & 17 deletions openshift/templates/db/db-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ objects:
app: ${APP_NAME}${SUFFIX}
env: ${TAG_NAME}

- kind: DeploymentConfig
apiVersion: v1
- kind: Deployment
apiVersion: apps/v1
metadata:
name: ${NAME}${SUFFIX}
generation: 1
Expand All @@ -103,21 +103,11 @@ objects:
timeoutSeconds: 600
resources: {}
activeDeadlineSeconds: 21600
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${NAME}${SUFFIX}
from:
kind: ImageStreamTag
namespace: ${IMAGE_NAMESPACE}
name: ${SOURCE_IMAGE_NAME}:${IMAGE_TAG_NAME}
- type: ConfigChange
replicas: 1
test: false
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}
template:
metadata:
labels:
Expand Down Expand Up @@ -161,7 +151,7 @@ objects:
path: ${DBCONNECTIONS_CONFIG_FILE_NAME}
containers:
- name: ${NAME}${SUFFIX}
image: " "
image: image-registry.openshift-image-registry.svc:5000/${IMAGE_NAMESPACE}/${NAME}:${TAG_NAME}
ports:
- containerPort: 5432
protocol: TCP
Expand Down Expand Up @@ -296,7 +286,8 @@ objects:
port: 5432
targetPort: 5432
selector:
name: ${NAME}${SUFFIX}
matchLabels:
name: ${NAME}${SUFFIX}
type: ClusterIP
sessionAffinity: None

Expand Down Expand Up @@ -542,4 +533,4 @@ parameters:
description: The resources Memory limit (in Mi, Gi, etc) for this build.
required: true
value: 6000Mi
# ===============================================================================
# ===============================================================================
4 changes: 2 additions & 2 deletions openshift/templates/frontend/frontend-deploy.overrides.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi
CONFIG_MAP_NAME=${NAME}-${CADDY_CONFIG_MAP_NAME:-caddy-conf}
SOURCE_FILE=$( dirname "$0" )/config/Caddyfile
OUTPUT_FORMAT=json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_DeploymentConfig.json
OUTPUT_FILE=${CONFIG_MAP_NAME}-configmap_Deployment.json

printStatusMsg "Generating ConfigMap; ${CONFIG_MAP_NAME} ..."
generateConfigMap "${CONFIG_MAP_NAME}${SUFFIX}" "${SOURCE_FILE}" "${OUTPUT_FORMAT}" "${OUTPUT_FILE}"
Expand All @@ -35,4 +35,4 @@ else
fi

SPECIALDEPLOYPARMS="--param-file=${_overrideParamFile}"
echo ${SPECIALDEPLOYPARMS}
echo ${SPECIALDEPLOYPARMS}
Loading

0 comments on commit 85575b0

Please sign in to comment.