Skip to content

Commit

Permalink
Deployment Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Williams-BC committed Jan 22, 2023
1 parent 11f9d95 commit d170d57
Show file tree
Hide file tree
Showing 39 changed files with 959 additions and 35 deletions.
99 changes: 99 additions & 0 deletions devops/base/dev/api/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright 2021 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: timemachine
name: api
spec:
replicas: 1
selector:
matchLabels:
app: timemachine
component: api
strategy:
type: RollingUpdate
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
template:
metadata:
labels:
app: timemachine
role: api
component: api
spec:
containers:
- name: timemachine-api
image: image-registry.openshift-image-registry.svc:5000/ed57f0-tools/timemachine-api-dev:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 60m
memory: 384Mi
requests:
cpu: 20m
memory: 288Mi
envFrom:
- configMapRef:
name: api-env
- secretRef:
name: api-creds
dnsPolicy: ClusterFirst
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
labels:
app: timemachine
name: api
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: timemachine
component: api
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: Route
metadata:
labels:
app: timemachine
component: api
name: api
spec:
port:
targetPort: 8080-tcp
tls:
insecureEdgeTerminationPolicy: Redirect
terminationc: edge
to:
kind: Service
name: api
weight: 100
File renamed without changes.
File renamed without changes.
File renamed without changes.
104 changes: 104 additions & 0 deletions devops/base/dev/web/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Copyright 2021 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: timemachine
name: web
spec:
strategy:
type: RollingUpdate
replicas: 1
selector:
matchLabels:
app: timemachine
component: web
template:
metadata:
labels:
app: timemachine
role: web
component: web
name: timemachine
spec:
containers:
- name: timemachine-web
image: image-registry.openshift-image-registry.svc:5000/ed57f0-tools/timemachine-web-dev:latest
imagePullPolicy: Always
startupProbe:
httpGet:
path: /
port: 2015
failureThreshold: 11
periodSeconds: 3
readinessProbe:
httpGet:
path: /
port: 2015
timeoutSeconds: 3
ports:
- containerPort: 2015
resources:
limits:
cpu: 30m
memory: 48Mi
requests:
cpu: 10m
memory: 32Mi
volumeMounts:
- name: config-vol
mountPath: /etc/caddy/Caddyfile
subPath: Caddyfile
volumes:
- name: config-vol
configMap:
name: web-config
---
apiVersion: v1
kind: Service
metadata:
labels:
app: timemachine
component: web
name: web
spec:
selector:
app: timemachine
component: web
ports:
- name: 2015-tcp
port: 2015
protocol: TCP
targetPort: 2015
---
apiVersion: v1
kind: Route
metadata:
labels:
app: timemachine
component: web
name: web
spec:
port:
targetPort: 2015-tcp
tls:
insecureEdgeTerminationPolicy: Redirect
terminationc: edge
to:
kind: Service
name: web
weight: 100
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions devops/base/prod/api/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2021 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deploy.yaml
- policy.yaml

33 changes: 33 additions & 0 deletions devops/base/prod/api/policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2021 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-api-to-patroni
spec:
# Allow the API to talk to the patroni
# database cluster on the given port.
podSelector:
matchLabels:
statefulset: timemachine-patroni
ingress:
- from:
- podSelector:
matchLabels:
role: api
ports:
- protocol: TCP
port: 5432
59 changes: 59 additions & 0 deletions devops/base/prod/web/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2020 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: v1
kind: ConfigMap
metadata:
name: web-config
labels:
app: timemachine
data:
Caddyfile: |
# Where caddy should listen
:2015
# Turn on the Web/file server
file_server
#templates {
# mime "text/javascript" "application/javascript"
#}
# The site root
root * /opt/app-root/src
# Because we should
encode zstd gzip
# This rewrite rule may be required to get React apps
# to deal with trailing slashes properly.
#@filter {
# not path_regexp ^\/0.0.0.0
# file {
# try_files {path} {path}/ /?url={uri}
# }
#}
#rewrite @try_files {http.matchers.file.relative}
# This properly deals with react routes.
try_files {path} {path}/ /index.html
# On OCP we should log to stdout so Prometheus can
# slurp up the logs for human consumption.
log {
#errors stdout
output stdout
format single_field common_log
level info
}
File renamed without changes.
20 changes: 20 additions & 0 deletions devops/base/prod/web/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deploy.yaml
- config.yaml
Loading

0 comments on commit d170d57

Please sign in to comment.