From 1cb54d83f932dffc415c14a48596165aed820da9 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Tue, 6 Dec 2022 11:10:19 +1100 Subject: [PATCH] chore: add primaryingress label to primary ingress --- internal/templating/ingress/templates_ingress.go | 2 ++ .../ingress/test-resources/result-active-standby1.yaml | 1 + .../ingress/test-resources/result-custom-ingress1.yaml | 1 + test-resources/template-ingress/test1-results/example.com.yaml | 1 + .../template-ingress/test10-results/standby.example.com.yaml | 1 + .../template-ingress/test11-results/content.example.com.yaml | 1 + .../template-ingress/test12-results/test1.example.com.yaml | 1 + test-resources/template-ingress/test13-results/example.com.yaml | 1 + test-resources/template-ingress/test14-results/example.com.yaml | 1 + test-resources/template-ingress/test15-results/example.com.yaml | 1 + test-resources/template-ingress/test16-results/example.com.yaml | 1 + test-resources/template-ingress/test17-results/example.com.yaml | 1 + test-resources/template-ingress/test18-results/example.com.yaml | 1 + test-resources/template-ingress/test2-results/example.com.yaml | 1 + test-resources/template-ingress/test3-results/example.com.yaml | 1 + test-resources/template-ingress/test4-results/example.com.yaml | 1 + .../template-ingress/test5-results/multiproject1.com.yaml | 1 + .../template-ingress/test6-results/multiproject2.com.yaml | 1 + test-resources/template-ingress/test7-results/example.com.yaml | 1 + .../test8-results/customdomain-will-be-main-domain.com.yaml | 1 + .../template-ingress/test9-results/active.example.com.yaml | 1 + 21 files changed, 22 insertions(+) diff --git a/internal/templating/ingress/templates_ingress.go b/internal/templating/ingress/templates_ingress.go index f6f53ceb..a2a687f9 100644 --- a/internal/templating/ingress/templates_ingress.go +++ b/internal/templating/ingress/templates_ingress.go @@ -90,6 +90,8 @@ func GenerateIngressTemplate( // check if monitoring enabled, route isn't autogenerated, and the primary ingress from the .lagoon.yml is this processed routedomain // and enable monitoring on the primary ingress only. if lValues.Monitoring.Enabled && !route.Autogenerated && primaryIngress.Host == routeDomain { + additionalLabels["lagoon.sh/primaryingress"] = "true" + // only add the monitring annotations if monitoring is enabled additionalAnnotations["monitor.stakater.com/enabled"] = "true" additionalAnnotations["uptimerobot.monitor.stakater.com/alert-contacts"] = "unconfigured" diff --git a/internal/templating/ingress/test-resources/result-active-standby1.yaml b/internal/templating/ingress/test-resources/result-active-standby1.yaml index 0eb35993..0403c6fd 100644 --- a/internal/templating/ingress/test-resources/result-active-standby1.yaml +++ b/internal/templating/ingress/test-resources/result-active-standby1.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: environment-with-really-really-reall-3fdb lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: extra-long-name-f6c8a lagoon.sh/service-type: custom-ingress diff --git a/internal/templating/ingress/test-resources/result-custom-ingress1.yaml b/internal/templating/ingress/test-resources/result-custom-ingress1.yaml index 0469c297..b83eab4a 100644 --- a/internal/templating/ingress/test-resources/result-custom-ingress1.yaml +++ b/internal/templating/ingress/test-resources/result-custom-ingress1.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: environment-with-really-really-reall-3fdb lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: extra-long-name-f6c8a lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test1-results/example.com.yaml b/test-resources/template-ingress/test1-results/example.com.yaml index ace49c1c..03961f71 100644 --- a/test-resources/template-ingress/test1-results/example.com.yaml +++ b/test-resources/template-ingress/test1-results/example.com.yaml @@ -27,6 +27,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test10-results/standby.example.com.yaml b/test-resources/template-ingress/test10-results/standby.example.com.yaml index 263ea5cd..2903a40c 100644 --- a/test-resources/template-ingress/test10-results/standby.example.com.yaml +++ b/test-resources/template-ingress/test10-results/standby.example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main2 lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: standby.example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test11-results/content.example.com.yaml b/test-resources/template-ingress/test11-results/content.example.com.yaml index 6f60537a..6f345091 100644 --- a/test-resources/template-ingress/test11-results/content.example.com.yaml +++ b/test-resources/template-ingress/test11-results/content.example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: production lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: content-example-com lagoon.sh/service: content.example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test12-results/test1.example.com.yaml b/test-resources/template-ingress/test12-results/test1.example.com.yaml index a23c0658..4378214c 100644 --- a/test-resources/template-ingress/test12-results/test1.example.com.yaml +++ b/test-resources/template-ingress/test12-results/test1.example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: test1.example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test13-results/example.com.yaml b/test-resources/template-ingress/test13-results/example.com.yaml index d9e0eb15..26015585 100644 --- a/test-resources/template-ingress/test13-results/example.com.yaml +++ b/test-resources/template-ingress/test13-results/example.com.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test14-results/example.com.yaml b/test-resources/template-ingress/test14-results/example.com.yaml index 3a2a7a42..a84e825b 100644 --- a/test-resources/template-ingress/test14-results/example.com.yaml +++ b/test-resources/template-ingress/test14-results/example.com.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test15-results/example.com.yaml b/test-resources/template-ingress/test15-results/example.com.yaml index 3a2a7a42..a84e825b 100644 --- a/test-resources/template-ingress/test15-results/example.com.yaml +++ b/test-resources/template-ingress/test15-results/example.com.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test16-results/example.com.yaml b/test-resources/template-ingress/test16-results/example.com.yaml index a24149a4..2658b879 100644 --- a/test-resources/template-ingress/test16-results/example.com.yaml +++ b/test-resources/template-ingress/test16-results/example.com.yaml @@ -29,6 +29,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test17-results/example.com.yaml b/test-resources/template-ingress/test17-results/example.com.yaml index db0fab10..95dff4fe 100644 --- a/test-resources/template-ingress/test17-results/example.com.yaml +++ b/test-resources/template-ingress/test17-results/example.com.yaml @@ -29,6 +29,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test18-results/example.com.yaml b/test-resources/template-ingress/test18-results/example.com.yaml index 872863e6..721bda7c 100644 --- a/test-resources/template-ingress/test18-results/example.com.yaml +++ b/test-resources/template-ingress/test18-results/example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test2-results/example.com.yaml b/test-resources/template-ingress/test2-results/example.com.yaml index ec0d7a41..910ce5b3 100644 --- a/test-resources/template-ingress/test2-results/example.com.yaml +++ b/test-resources/template-ingress/test2-results/example.com.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test3-results/example.com.yaml b/test-resources/template-ingress/test3-results/example.com.yaml index ec0d7a41..910ce5b3 100644 --- a/test-resources/template-ingress/test3-results/example.com.yaml +++ b/test-resources/template-ingress/test3-results/example.com.yaml @@ -26,6 +26,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test4-results/example.com.yaml b/test-resources/template-ingress/test4-results/example.com.yaml index 872863e6..721bda7c 100644 --- a/test-resources/template-ingress/test4-results/example.com.yaml +++ b/test-resources/template-ingress/test4-results/example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test5-results/multiproject1.com.yaml b/test-resources/template-ingress/test5-results/multiproject1.com.yaml index 0ad28006..e4d99686 100644 --- a/test-resources/template-ingress/test5-results/multiproject1.com.yaml +++ b/test-resources/template-ingress/test5-results/multiproject1.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: multiproject lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: multiproject1 lagoon.sh/service: multiproject1.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test6-results/multiproject2.com.yaml b/test-resources/template-ingress/test6-results/multiproject2.com.yaml index 52ec7102..0c0d6fbf 100644 --- a/test-resources/template-ingress/test6-results/multiproject2.com.yaml +++ b/test-resources/template-ingress/test6-results/multiproject2.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: multiproject lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: multiproject2 lagoon.sh/service: multiproject2.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test7-results/example.com.yaml b/test-resources/template-ingress/test7-results/example.com.yaml index 872863e6..721bda7c 100644 --- a/test-resources/template-ingress/test7-results/example.com.yaml +++ b/test-resources/template-ingress/test7-results/example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: example.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml b/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml index 614d6690..ae3b1082 100644 --- a/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml +++ b/test-resources/template-ingress/test8-results/customdomain-will-be-main-domain.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: branch-routes lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: customdomain-will-be-main-domain.com lagoon.sh/service-type: custom-ingress diff --git a/test-resources/template-ingress/test9-results/active.example.com.yaml b/test-resources/template-ingress/test9-results/active.example.com.yaml index 5c9025bd..44e060cc 100644 --- a/test-resources/template-ingress/test9-results/active.example.com.yaml +++ b/test-resources/template-ingress/test9-results/active.example.com.yaml @@ -25,6 +25,7 @@ metadata: lagoon.sh/buildType: branch lagoon.sh/environment: main lagoon.sh/environmentType: production + lagoon.sh/primaryingress: "true" lagoon.sh/project: example-project lagoon.sh/service: active.example.com lagoon.sh/service-type: custom-ingress