Skip to content

Commit

Permalink
Refactor - variable names, resource names, URIs, and subdomains
Browse files Browse the repository at this point in the history
  • Loading branch information
ndebuhr committed Sep 15, 2022
1 parent 3e4c631 commit f56891a
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ _While installation is possible using non-Linux clients, it's not a well-establi
### Provision with Terraform
Set the `GOOGLE_PROJECT`, `ISIDRO_DOMAIN`, `MATTERMOST_DOMAIN`, and `DNS_ZONE_NAME` environment variables, with something like:
Set the `GOOGLE_PROJECT`, `API_DOMAIN`, `MATTERMOST_DOMAIN`, and `DNS_ZONE_NAME` environment variables, with something like:
```bash
export GOOGLE_PROJECT=example
export ISIDRO_DOMAIN=isidro.example.com
export API_DOMAIN=api.example.com
export MATTERMOST_DOMAIN=mattermost.example.com
export DNS_ZONE_NAME="example-com"
```
Expand Down Expand Up @@ -141,7 +141,7 @@ Hydrate configurations:
cp skaffold.dev.yaml skaffold.yaml
sed -i "s/GOOGLE_PROJECT/$GOOGLE_PROJECT/g" skaffold.yaml
sed -i "s/MATTERMOST_DOMAIN/$MATTERMOST_DOMAIN/g" skaffold.yaml
sed -i "s/ISIDRO_DOMAIN/$ISIDRO_DOMAIN/g" skaffold.yaml
sed -i "s/API_DOMAIN/$API_DOMAIN/g" skaffold.yaml
sed -i "s/DNS_ZONE_NAME/$DNS_ZONE_NAME/g" skaffold.yaml
```
Expand All @@ -157,7 +157,7 @@ Hydrate confiigurations:
cp skaffold.prod.yaml skaffold.yaml
sed -i "s/GOOGLE_PROJECT/$GOOGLE_PROJECT/g" skaffold.yaml
sed -i "s/MATTERMOST_DOMAIN/$MATTERMOST_DOMAIN/g" skaffold.yaml
sed -i "s/ISIDRO_DOMAIN/$ISIDRO_DOMAIN/g" skaffold.yaml
sed -i "s/API_DOMAIN/$API_DOMAIN/g" skaffold.yaml
sed -i "s/DNS_ZONE_NAME/$DNS_ZONE_NAME/g" skaffold.yaml
```
Expand Down Expand Up @@ -203,7 +203,7 @@ _Relevant if you are using Mattermost as your chat tool_
1. Recommended description is "Push notification enabling the Isidro chatbot to respond to @mentions"
1. Application type is "application/json"
1. Trigger word is "@isidro"
1. Callback URL is https://isidro.example.com/isidro/api/v1/submit (replace isidro.example.com with your Isidro domain)
1. Callback URL is https://api.example.com/v1/submit (replace api.example.com with your Isidro API domain)
1. Leave the remaining values as the defaults
1. Copy the verification token to the Helm values (or Skaffold overrides) as `mattermost.verificationToken`
1. Upgrade the Helm installation
Expand All @@ -219,7 +219,7 @@ Mention @isidro in Slack messages, and get a response. Use separate message thr
### Test payload
```bash
curl -X POST https://isidro.example.com/api/v1/submit \
curl -X POST https://api.example.com/v1/submit \
-H "Content-Type: application/json" \
-d '{"token": "1234567890", "event": {"channel": "quality", "ts": "1234567890", "user": "me", "text": "Hello"}}'
```
4 changes: 2 additions & 2 deletions auxiliary/multicluster/mci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: isidro-ingress
namespace: isidro
annotations:
networking.gke.io/static-ip: global/addresses/isidro
networking.gke.io/static-ip: global/addresses/isidro-api
spec:
template:
spec:
Expand All @@ -23,7 +23,7 @@ metadata:
name: mattermost-ingress
namespace: mattermost
annotations:
networking.gke.io/static-ip: global/addresses/mattermost
networking.gke.io/static-ip: global/addresses/isidro-mattermost
spec:
template:
spec:
Expand Down
4 changes: 2 additions & 2 deletions auxiliary/networking/templates/certs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ spec:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: isidro
name: api
namespace: isidro
spec:
secretName: ingress-tls
issuerRef:
kind: ClusterIssuer
name: cloud-dns-issuer
dnsNames:
- {{ .Values.isidro.domain }}
- {{ .Values.api.domain }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
Expand Down
12 changes: 6 additions & 6 deletions auxiliary/networking/templates/dns.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
apiVersion: dns.cnrm.cloud.google.com/v1beta1
kind: DNSRecordSet
metadata:
name: isidro
name: api
namespace: configconnector-resources
spec:
name: "{{ .Values.isidro.domain }}."
name: "{{ .Values.api.domain }}."
type: A
ttl: 300
managedZoneRef:
external: "{{ .Values.dns.zone }}"
rrdatasRefs:
- name: isidro
- name: api
kind: ComputeAddress
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeAddress
metadata:
name: isidro
name: api
namespace: configconnector-resources
spec:
location: global
resourceID: isidro
resourceID: isidro-api
---
apiVersion: dns.cnrm.cloud.google.com/v1beta1
kind: DNSRecordSet
Expand All @@ -44,4 +44,4 @@ metadata:
namespace: configconnector-resources
spec:
location: global
resourceID: mattermost
resourceID: isidro-mattermost
4 changes: 2 additions & 2 deletions auxiliary/networking/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project: PROJECT

isidro:
domain: isidro.example.com
api:
domain: api.example.com

mattermost:
domain: mattermost.example.com
Expand Down
2 changes: 1 addition & 1 deletion gatekeeper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def general_response(self):
return ""


@app.route("/isidro/api/v1/submit", methods=["POST"])
@app.route("/v1/submit", methods=["POST"])
def submission():
gatekeeper = Gatekeeper(request)
gatekeeper.validate_verification_token_correct()
Expand Down
4 changes: 2 additions & 2 deletions skaffold.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ deploy:
- name: isidro-configconnector
chartPath: auxiliary/configconnector
setValues:
configconnector.project: GOOGLE_PROJECT
project: GOOGLE_PROJECT
hooks:
after:
# Ensure required CRDs are available
Expand All @@ -241,7 +241,7 @@ deploy:
skipBuildDependencies: true
setValues:
project: GOOGLE_PROJECT
isidro.domain: ISIDRO_DOMAIN
api.domain: API_DOMAIN
mattermost.domain: MATTERMOST_DOMAIN
dns.zone: DNS_ZONE_NAME
---
Expand Down
4 changes: 2 additions & 2 deletions skaffold.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ deploy:
- name: isidro-configconnector
chartPath: auxiliary/configconnector
setValues:
configconnector.project: GOOGLE_PROJECT
project: GOOGLE_PROJECT
hooks:
after:
# Ensure required CRDs are available
Expand All @@ -385,7 +385,7 @@ deploy:
skipBuildDependencies: true
setValues:
project: GOOGLE_PROJECT
isidro.domain: ISIDRO_DOMAIN
api.domain: API_DOMAIN
mattermost.domain: MATTERMOST_DOMAIN
dns.zone: DNS_ZONE_NAME
---
Expand Down
2 changes: 1 addition & 1 deletion slack/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ oauth_config:
- im:history
settings:
event_subscriptions:
request_url: https://isidro.example.com/isidro/api/v1/submit
request_url: https://api.example.com/v1/submit
bot_events:
- app_mention
org_deploy_enabled: false
Expand Down

0 comments on commit f56891a

Please sign in to comment.