Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions blueprints/aws-alb-crossplane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ This definition is provided in the following files:
- [`gatewayclassblueprint-crossplane-aws-alb-values.yaml`](../../charts/bifrost-gateway-controller/ci/gatewayclassblueprint-crossplane-aws-alb-values.yaml)
RBAC for bifrost-gateway-controller Helm deployment suited for the `aws-alb-crossplane` blueprint.

### TargetGroup name limit

The `TargetGroup` resource in AWS has a character limit of 32 in AWS. This doesn't leave a lot of room for identifiers in the name. For this reason, the generated name (the format of which is `gw-<NAMESPACE>-<NAME>`) will be cut off at 25 characters, and then appended with the first 6 characters of the SHA1 of the entire name. This should ensure uniqueness of names, while also forcing conforming to the 32 character limit.

Because of this method, the name of `TargetGroups` might not always contain the full `name` and `namespace` of the corresponding Kubernetes resource. For this reason, these resources in AWS will also be tagged with `bifrost-gateway-controller/targetgroup_name` and `bifrost-gateway-controller/targetgroup_namespace`.

## Compatibility

This blueprint use AWS Crossplane resources through the [Upbound AWS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ spec:
metadata:
labels:
tv2.dk/gw: {{ .Gateway.metadata.namespace }}-{{ .Gateway.metadata.name }}
name: gw-{{ .Gateway.metadata.namespace }}-{{ .Gateway.metadata.name }}
name: {{ printf "gw-%s-%s" .Gateway.metadata.namespace .Gateway.metadata.name | substr 0 25}}-{{ printf "%s-%s" .Gateway.metadata.namespace .Gateway.metadata.name | sha1sum | substr 0 6 }}
spec:
providerConfigRef:
name: {{ .Values.providerConfigName }}
forProvider:
name: gw-{{ .Gateway.metadata.namespace }}-{{ .Gateway.metadata.name }}
name: {{ printf "gw-%s-%s" .Gateway.metadata.namespace .Gateway.metadata.name | substr 0 25}}-{{ printf "%s-%s" .Gateway.metadata.namespace .Gateway.metadata.name | sha1sum | substr 0 6 }}
region: {{ .Values.region }}
vpcId: {{ .Values.vpcId }}
healthCheck:
Expand All @@ -116,10 +116,12 @@ spec:
port: {{ .Values.healthCheck.port | quote }}
port: 80
protocol: HTTP
{{ if .Values.tags }}
tags:
bifrost-gateway-controller/targetgroup_name: {{ .Gateway.metadata.name }}
bifrost-gateway-controller/targetgroup_namespace: {{ .Gateway.metadata.namespace }}
{{ if .Values.tags }}
{{- toYaml .Values.tags | nindent 6 }}
{{ end }}
{{ end }}
targetType: ip
LBListenerRedirHttps: |
apiVersion: elbv2.aws.upbound.io/v1beta1
Expand Down
3 changes: 2 additions & 1 deletion hack/demo/delete-gw-cluster-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ NS=$1
GWNAME=$2

NAME=gw-${NS}-${GWNAME}
TARGETGROUPNAME="$(echo "gw-${NS}-${GWNAME}" | cut -b1-25)-$(echo -n "${NS}-${GWNAME}" | openssl sha1 | cut -b1-6)"

kubectl delete securitygrouprule.ec2.aws.upbound.io/${NAME}-upstream15021
kubectl delete securitygrouprule.ec2.aws.upbound.io/${NAME}-upstream80
Expand All @@ -13,6 +14,6 @@ kubectl delete securitygrouprule.ec2.aws.upbound.io/${NAME}-ingress80
kubectl delete securitygrouprule.ec2.aws.upbound.io/${NAME}-ingress443
kubectl delete lblistener.elbv2.aws.upbound.io/${NAME}
kubectl delete lblistener.elbv2.aws.upbound.io/${NAME}-redir
kubectl delete lbtargetgroup.elbv2.aws.upbound.io/${NAME}
kubectl delete lbtargetgroup.elbv2.aws.upbound.io/${TARGETGROUPNAME}
kubectl delete lb.elbv2.aws.upbound.io/${NAME}
kubectl delete securitygroup.ec2.aws.upbound.io/${NAME}