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
3 changes: 3 additions & 0 deletions charts/camunda-platform-8.8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ Please see the corresponding [release guide](../../docs/release.md) to find out
| `global.ingress.enabled` | if true, an ingress resource is deployed. Only useful if an ingress controller is available, like Ingress-NGINX. | `false` |
| `global.ingress.external` | if true, the Ingress object will not be rendered. This setting is used when a non-Ingress resource, like a service mesh, is used to access the cluster. | `false` |
| `global.ingress.className` | Ingress.className defines the class or configuration of ingress which should be used by the controller | `nginx` |
| `global.ingress.labels` | can be used to define labels which will be applied to the global HTTP ingress resource | `{}` |
| `global.ingress.annotations` | defines the ingress related annotations, consumed mostly by the ingress controller | `{}` |
| `global.ingress.host` | If not specified the rules applies to all inbound http traffic, if specified the rule applies to that host. | `""` |
| `global.ingress.pathType` | can be used to define the Ingress path type. https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types | `Prefix` |
Expand Down Expand Up @@ -767,6 +768,7 @@ Please see the corresponding [release guide](../../docs/release.md) to find out
| `identityKeycloak.ingress.enabled` | can be used enable ingress record generation for Keycloak. | `false` |
| `identityKeycloak.ingress.tls` | can be used to enable TLS configuration for the host defined at ingress.hostname parameter. | `false` |
| `identityKeycloak.ingress.extraTls` | configuration for additional hostnames to be covered with this ingress record. | `[]` |
| `identityKeycloak.ingress.labels` | can be used to define labels which will be applied to the Keycloak ingress resource | `{}` |
| `identityKeycloak.ingress.annotations` | configures annotations to be applied to the ingress record. | `{}` |
| `identityKeycloak.ingress.pathType` | defines Ingress path type. | `Prefix` |
| `identityKeycloak.service` | configuration, to configure the service which is deployed along with keycloak | |
Expand Down Expand Up @@ -1390,6 +1392,7 @@ Please see the corresponding [release guide](../../docs/release.md) to find out
| `orchestration.ingress.grpc.enabled` | if true, an ingress resource is deployed with the Zeebe gateway deployment. Only useful if an ingress controller is available, like nginx. | `false` |
| `orchestration.ingress.grpc.external` | if true, the Ingress object will not be rendered. This setting is used when a non-Ingress resource, like a service mesh, is used to access the cluster. | `false` |
| `orchestration.ingress.grpc.className` | defines the class or configuration of ingress which should be used by the controller | `nginx` |
| `orchestration.ingress.grpc.labels` | can be used to define labels which will be applied to the orchestration gRPC ingress resource | `{}` |
| `orchestration.ingress.grpc.annotations` | defines the ingress related annotations, consumed mostly by the ingress controller | `{}` |
| `orchestration.ingress.grpc.path` | defines the path which is associated with the Zeebe gateway's gRPC service and port https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-rules | `/` |
| `orchestration.ingress.grpc.pathType` | can be used to define the Ingress path type. https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types | `Prefix` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ kind: Ingress
metadata:
name: {{ include "camundaPlatform.fullname" . }}-grpc
labels:
{{- include "camundaPlatform.labels" . | nindent 4 }}
{{- include "common.tplvalues.merge-overwrite" (dict
"values" (list
(include "camundaPlatform.labels" .)
.Values.orchestration.ingress.grpc.labels
)
"context" .
) | nindent 4 }}
{{- with .Values.orchestration.ingress.grpc.annotations }}
annotations:
{{- tpl (toYaml .) $ | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ kind: Ingress
metadata:
name: {{ include "camundaPlatform.fullname" . }}-http
labels:
{{- include "camundaPlatform.labels" . | nindent 4 }}
{{- include "common.tplvalues.merge-overwrite" (dict
"values" (list
(include "camundaPlatform.labels" .)
.Values.global.ingress.labels
)
"context" .
) | nindent 4 }}
{{- with .Values.global.ingress.annotations }}
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
Expand Down
182 changes: 182 additions & 0 deletions charts/camunda-platform-8.8/test/unit/common/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,188 @@ func (s *IngressTemplateTest) TestDifferentValuesInputs() {
require.NotContains(t, output, "kind: Ingress")
},
},
{
Name: "TestIngressWithGlobalLabels",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"global.ingress.enabled": "true",
"global.ingress.labels.test-label": "test-value",
"global.ingress.labels.external-dns": "enabled",
"global.ingress.labels.nginx\\.ingress\\.class": "public",
},
Verifier: func(t *testing.T, output string, err error) {
var ingress netv1.Ingress
helm.UnmarshalK8SYaml(t, output, &ingress)

// then
s.Require().Equal("test-value", ingress.Labels["test-label"])
s.Require().Equal("enabled", ingress.Labels["external-dns"])
s.Require().Equal("public", ingress.Labels["nginx.ingress.class"])
},
},
{
Name: "TestIngressWithoutLabels",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"global.ingress.enabled": "true",
},
Verifier: func(t *testing.T, output string, err error) {
var ingress netv1.Ingress
helm.UnmarshalK8SYaml(t, output, &ingress)

// then - should only have default chart labels, not custom labels
s.Require().NotContains(ingress.Labels, "test-label")
s.Require().NotContains(ingress.Labels, "external-dns")
// But should still have standard chart labels
s.Require().Contains(ingress.Labels, "app")
s.Require().Contains(ingress.Labels, "app.kubernetes.io/name")
},
},
{
Name: "TestHttpIngressLabelMergeOverwrite",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"global.ingress.enabled": "true",
"global.commonLabels.app": "common-override",
"global.commonLabels.environment": "common-env",
"global.ingress.labels.app": "ingress-override",
"global.ingress.labels.team": "ingress-team",
},
Verifier: func(t *testing.T, output string, err error) {
var ingress netv1.Ingress
helm.UnmarshalK8SYaml(t, output, &ingress)

// then - ingress labels should override common labels for same keys
s.Require().Equal("ingress-override", ingress.Labels["app"], "ingress labels should override common labels for same key")
// and common labels should be present when no ingress label conflicts
s.Require().Equal("common-env", ingress.Labels["environment"], "common labels should be present when not overridden")
// and ingress-specific labels should be present
s.Require().Equal("ingress-team", ingress.Labels["team"], "ingress labels should be present")
// standard chart labels should still be there for non-conflicting keys
s.Require().Contains(ingress.Labels, "app.kubernetes.io/name")
},
},
}

