[15.02.20] More dynamic mapping

This commit is contained in:
andyjk15 2020-02-15 20:58:03 +00:00
parent c12b2016f1
commit 9f7bc929e7
2 changed files with 36 additions and 56 deletions

View File

@ -2,86 +2,64 @@ apiVersion: v1
kind: Deployment kind: Deployment
metadata: metadata:
labels: labels:
name: db-gateway name: LABEL
name: db-gateway name: RESOURCE_NAME
spec: spec:
replicas: 1 replicas: 1
selector: selector:
app: db-gateway app: RESOURCE_NAME
strategy: strategy:
type: Rolling type: Rolling
rollingParams: rollingParams:
updatePeriodSeconds: 1 updatePeriodSeconds: 1
intervalSeconds: 1 intervalSeconds: 1
timeoutSeconds: 300 timeoutSeconds: 300
maxSurge: 1 maxSurge: 25%
maxUnavailable: 0 maxUnavailable: 0
template: template:
metadata: metadata:
labels: labels:
app: db-gateway app: RESOURCE_NAME
spec: spec:
containers: containers:
- name: db-gateway - name: RESOURCE_NAME
image: REPOSITORY/IMAGE image: REPOSITORY/IMAGE
env: env:
- name: KUBERNETES_NAMESPACE - name: KUBERNETES_NAMESPACE
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: CONTAINER_CORE_LIMIT - name: CONTAINER_CORE_LIMIT
valueFrom: valueFrom:
resourceFieldRef: resourceFieldRef:
resource: limits.cpu resource: limits.cpu
- name: CONTAINER_MAX_MEMORY - name: CONTAINER_MAX_MEMORY
valueFrom: valueFrom:
resourceFieldRef: resourceFieldRef:
resource: limits.memory resource: limits.memory
- name: JDBC_URL
valueFrom:
secretKeyRef:
name: jdbc
key: jdbc.url
- name: JDBC_USERNAME
valueFrom:
secretKeyRef:
name: jdbc
key: jdbc.username
- name: JDBC_PASSWORD
valueFrom:
secretKeyRef:
name: jdbc
key: jdbc.password
- name: JDBC_URL
valueFrom:
secretKeyRef:
name: jdbc
key: jdbc.url
- name: JDBC_USERNAME
valueFrom:
secretKeyRef:
name: jdbc
key: jdbc.username
- name: JDBC_PASSWORD
valueFrom:
secretKeyRef:
name: jdbc
key: jdbc.password
- name: TZ
value: Europe/London
image: ${IMAGE}:${IMAGE_VERSION}
imagePullPolicy: Always imagePullPolicy: Always
name: db-gateway
livenessProbe:
httpGet:
path: ${LIVENESS_PATH}
port: 9090
initialDelaySeconds: 90
periodSeconds: 30
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: ${READINESS_PATH}
port: 9090
initialDelaySeconds: 90
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 10
resources: resources:
requests: requests:
cpu: 10m cpu: 0.25
memory: 128Mi memory: 128Mi
limits: limits:
cpu: 500m cpu: 0.5
memory: 256Mi memory: 256Mi
restartPolicy: Always restartPolicy: Always
triggers: []

View File

@ -1,7 +1,7 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
env.APPLICATION_NAME = 'db-gateway' env.APPLICATION_NAME = 'db-gateway'
env.APPLICATION_LABEL = 'gateways' env.APPLICATION_LABEL = 'gateway'
env.GIT_BRANCH = 'master' env.GIT_BRANCH = 'master'
env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git" env.GIT_REPOSITORY_PATH = "github.com/andyjk15/${env.APPLICATION_NAME}.git"
env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}" env.GIT_REPOSITORY_URL = "https://${env.GIT_REPOSITORY_PATH}"
@ -86,6 +86,8 @@ try {
sh "sed -i 's/REPOSITORY/${env.DOCKER_REPOSITORY}/g' configuration/kubernetes/deploy-config.yaml" sh "sed -i 's/REPOSITORY/${env.DOCKER_REPOSITORY}/g' configuration/kubernetes/deploy-config.yaml"
sh "sed -i 's/IMAGE/${env.APPLICATION_NAME}:${env.APPLICATION_VERSION}/g' configuration/kubernetes/deploy-config.yaml" sh "sed -i 's/IMAGE/${env.APPLICATION_NAME}:${env.APPLICATION_VERSION}/g' configuration/kubernetes/deploy-config.yaml"
sh "sed -i 's/RESOURCE_NAME/${env.APPLICATION_NAME}/g' configuration/kubernetes/deploy-config.yaml"
sh "sed -i 's/LABEL/${env.APPLICATION_LABEL}/g' configuration/kubernetes/deploy-config.yaml"
sh "cat configuration/kubernetes/deploy-config.yaml" sh "cat configuration/kubernetes/deploy-config.yaml"
// Update build config for kubernetes // Update build config for kubernetes