Skip to content

Commit

Permalink
HOSTSD-304 Add email (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fosol authored Mar 7, 2024
1 parent 54a4012 commit 907a49a
Show file tree
Hide file tree
Showing 47 changed files with 2,250 additions and 74 deletions.
7 changes: 7 additions & 0 deletions HSB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSB.DataService", "src\data
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSB.CSS.API", "src\api-css\HSB.CSS.API.csproj", "{54C182FA-0B79-487E-92F9-7EB0D7164DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSB.Ches", "src\libs\ches\HSB.Ches.csproj", "{08A82D74-0854-498F-9C74-E0A7242FE430}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -70,6 +72,10 @@ Global
{54C182FA-0B79-487E-92F9-7EB0D7164DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54C182FA-0B79-487E-92F9-7EB0D7164DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54C182FA-0B79-487E-92F9-7EB0D7164DCC}.Release|Any CPU.Build.0 = Release|Any CPU
{08A82D74-0854-498F-9C74-E0A7242FE430}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08A82D74-0854-498F-9C74-E0A7242FE430}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08A82D74-0854-498F-9C74-E0A7242FE430}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08A82D74-0854-498F-9C74-E0A7242FE430}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{57BA1694-AD4C-4DEE-8D6B-144DE51DE27B} = {EF08BB60-A463-4B2B-8413-A70292255338}
Expand All @@ -82,5 +88,6 @@ Global
{B54E3181-664D-4974-9E95-77CED12D2239} = {57BA1694-AD4C-4DEE-8D6B-144DE51DE27B}
{87E5B721-F9FD-485F-A393-6C28EAB50BE7} = {EF08BB60-A463-4B2B-8413-A70292255338}
{54C182FA-0B79-487E-92F9-7EB0D7164DCC} = {EF08BB60-A463-4B2B-8413-A70292255338}
{08A82D74-0854-498F-9C74-E0A7242FE430} = {57BA1694-AD4C-4DEE-8D6B-144DE51DE27B}
EndGlobalSection
EndGlobal
23 changes: 23 additions & 0 deletions devops/kustomize/base/data-service/config-map.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
Expand All @@ -14,3 +15,25 @@ metadata:
created-by: jeremy.foster
data:
API_URL: http://api:8080
---
kind: ConfigMap
apiVersion: v1
metadata:
name: ches
namespace: default
annotations:
description: CHES configuration
labels:
name: ches
part-of: hsb
version: 1.0.0
component: email
managed-by: kustomize
created-by: jeremy.foster
data:
AUTH_URL: https://loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token
HOST_URI: https://ches.api.gov.bc.ca/api/v1
FROM: Hosting Service Dashboard <[email protected]>
TO: [email protected],[email protected]
EMAIL_ENABLED: "true"
EMAIL_AUTHORIZED: "true"
41 changes: 41 additions & 0 deletions devops/kustomize/base/data-service/cron-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,44 @@ spec:
secretKeyRef:
name: service-now
key: PASSWORD