testhelpers.RunTestCasesE(s.T(), s.chartPath, s.release, s.namespace, s.templates, testCases)
}

type GrpcIngressTemplateTest struct {
suite.Suite
chartPath string
release string
namespace string
templates []string
extraArgs []string
}

func TestGrpcIngressTemplate(t *testing.T) {
t.Parallel()

chartPath, err := filepath.Abs("../../../")
require.NoError(t, err)

suite.Run(t, &GrpcIngressTemplateTest{
chartPath: chartPath,
release: "camunda-platform-test",
namespace: "camunda-platform-" + strings.ToLower(random.UniqueId()),
templates: []string{"templates/common/ingress-grpc.yaml"},
})
}

func (s *GrpcIngressTemplateTest) TestDifferentValuesInputs() {
testCases := []testhelpers.TestCase{
{
Name: "TestGrpcIngressWithLabels",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"orchestration.enabled": "true",
"orchestration.ingress.grpc.enabled": "true",
"orchestration.ingress.grpc.labels.test-label": "grpc-test-value",
"orchestration.ingress.grpc.labels.external-dns": "grpc-enabled",
"orchestration.ingress.grpc.labels.grpc-service": "zeebe-gateway",
},
Verifier: func(t *testing.T, output string, err error) {
var ingress netv1.Ingress
helm.UnmarshalK8SYaml(t, output, &ingress)

// then
s.Require().Equal("grpc-test-value", ingress.Labels["test-label"])
s.Require().Equal("grpc-enabled", ingress.Labels["external-dns"])
s.Require().Equal("zeebe-gateway", ingress.Labels["grpc-service"])
},
},
{
Name: "TestGrpcIngressWithoutLabels",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"orchestration.enabled": "true",
"orchestration.ingress.grpc.enabled": "true",
},
Verifier: func(t *testing.T, output string, err error) {
var ingress netv1.Ingress
helm.UnmarshalK8SYaml(t, output, &ingress)

// then - should only have default chart labels, not custom labels
s.Require().NotContains(ingress.Labels, "test-label")
s.Require().NotContains(ingress.Labels, "external-dns")
// But should still have standard chart labels
s.Require().Contains(ingress.Labels, "app")
s.Require().Contains(ingress.Labels, "app.kubernetes.io/name")
},
},
{
Name: "TestGrpcIngressDisabled",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"orchestration.enabled": "true",
"orchestration.ingress.grpc.enabled": "false",
"orchestration.ingress.grpc.labels.test-label": "should-not-appear",
},
Verifier: func(t *testing.T, output string, err error) {
// then - no ingress should be rendered
require.NotContains(t, output, "kind: Ingress")
},
},
{
Name: "TestGrpcIngressExternal",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"orchestration.enabled": "true",
"orchestration.ingress.grpc.enabled": "true",
"orchestration.ingress.grpc.external": "true",
"orchestration.ingress.grpc.labels.test-label": "should-not-appear",
},
Verifier: func(t *testing.T, output string, err error) {
// then - no ingress should be rendered when external is true
require.NotContains(t, output, "kind: Ingress")
},
},
{
Name: "TestGrpcIngressLabelMergeOverwrite",
HelmOptionsExtraArgs: map[string][]string{"install": {"--debug"}},
Values: map[string]string{
"orchestration.enabled": "true",
"orchestration.ingress.grpc.enabled": "true",
"global.commonLabels.app": "common-grpc-override",
"global.commonLabels.environment": "common-grpc-env",
"orchestration.ingress.grpc.labels.app": "grpc-specific-override",
"orchestration.ingress.grpc.labels.protocol": "grpc",
},
Verifier: func(t *testing.T, output string, err error) {
var ingress netv1.Ingress
helm.UnmarshalK8SYaml(t, output, &ingress)

// then - grpc-specific labels should override common labels for same keys
s.Require().Equal("grpc-specific-override", ingress.Labels["app"], "grpc labels should override common labels for same key")
// and common labels should be present when no grpc label conflicts
s.Require().Equal("common-grpc-env", ingress.Labels["environment"], "common labels should be present when not overridden")
// and grpc-specific labels should be present
s.Require().Equal("grpc", ingress.Labels["protocol"], "grpc-specific labels should be present")
// standard chart labels should still be there for non-conflicting keys
s.Require().Contains(ingress.Labels, "app.kubernetes.io/name")
},
},
}

testhelpers.RunTestCasesE(s.T(), s.chartPath, s.release, s.namespace, s.templates, testCases)
Expand Down
Loading
Loading