Skip to content

Commit

Permalink
Creating a test deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Williams-BC committed Nov 29, 2022
1 parent 11b029e commit 3e23efb
Show file tree
Hide file tree
Showing 10 changed files with 303 additions and 0 deletions.
10 changes: 10 additions & 0 deletions devops/env/test/api-env.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
environment=dev
PORT=8080
db_host=timemachine-patroni-master
db_type=postgres
db_port=5432
db_synchronize=true
db_name=timemachine
kc_authServerUrl=https://oidc.gov.bc.ca/auth
kc_realm=b9xip88d
kc_resource=timeMachineApp
23 changes: 23 additions & 0 deletions devops/env/test/api-replica-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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: Deployment
apiVersion: apps/v1
metadata:
labels:
app: timemachine
name: api
spec:
replicas: 3
33 changes: 33 additions & 0 deletions devops/env/test/api-resource-patch.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: Deployment
apiVersion: apps/v1
metadata:
labels:
app: timemachine
name: api
spec:
template:
spec:
containers:
- name: timemachine-api
resources:
limits:
cpu: 250m
memory: 1G
requests:
cpu: 100m
memory: 640Mi
34 changes: 34 additions & 0 deletions devops/env/test/db-pvc-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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: StatefulSet
metadata:
name: timemachine-patroni
labels:
app: timemachine
cluster-name: timemachine-patroni
spec:
volumeClaimTemplates:
- metadata:
name: postgresql
spec:
storageClassName: netapp-file-standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

24 changes: 24 additions & 0 deletions devops/env/test/db-replica-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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: StatefulSet
metadata:
name: timemachine-patroni
labels:
app: timemachine
cluster-name: timemachine-patroni
spec:
replicas: 3
34 changes: 34 additions & 0 deletions devops/env/test/db-resoure-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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: StatefulSet
metadata:
name: timemachine-patroni
labels:
app: timemachine
cluster-name: timemachine-patroni
spec:
template:
spec:
containers:
- name: postgresql
resources:
limits:
cpu: 160m
memory: 512Mi
requests:
cpu: 100m
memory: 320Mi
55 changes: 55 additions & 0 deletions devops/env/test/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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
namespace: ed57f0-test
bases:
- ../../base/db
- ../../base/api
- ../../base/web
- ../../base/policy
- ../../base/backup
resources:
- web-to-api-route.yaml
patches:
- api-resource-patch.yaml
- api-replica-patch.yaml
- web-replica-patch.yaml
- web-resource-patch.yaml
- db-replica-patch.yaml
- db-pvc-patch.yaml
- db-resoure-patch.yaml
generatorOptions:
labels:
app: timemachine
type: generated
configMapGenerator:
- name: api-env
env: api-env.properties
secretGenerator:
- name: api-creds
behavior: create
type: Opaque
env: api-secret.properties
- name: patroni-creds
behavior: create
type: Opaque
env: db-secret.properties
images:
- name: image-registry.openshift-image-registry.svc:5000/ed57f0-tools/timemachine-api
newTag: "latest"
- name: image-registry.openshift-image-registry.svc:5000/bcgov/patroni-postgres
newTag: "12.4-latest"
23 changes: 23 additions & 0 deletions devops/env/test/web-replica-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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: Deployment
apiVersion: apps/v1
metadata:
labels:
app: timemachine
name: web
spec:
replicas: 3
33 changes: 33 additions & 0 deletions devops/env/test/web-resource-patch.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: Deployment
apiVersion: apps/v1
metadata:
labels:
app: timemachine
name: web
spec:
template:
spec:
containers:
- name: timemachine-web
resources:
limits:
cpu: 20m
memory: 92Mi
requests:
cpu: 10m
memory: 64Mi
34 changes: 34 additions & 0 deletions devops/env/test/web-to-api-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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: v1
kind: Route
metadata:
labels:
app: timemachine
component: api
name: web-to-api
spec:
host: web-ed57f0-test.apps.silver.devops.gov.bc.ca
path: /api
port:
targetPort: 8080-tcp
tls:
insecureEdgeTerminationPolicy: Redirect
terminationc: edge
to:
kind: Service
name: api
weight: 100

0 comments on commit 3e23efb

Please sign in to comment.