Skip to content

Commit f0c416e

Browse files
committed
App ID instance name change
- renamed the instance of App ID to `sfsappid` - updated the annotation for the ingress plugin to latest
1 parent 1abb317 commit f0c416e

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

app/generate_yaml.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ if [[ -z "$TARGET_NAMESPACE" ]]; then
2626
export TARGET_NAMESPACE=default
2727
fi
2828

29+
if [[ -z "$APPID_INSTANCE" ]]; then
30+
export APPID_INSTANCE=sfsappid
31+
fi
2932

3033
if [[ -z "$PUBLIC_CERT_ID" ]] && [[ -z "$SECRETS_MANAGER_API_URL" ]] && [[ -z "$MYDOMAIN" ]]; then
3134
cat secure-file-storage.template.yaml | \
32-
envsubst '$IMAGE_NAME $INGRESS_SECRET $INGRESS_SUBDOMAIN $IMAGE_PULL_SECRET $IMAGE_REPOSITORY $TARGET_NAMESPACE $BASENAME' > secure-file-storage.yaml
35+
envsubst '$APPID_INSTANCE $IMAGE_NAME $INGRESS_SECRET $INGRESS_SUBDOMAIN $IMAGE_PULL_SECRET $IMAGE_REPOSITORY $TARGET_NAMESPACE $BASENAME' > secure-file-storage.yaml
3336
exit
3437
fi
3538

@@ -50,4 +53,4 @@ fi
5053

5154
cat secure-file-storage.template.yaml | \
5255
sed -e 's/^# //' |
53-
envsubst '$PUBLIC_CERT_ID $SECRETS_MANAGER_API_URL $MYDOMAIN $IMAGE_NAME $INGRESS_SECRET $INGRESS_SUBDOMAIN $IMAGE_PULL_SECRET $IMAGE_REPOSITORY $TARGET_NAMESPACE $BASENAME' > secure-file-storage.yaml
56+
envsubst '$APPID_INSTANCE $PUBLIC_CERT_ID $SECRETS_MANAGER_API_URL $MYDOMAIN $IMAGE_NAME $INGRESS_SECRET $INGRESS_SUBDOMAIN $IMAGE_PULL_SECRET $IMAGE_REPOSITORY $TARGET_NAMESPACE $BASENAME' > secure-file-storage.yaml

app/secure-file-storage.template.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
labels:
2828
app: secure-file-storage
2929
spec:
30-
## Uncomment only if you are not deploying to the default namespace, remove ##
30+
## Uncomment only if you aren't deploying to the default namespace, remove ##
3131
## In this case, make sure to create a Docker registry secret
3232
## imagePullSecrets:
3333
## - name: $IMAGE_PULL_SECRET
@@ -44,26 +44,30 @@ spec:
4444
apiVersion: networking.k8s.io/v1
4545
kind: Ingress
4646
metadata:
47-
name: ingress-for-secure-file-storage
47+
name: ingress-for-sfs
4848
namespace: $TARGET_NAMESPACE
4949
annotations:
5050
kubernetes.io/ingress.class: "public-iks-k8s-nginx"
51-
nginx.ingress.kubernetes.io/auth-url: https://$host/oauth2-$BASENAME-appid/auth
52-
nginx.ingress.kubernetes.io/auth-signin: https://$host/oauth2-$BASENAME-appid/start?rd=$escaped_request_uri
51+
nginx.ingress.kubernetes.io/auth-url: https://oauth2-$APPID_INSTANCE.default.svc.cluster.local/oauth2-$APPID_INSTANCE/auth
52+
nginx.ingress.kubernetes.io/auth-signin: https://$host/oauth2-$APPID_INSTANCE/start?rd=$escaped_request_uri
5353
nginx.ingress.kubernetes.io/configuration-snippet: |
54+
auth_request_set $_oauth2_${APPID_INSTANCE}_upstream_1 $upstream_cookie__oauth2_${APPID_INSTANCE}_1;
5455
auth_request_set $access_token $upstream_http_x_auth_request_access_token;
5556
auth_request_set $id_token $upstream_http_authorization;
5657
access_by_lua_block {
58+
if ngx.var._oauth2_${APPID_INSTANCE}_upstream_1 ~= "" then
59+
ngx.header["Set-Cookie"] = "_oauth2_${APPID_INSTANCE}_1=" .. ngx.var._oauth2_${APPID_INSTANCE}_upstream_1 .. ngx.var.auth_cookie:match("(; .*)")
60+
end
5761
if ngx.var.id_token ~= "" and ngx.var.access_token ~= "" then
5862
ngx.req.set_header("Authorization", "Bearer " .. ngx.var.access_token .. " " .. ngx.var.id_token:match("%s*Bearer%s*(.*)"))
5963
end
60-
}
64+
}
6165
spec:
6266
tls:
6367
- hosts:
6468
- secure-file-storage.$INGRESS_SUBDOMAIN
6569
secretName: $INGRESS_SECRET
66-
## Uncomment below if you are using a custom domain. Remove '# '
70+
## Uncomment below if you are using a custom domain. Remove '# '
6771
# - hosts:
6872
# - secure-file-storage.$MYDOMAIN
6973
# secretName: secure-file-storage-certificate

terraform/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "ibm_iam_service_policy" "registry-policy" {
2727
}
2828

2929
resource "ibm_resource_instance" "app_id" {
30-
name = "${var.basename}-appid"
30+
name = "sfsappid"
3131
service = "appid"
3232
plan = var.appid_plan
3333
location = var.region

0 commit comments

Comments
 (0)