Skip to content

Commit 2b0ef61

Browse files
GOV-285: New g2p-sandbox-security-fynarfin-SIT chart (#155)
* Testing env variable in makefile for g2p-sandbox * Updated circle ci pipeline * Fixed run command on circle ci * Fixed makefile for es * Updated the kibana secret makefile to take ns form env * Bug fixed while setting the ns env variable * Added create-secret-security-namespace step in cricle ci * Added new step upgrade-g2psandbox-security-helm-chart * Added init db script for keycloak * Updated ingress * Fixed the variable override * Override channle ssl property * Override aws region for bp * Channel and bulk ingress classname set to kong * Added latest image tag * Testing enable false * Updated the security chart name * Added step to host security-fynarfin-sit chart * Fixed circel ci * Disabled everything, enabled kong keycloak * Only kong * Migrations enabled * Fixed the db bootstraping in kong * Fullname override for keycloak * Fullnameoveride removed, since moved to template * Create ns if it doesnt exist * Simplified the security chart * Test * Updated the readme file * Renamed the ns * namespace updated to ph-infra * Bug fixed in ns creation in security chart * Fixed the circle ci
1 parent a191ad2 commit 2b0ef61

File tree

9 files changed

+127
-16
lines changed

9 files changed

+127
-16
lines changed

.circleci/config.yml

+79-9
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- run: chmod 400 b64encoded.pem
2626
- run: scp -o StrictHostKeyChecking=No -i b64encoded.pem index.yaml ph-ee-g2psandbox-fynarfin-0.2.0.tgz [email protected]:~/
2727
- run: ssh -i b64encoded.pem -o StrictHostKeyChecking=No [email protected] sudo mv -t /apps/apache-tomcat-7.0.82/webapps/ROOT/images/ph-ee-g2psandbox-fynarfin index.yaml ph-ee-g2psandbox-fynarfin-0.2.0.tgz
28+
2829
upgrade-g2psandbox-helm-chart:
2930
docker:
3031
- image: cimg/python:3.10
@@ -58,9 +59,9 @@ jobs:
5859

5960
# kubectl delete secrets elastic-certificates elastic-certificate-pem elastic-certificate-crt|| true
6061

61-
create-secret:
62+
create-secret-paymenthub-namespace:
6263
docker:
63-
- image: cimg/base:2022.06
64+
- image: cimg/base:2022.06
6465
steps:
6566
- setup_remote_docker:
6667
version: 20.10.14
@@ -70,21 +71,74 @@ jobs:
7071
cluster-name: "sit"
7172
aws-region: "$REGION"
7273
- run: |
74+
export ENV_NAMESPACE=paymenthub
7375
kubectl config use-context arn:aws:eks:$REGION:419830066942:cluster/sit
7476
kubectl config get-contexts
7577
cd helm/kibana-secret/
7678
make secrets || echo "kibana" already exists
79+
7780
- run: |
81+
export ENV_NAMESPACE=paymenthub
7882
kubectl config use-context arn:aws:eks:$REGION:419830066942:cluster/sit
7983
kubectl config get-contexts
8084
cd helm/es-secret/
8185
make secrets || echo "elastic-certificates" already exists
8286
8387
- run: |
84-
kubectl delete secret bulk-processor-secret -n paymenthub || echo "delete the secret if exist"
88+
export ENV_NAMESPACE=paymenthub
89+
kubectl delete secret bulk-processor-secret -n $ENV_NAMESPACE || echo "delete the secret if exist"
8590
kubectl create secret generic bulk-processor-secret \
8691
--from-literal=aws-access-key="$S3_ACCESS_KEY_ID" \
87-
--from-literal=aws-secret-key="$S3_SECRET_ACCESS_KEY" -n paymenthub
92+
--from-literal=aws-secret-key="$S3_SECRET_ACCESS_KEY" -n $ENV_NAMESPACE
93+
94+
host-g2-sandbox-security-fynarfin-chart:
95+
docker:
96+
- image: cimg/python:3.10
97+
working_directory: ~/repo
98+
environment:
99+
TERM: dumb
100+
steps:
101+
- checkout
102+
- run: rm -f helm/g2p-sandbox-security-fynarfin-SIT/Chart.lock helm/g2p-sandbox-security-fynarfin-SIT/requirements.lock helm/g2p-sandbox-security-fynarfin-SIT/charts/*
103+
- helm/install-helm-client:
104+
version: "v3.8.2"
105+
- run: cat helm/g2p-sandbox-security-fynarfin-SIT/Chart.yaml
106+
- run: helm dep up helm/g2p-sandbox-security-fynarfin-SIT
107+
- run: helm package helm/g2p-sandbox-security-fynarfin-SIT
108+
- run: helm repo index .
109+
- run: echo "$CERT_FILE" | base64 --decode > b64encoded.pem
110+
- run: chmod 400 b64encoded.pem
111+
- run: ssh -i b64encoded.pem -o StrictHostKeyChecking=No [email protected] sudo mkdir -p /apps/apache-tomcat-7.0.82/webapps/ROOT/images/ph-ee-g2psandbox-security-fynarfin
112+
- run: scp -o StrictHostKeyChecking=No -i b64encoded.pem index.yaml ph-ee-g2psandbox-security-fynarfin-0.0.0.tgz [email protected]:~/
113+
- run: ssh -i b64encoded.pem -o StrictHostKeyChecking=No [email protected] sudo mv -t /apps/apache-tomcat-7.0.82/webapps/ROOT/images/ph-ee-g2psandbox-security-fynarfin index.yaml ph-ee-g2psandbox-security-fynarfin-0.0.0.tgz
114+
115+
upgrade-g2psandbox-security-helm-chart:
116+
docker:
117+
- image: cimg/python:3.10
118+
parameters:
119+
cluster-name:
120+
description: "sit"
121+
type: string
122+
steps:
123+
- aws-eks/update-kubeconfig-with-authenticator:
124+
cluster-name: "sit"
125+
aws-region: "$REGION"
126+
- helm/install-helm-client:
127+
version: "v3.8.2"
128+
- kubernetes/install-kubectl
129+
- run: |
130+
if ! kubectl get ns ph-infrastructure > /dev/null 2>&1; then
131+
kubectl create namespace ph-infrastructure
132+
fi
133+
- run: helm ls --namespace=ph-infrastructure
134+
- helm/upgrade-helm-chart:
135+
chart: "https://fynarfin.io/images/ph-ee-g2psandbox-security-fynarfin/ph-ee-g2psandbox-security-fynarfin-0.0.0.tgz"
136+
release-name: "g2p-sandbox-security"
137+
namespace: ph-infrastructure
138+
recreate-pods: true
139+
add-repo: "https://fynarfin.io/images/ph-ee-g2psandbox-security"
140+
wait: true
141+
timeout: "300s"
88142

89143
deploying-bpmns:
90144
docker:
@@ -120,24 +174,40 @@ workflows:
120174
- AWS
121175
- Helm
122176
- slack
123-
177+
- host-g2-sandbox-security-fynarfin-chart:
178+
requires:
179+
- build
180+
context:
181+
- AWS
182+
- Helm
183+
- slack
124184
- upgrade-g2psandbox-helm-chart:
125185
cluster-name: sit
126186
requires:
127187
- build
188+
- upgrade-g2psandbox-security-helm-chart
128189
context:
129190
- AWS
130191
- Helm
131192
- slack
132-
- Secrets
133-
- create-secret:
193+
- Secrets
194+
- create-secret-paymenthub-namespace:
134195
requires:
135196
- upgrade-g2psandbox-helm-chart
136197
context:
137198
- AWS
138199
- Helm
139200
- slack
140201
- Secrets
202+
- upgrade-g2psandbox-security-helm-chart:
203+
cluster-name: sit
204+
requires:
205+
- host-g2-sandbox-security-fynarfin-chart
206+
context:
207+
- AWS
208+
- Helm
209+
- slack
210+
- Secrets
141211
- deploying-bpmns:
142212
requires:
143213
- upgrade-g2psandbox-helm-chart
@@ -147,15 +217,15 @@ workflows:
147217
- slack
148218
- test-chart-gov:
149219
requires:
150-
- create-secret
220+
- create-secret-paymenthub-namespace
151221
- deploying-bpmns
152222
context:
153223
- AWS
154224
- Helm
155225
- slack
156226
- test-chart-ams:
157227
requires:
158-
- create-secret
228+
- create-secret-paymenthub-namespace
159229
- deploying-bpmns
160230
context:
161231
- AWS

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ integration-tests/out/
3333
module/dummy/starter/out/
3434
chart.lock
3535
*.tgz
36+
charts/

helm/es-secret/Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ secrets:
2525
docker rm -f elastic-helm-charts-certs && \
2626
openssl pkcs12 -nodes -passin pass:'' -in elastic-certificates.p12 -out elastic-certificate.pem && \
2727
openssl x509 -outform der -in elastic-certificate.pem -out elastic-certificate.crt && \
28-
kubectl create namespace paymenthub || echo "namespace already exists" && \
29-
kubectl create secret generic elastic-certificates --namespace=paymenthub --from-file=elastic-certificates.p12 && \
30-
kubectl create secret generic elastic-certificate-pem --namespace=paymenthub --from-file=elastic-certificate.pem && \
31-
kubectl create secret generic elastic-certificate-crt --namespace=paymenthub --from-file=elastic-certificate.crt && \
32-
kubectl create secret generic elastic-credentials --namespace=paymenthub --from-literal=password=$$password --from-literal=username=elastic && \
28+
kubectl create namespace $(NAMESPACE) || echo "namespace already exists" && \
29+
kubectl create secret generic elastic-certificates --namespace=$(NAMESPACE) --from-file=elastic-certificates.p12 && \
30+
kubectl create secret generic elastic-certificate-pem --namespace=$(NAMESPACE) --from-file=elastic-certificate.pem && \
31+
kubectl create secret generic elastic-certificate-crt --namespace=$(NAMESPACE) --from-file=elastic-certificate.crt && \
32+
kubectl create secret generic elastic-credentials --namespace=$(NAMESPACE) --from-literal=password=$$password --from-literal=username=elastic && \
3333
rm -f elastic-certificates.p12 elastic-certificate.pem elastic-certificate.crt elastic-stack-ca.p12

helm/es-secret/examples.mk

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ GOSS_FILE ?= goss.yaml
44
GOSS_SELECTOR ?= release=$(RELEASE)
55
STACK_VERSION := 7.17.3
66
TIMEOUT := 900s
7+
NAMESPACE = $(ENV_NAMESPACE)
78

89
.PHONY: help
910
help: ## Display this help
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: ph-ee-g2psandbox-security-fynarfin
3+
description: PaymentHub EE Barebone Edition
4+
type: application
5+
version: 0.0.0
6+
appVersion: 1.0.0
7+
8+
dependencies:
9+
- name: ph-ee-g2psandbox-security
10+
repository: https://fynarfin.io/images/ph-ee-g2psandbox-security
11+
version: 0.0.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Helm Upgrade command ---->
2+
hehelm upgrade -f helm/g2p-sandbox-security/values.yaml g2p-sandbox-security helm/g2p-sandbox-security --install --create-namespace --namespace security
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ph-ee-g2psandbox-security:
2+
ph-ee-engine:
3+
4+
keycloak:
5+
enabled: true
6+
ingress:
7+
enabled: true
8+
ingressClassName: "kong"
9+
rules:
10+
- host: 'keycloak.sandbox.fynarfin.io'
11+
paths:
12+
- path: /
13+
pathType: Prefix
14+
15+
kong:
16+
enabled: true
17+
env:
18+
database: "postgres"
19+
admin:
20+
ingress:
21+
enabled: true
22+
hostname: 'kong-admin.sandbox.fynarfin.io'
23+
24+
wildcardhostname: "*.sandbox.fynarfin.io"
25+
tls: ""

helm/kibana-secret/examples.mk

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ GOSS_FILE ?= goss.yaml
44
GOSS_SELECTOR ?= release=$(RELEASE)
55
STACK_VERSION := 7.16.3
66
TIMEOUT := 900s
7+
NAMESPACE = $(ENV_NAMESPACE)
78

89
.PHONY: help
910
help: ## Display this help

helm/kibana-secret/makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ purge:
1313

1414
secrets:
1515
encryptionkey=$$(docker run --rm busybox:1.31.1 /bin/sh -c "< /dev/urandom tr -dc _A-Za-z0-9 | head -c50") && \
16-
kubectl create namespace paymenthub || echo "namespace already exists" && \
17-
kubectl create secret generic kibana --namespace=paymenthub --from-literal=encryptionkey=$$encryptionkey
16+
kubectl create namespace $(NAMESPACE) || echo "namespace already exists" && \
17+
kubectl create secret generic kibana --namespace=$(NAMESPACE) --from-literal=encryptionkey=$$encryptionkey

0 commit comments

Comments
 (0)