- name: CHES__AuthUrl
valueFrom:
configMapKeyRef:
name: ches
key: AUTH_URL
- name: CHES__HostUri
valueFrom:
configMapKeyRef:
name: ches
key: HOST_URI
- name: CHES__From
valueFrom:
configMapKeyRef:
name: ches
key: FROM
- name: CHES__OverrideTo
valueFrom:
configMapKeyRef:
name: ches
key: TO
- name: CHES__EmailEnabled
valueFrom:
configMapKeyRef:
name: ches
key: EMAIL_ENABLED
- name: CHES__EmailAuthorized
valueFrom:
configMapKeyRef:
name: ches
key: EMAIL_AUTHORIZED
- name: CHES__Username
valueFrom:
secretKeyRef:
name: ches
key: USERNAME
- name: CHES__Password
valueFrom:
secretKeyRef:
name: ches
key: PASSWORD
32 changes: 32 additions & 0 deletions devops/kustomize/base/data-service/network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,35 @@ spec:
component: service
policyTypes:
- Egress
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: enable-data-service-to-ches
labels:
name: enable-data-service-to-ches
part-of: hsb
version: 1.0.0
component: service
managed-by: kustomize
created-by: jeremy.foster
annotations:
description: Enable the data-service to communicate with the ches
spec:
egress:
- to:
- ipBlock:
cidr: 142.34.194.118/32
- ipBlock:
cidr: 142.34.229.4/32 # Gold cluster *.apps IP
- ipBlock:
cidr: 142.34.64.4/32 # Gold DR cluster *.apps IP in case SSO fails over
ports:
- protocol: TCP
port: 443
podSelector:
matchLabels:
part-of: hsb
component: service
policyTypes:
- Egress
72 changes: 72 additions & 0 deletions devops/kustomize/base/tekton/tasks/data-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,78 @@ spec:
\"key\":\"PASSWORD\"
}
}
},
{
\"name\":\"CHES__AuthUrl\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"AUTH_URL\"
}
}
},
{
\"name\":\"CHES__HostUri\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"HOST_URI\"
}
}
},
{
\"name\":\"CHES__From\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"FROM\"
}
}
},
{
\"name\":\"CHES__OverrideTo\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"TO\"
}
}
},
{
\"name\":\"CHES__EmailEnabled\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"EMAIL_ENABLED\"
}
}
},
{
\"name\":\"CHES__EmailAuthorized\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"EMAIL_AUTHORIZED\"
}
}
},
{
\"name\":\"CHES__Username\",
\"valueFrom\":{
\"secretKeyRef\":{
\"name\":\"ches\",
\"key\":\"USERNAME\"
}
}
},
{
\"name\":\"CHES__Password\",
\"valueFrom\":{
\"secretKeyRef\":{
\"name\":\"ches\",
\"key\":\"PASSWORD\"
}
}
}
],
\"labels\":{
Expand Down
16 changes: 16 additions & 0 deletions devops/kustomize/overlays/dev/data-service/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,19 @@ patches:
- op: replace
path: /data/KEYCLOAK_ISSUER
value: hsb-dashboard-5128
- target:
kind: ConfigMap
name: ches
patch: |-
- op: replace
path: /data/AUTH_URL
value: https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token
- op: replace
path: /data/HOST_URI
value: https://ches-dev.api.gov.bc.ca/api/v1
- op: replace
path: /data/FROM
value: (DEV) Hosting Service Dashboard <[email protected]>
- op: replace
path: /data/TO
value: [email protected]
7 changes: 7 additions & 0 deletions devops/kustomize/overlays/secrets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ PASSWORD={SERVICE NOW PASSWORD}
INSTANCE=thehubtest
URL=https://{instance}.service-now.com
```

Create a `ches.env` file with the following records.

```env
USERNAME={CHES USERNAME}
PASSWORD={CHES PASSWORD}
```
3 changes: 3 additions & 0 deletions devops/kustomize/overlays/secrets/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ secretGenerator:
- name: service-now
envs:
- service-now.env
- name: ches
envs:
- ches.env
3 changes: 3 additions & 0 deletions devops/kustomize/overlays/secrets/test/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ secretGenerator:
- name: service-now
envs:
- service-now.env
- name: ches
envs:
- ches.env
16 changes: 16 additions & 0 deletions devops/kustomize/overlays/test/data-service/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,19 @@ patches:
- op: replace
path: /data/KEYCLOAK_ISSUER
value: hsb-dashboard-5128
- target:
kind: ConfigMap
name: ches
patch: |-
- op: replace
path: /data/AUTH_URL
value: https://test.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token
- op: replace
path: /data/HOST_URI
value: https://ches-test.api.gov.bc.ca/api/v1
- op: replace
path: /data/FROM
value: (TEST) Hosting Service Dashboard <[email protected]>
- op: replace
path: /data/TO
value: [email protected],[email protected]
80 changes: 80 additions & 0 deletions scripts/oc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,86 @@ oc-run () {
\"key\":\"PASSWORD\"
}
}
},
{
\"name\":\"CHES__AuthUrl\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"AUTH_URL\"
}
}
},
{
\"name\":\"CHES__HostUri\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"HOST_URI\"
}
}
},
{
\"name\":\"CHES__From\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"FROM\"
}
}
},
{
\"name\":\"CHES__OverrideTo\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"TO\"
}
}
},
{
\"name\":\"CHES__EmailEnabled\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"EMAIL_ENABLED\"
}
}
},
{
\"name\":\"CHES__EmailAuthorized\",
\"valueFrom\":{
\"configMapKeyRef\":{
\"name\":\"ches\",
\"key\":\"EMAIL_AUTHORIZED\"
}
}
},
{
\"name\":\"CHES__Username\",
\"valueFrom\":{
\"secretKeyRef\":{
\"name\":\"ches\",
\"key\":\"USERNAME\"
}
}
},
{
\"name\":\"CHES__Password\",
\"valueFrom\":{
\"secretKeyRef\":{
\"name\":\"ches\",
\"key\":\"PASSWORD\"
}
}
},
# {
# \"name\":\"Service__Actions__0\",
# \"value\": \"clean-organizations\"
# },
{
\"name\":\"Service__SendSuccessEmail\",
\"value\": \"true\"
}
],
\"labels\":{
Expand Down
7 changes: 6 additions & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ Keycloak__RequireHttpsMetadata=false
Keycloak__Authority=http://host.docker.internal:$portKeycloakHttp/auth/realms/hsb
Keycloak__Audience=hsb-app
Keycloak__Issuer=hsb-app
Keycloak__Secret={GET FROM KEYCLOAK}" >> ./src/data-service/.env
Keycloak__Secret={GET FROM KEYCLOAK}
CHES__AuthUrl=https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token
CHES__HostUri=https://ches-dev.api.gov.bc.ca/api/v1
CHES__Username={GET FROM CHES}
CHES__Password={GET FROM CHES}" >> ./src/data-service/.env
echo "./src/data-service/.env created"
fi
}
Loading

0 comments on commit 907a49a

Please sign in to comment.