Loading assets/auto-deploy-app/README.md +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ | gitlab.env | GitLab environment slug. | `nil` | | gitlab.envName | GitLab environment name. | `nil` | | gitlab.envURL | GitLab environment URL. | `nil` | | gitlab.projectID | Gitlab project ID. | `nil` | | service.enabled | | `true` | | service.annotations | Service annotations | `{}` | | service.name | | `web` | Loading assets/auto-deploy-app/templates/cilium-network-policy.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ metadata: "app.gitlab.com/alert": "true" {{- end }} labels: app.gitlab.com/proj: {{ .Values.gitlab.proj | quote }} app.gitlab.com/proj: {{ .Values.gitlab.projectID | default "" | quote }} {{ include "sharedlabels" . | indent 4}} spec: {{ toYaml .Values.ciliumNetworkPolicy.spec | indent 2 }} Loading assets/auto-deploy-app/test/templates/ciliumnetworkpolicy_test.go +34 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,17 @@ func TestCiliumNetworkPolicy(t *testing.T) { releaseName := "cilium-network-policy-test" templates := []string{"templates/cilium-network-policy.yaml"} expectedLabels := map[string]string{ "app": releaseName, "chart": chartName, "release": releaseName, "heritage": "Helm", "app.kubernetes.io/name": releaseName, "helm.sh/chart": chartName, "app.kubernetes.io/managed-by": "Helm", "app.kubernetes.io/instance": releaseName, "app.gitlab.com/proj": "", } expectedLabelsWithProjectID := map[string]string{ "app": releaseName, "chart": chartName, "release": releaseName, Loading Loading @@ -44,8 +55,8 @@ func TestCiliumNetworkPolicy(t *testing.T) { expectedErrorRegexp: regexp.MustCompile("Error: could not find template templates/cilium-network-policy.yaml in chart"), }, { name: "with default policy", values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.proj": "91"}, name: "with default policy without project ID", values: map[string]string{"ciliumNetworkPolicy.enabled": "true"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, Loading @@ -60,11 +71,28 @@ func TestCiliumNetworkPolicy(t *testing.T) { }, }, }, { name: "with default policy", values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.projectID": "91"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabelsWithProjectID}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, }, ingress: []api.IngressRule{ { FromEndpoints: []api.EndpointSelector{ {LabelSelector: &slim_metav1.LabelSelector{ MatchLabels: map[string]string{"any.app.gitlab.com/managed_by": "gitlab"}, }}, }, }, }, }, { name: "with custom policy without alerts", valueFiles: []string{"../testdata/custom-cilium-policy.yaml"}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.proj": "91", "ciliumNetworkPolicy.alerts.enabled": "false"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.projectID": "91", "ciliumNetworkPolicy.alerts.enabled": "false"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabelsWithProjectID}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, }, Loading @@ -81,8 +109,8 @@ func TestCiliumNetworkPolicy(t *testing.T) { { name: "with custom policy with alerts", valueFiles: []string{"../testdata/custom-cilium-policy.yaml"}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.proj": "91"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels, Annotations: map[string]string{"app.gitlab.com/alert": "true"}}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.projectID": "91"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabelsWithProjectID, Annotations: map[string]string{"app.gitlab.com/alert": "true"}}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, }, Loading src/bin/auto-deploy +2 −2 Original line number Diff line number Diff line Loading @@ -303,7 +303,7 @@ channel 1 database.' --set gitlab.env="$CI_ENVIRONMENT_SLUG" \ --set gitlab.envName="$CI_ENVIRONMENT_NAME" \ --set gitlab.envURL="$CI_ENVIRONMENT_URL" \ --set gitlab.proj="$CI_PROJECT_ID" \ --set gitlab.projectID="$CI_PROJECT_ID" \ --set releaseOverride="$RELEASE_NAME" \ --set image.repository="$image_repository" \ --set-string image.tag="$image_tag" \ Loading Loading @@ -338,7 +338,7 @@ channel 1 database.' --set gitlab.env="$CI_ENVIRONMENT_SLUG" \ --set gitlab.envName="$CI_ENVIRONMENT_NAME" \ --set gitlab.envURL="$CI_ENVIRONMENT_URL" \ --set gitlab.proj="$CI_PROJECT_ID" \ --set gitlab.projectID="$CI_PROJECT_ID" \ --set releaseOverride="$RELEASE_NAME" \ --set image.repository="$image_repository" \ --set-string image.tag="$image_tag" \ Loading Loading
assets/auto-deploy-app/README.md +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ | gitlab.env | GitLab environment slug. | `nil` | | gitlab.envName | GitLab environment name. | `nil` | | gitlab.envURL | GitLab environment URL. | `nil` | | gitlab.projectID | Gitlab project ID. | `nil` | | service.enabled | | `true` | | service.annotations | Service annotations | `{}` | | service.name | | `web` | Loading
assets/auto-deploy-app/templates/cilium-network-policy.yaml +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ metadata: "app.gitlab.com/alert": "true" {{- end }} labels: app.gitlab.com/proj: {{ .Values.gitlab.proj | quote }} app.gitlab.com/proj: {{ .Values.gitlab.projectID | default "" | quote }} {{ include "sharedlabels" . | indent 4}} spec: {{ toYaml .Values.ciliumNetworkPolicy.spec | indent 2 }} Loading
assets/auto-deploy-app/test/templates/ciliumnetworkpolicy_test.go +34 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,17 @@ func TestCiliumNetworkPolicy(t *testing.T) { releaseName := "cilium-network-policy-test" templates := []string{"templates/cilium-network-policy.yaml"} expectedLabels := map[string]string{ "app": releaseName, "chart": chartName, "release": releaseName, "heritage": "Helm", "app.kubernetes.io/name": releaseName, "helm.sh/chart": chartName, "app.kubernetes.io/managed-by": "Helm", "app.kubernetes.io/instance": releaseName, "app.gitlab.com/proj": "", } expectedLabelsWithProjectID := map[string]string{ "app": releaseName, "chart": chartName, "release": releaseName, Loading Loading @@ -44,8 +55,8 @@ func TestCiliumNetworkPolicy(t *testing.T) { expectedErrorRegexp: regexp.MustCompile("Error: could not find template templates/cilium-network-policy.yaml in chart"), }, { name: "with default policy", values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.proj": "91"}, name: "with default policy without project ID", values: map[string]string{"ciliumNetworkPolicy.enabled": "true"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, Loading @@ -60,11 +71,28 @@ func TestCiliumNetworkPolicy(t *testing.T) { }, }, }, { name: "with default policy", values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.projectID": "91"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabelsWithProjectID}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, }, ingress: []api.IngressRule{ { FromEndpoints: []api.EndpointSelector{ {LabelSelector: &slim_metav1.LabelSelector{ MatchLabels: map[string]string{"any.app.gitlab.com/managed_by": "gitlab"}, }}, }, }, }, }, { name: "with custom policy without alerts", valueFiles: []string{"../testdata/custom-cilium-policy.yaml"}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.proj": "91", "ciliumNetworkPolicy.alerts.enabled": "false"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.projectID": "91", "ciliumNetworkPolicy.alerts.enabled": "false"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabelsWithProjectID}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, }, Loading @@ -81,8 +109,8 @@ func TestCiliumNetworkPolicy(t *testing.T) { { name: "with custom policy with alerts", valueFiles: []string{"../testdata/custom-cilium-policy.yaml"}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.proj": "91"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels, Annotations: map[string]string{"app.gitlab.com/alert": "true"}}, values: map[string]string{"ciliumNetworkPolicy.enabled": "true", "gitlab.projectID": "91"}, meta: metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabelsWithProjectID, Annotations: map[string]string{"app.gitlab.com/alert": "true"}}, endpointSelector: api.EndpointSelector{ LabelSelector: &slim_metav1.LabelSelector{MatchLabels: map[string]string(nil)}, }, Loading
src/bin/auto-deploy +2 −2 Original line number Diff line number Diff line Loading @@ -303,7 +303,7 @@ channel 1 database.' --set gitlab.env="$CI_ENVIRONMENT_SLUG" \ --set gitlab.envName="$CI_ENVIRONMENT_NAME" \ --set gitlab.envURL="$CI_ENVIRONMENT_URL" \ --set gitlab.proj="$CI_PROJECT_ID" \ --set gitlab.projectID="$CI_PROJECT_ID" \ --set releaseOverride="$RELEASE_NAME" \ --set image.repository="$image_repository" \ --set-string image.tag="$image_tag" \ Loading Loading @@ -338,7 +338,7 @@ channel 1 database.' --set gitlab.env="$CI_ENVIRONMENT_SLUG" \ --set gitlab.envName="$CI_ENVIRONMENT_NAME" \ --set gitlab.envURL="$CI_ENVIRONMENT_URL" \ --set gitlab.proj="$CI_PROJECT_ID" \ --set gitlab.projectID="$CI_PROJECT_ID" \ --set releaseOverride="$RELEASE_NAME" \ --set image.repository="$image_repository" \ --set-string image.tag="$image_tag" \ Loading