Skip to content

Commit

Permalink
Merge pull request #1222 from ishankhare07/alb-target-group-arn
Browse files Browse the repository at this point in the history
add fixed response config and target group ARN
  • Loading branch information
FabianKramm committed Sep 22, 2023
2 parents 70970e9 + ac58d31 commit 4167783
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/controllers/resources/ingresses/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func TestSync(t *testing.T) {
Labels: baseIngress.Labels,
Annotations: map[string]string{
"nginx.ingress.kubernetes.io/auth-secret": "my-secret",
"alb.ingress.kubernetes.io/actions.testservice": "{\"forwardConfig\":{\"targetGroups\":[{\"serviceName\":\"nginx-service\",\"servicePort\":\"80\",\"weight\":100}]}}",
"alb.ingress.kubernetes.io/actions.testservice": `{"forwardConfig":{"targetGroups":[{"serviceName":"nginx-service","servicePort":"80","weight":100}]}}`,
"alb.ingress.kubernetes.io/actions.ssl-redirect": `{"type": "redirect", "redirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}`,
},
},
Expand All @@ -391,7 +391,7 @@ func TestSync(t *testing.T) {
Namespace: baseIngress.Namespace,
Labels: baseIngress.Labels,
Annotations: map[string]string{
"alb.ingress.kubernetes.io/actions.testservice": "{\"forwardConfig\":{\"targetGroups\":[{\"serviceName\":\"nginx-service\",\"servicePort\":\"80\",\"weight\":100}]}}",
"alb.ingress.kubernetes.io/actions.testservice": `{"forwardConfig":{"targetGroups":[{"serviceName":"nginx-service","servicePort":"80","weight":100}]}}`,
"alb.ingress.kubernetes.io/actions.ssl-redirect": `{"type": "redirect", "redirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}`,
"nginx.ingress.kubernetes.io/auth-secret": "my-secret",
},
Expand All @@ -412,7 +412,7 @@ func TestSync(t *testing.T) {
"vcluster.loft.sh/object-name": baseIngress.Name,
"vcluster.loft.sh/object-namespace": baseIngress.Namespace,
translate.UIDAnnotation: "",
"alb.ingress.kubernetes.io/actions.testservice-x-test-x-suffix": "{\"forwardConfig\":{\"targetGroups\":[{\"serviceName\":\"nginx-service-x-test-x-suffix\",\"servicePort\":\"80\",\"weight\":100}]}}",
"alb.ingress.kubernetes.io/actions.testservice-x-test-x-suffix": `{"forwardConfig":{"targetGroups":[{"serviceName":"nginx-service-x-test-x-suffix","servicePort":"80","weight":100}]}}`,
"alb.ingress.kubernetes.io/actions.ssl-redirect-x-test-x-suffix": `{"type":"redirect","forwardConfig":{},"redirectConfig":{"Port":"443","Protocol":"HTTPS","StatusCode":"HTTP_301"}}`,
},
},
Expand Down
6 changes: 4 additions & 2 deletions pkg/controllers/resources/ingresses/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ func getActionOrConditionValue(annotation, actionOrCondition string) string {

// ref https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/pkg/ingress/config_types.go
type actionPayload struct {
Type string `json:"type,omitempty"`
ForwardConfig struct {
Type string `json:"type,omitempty"`
TargetGroupARN *string `json:"targetGroupARN,omitempty"`
FixedResponseConfig map[string]interface{} `json:"fixedResponseConfig,omitempty"`
ForwardConfig struct {
TargetGroups []map[string]interface{} `json:"targetGroups,omitempty"`
TargetGroupStickinessConfig map[string]interface{} `json:"targetGroupStickinessConfig,omitempty"`
} `json:"forwardConfig,omitempty"`
Expand Down

0 comments on commit 4167783

Please sign in to comment.