Skip to content

Commit

Permalink
Merge pull request #88 from projectsyn/feat/k8s-1.22
Browse files Browse the repository at this point in the history
Generate Ingress with `apiVersion: networking.k8s.io/v1`
  • Loading branch information
simu authored Nov 10, 2021
2 parents 2d244c1 + 1360220 commit d7ddf23
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 46 deletions.
8 changes: 4 additions & 4 deletions class/keycloak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ parameters:
helm_params:
release_name: ${keycloak:release_name}
namespace: "${keycloak:namespace}"
# Tell Helm to generate networking.k8s.io/v1 Ingress objects
# This specifies argument `-a networking.k8s.io/v1/Ingress` for
# `helm template`.
api_versions: networking.k8s.io/v1/Ingress
helm_values: ${keycloak:helm_values}
commodore:
postprocess:
filters:
- type: jsonnet
filter: postprocess/api_version.jsonnet
path: ${_instance}/01_keycloak_helmchart/keycloak/charts/postgresql/templates
enabled: "${keycloak:helm_values:postgresql:enabled}"
- type: jsonnet
filter: postprocess/extra-env.jsonnet
path: ${_instance}/01_keycloak_helmchart/keycloak/templates
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ chart] on a Syn-enabled cluster.
The component defaults to provisioning a Bitnami Postgres database via the
Keycloak helm chart, but this behavior can be overridden using the
`keycloak.postgres` parameters exposed by the component.

[NOTE]
====
This component doesn't support Kubernetes versions older than 1.14 anymore.
This is because it generates `Ingress` resources with `apiVersion: networking.k8s.io/v1`.
====
42 changes: 0 additions & 42 deletions postprocess/api_version.jsonnet

This file was deleted.

12 changes: 12 additions & 0 deletions tests/builtin/ingress_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package builtin

import (
"testing"

"github.com/projectsyn/component-keycloak/common"
)


func Test_IngressApiVersion(t *testing.T) {
common.IngressApiVersionTest(t, testPath)
}
19 changes: 19 additions & 0 deletions tests/common/apiversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package common

import (
"testing"

"github.com/stretchr/testify/assert"
networkingv1 "k8s.io/api/networking/v1"
)

var (
ingressPath = "/01_keycloak_helmchart/keycloak/templates/ingress.yaml"
)

func IngressApiVersionTest(t *testing.T, basepath string) {
subject := &networkingv1.Ingress{}
scheme := NewSchemeWithDefault(t)
ingress := DecodeWithSchema(t, basepath+ingressPath, subject,scheme).(*networkingv1.Ingress)
assert.Equal(t, "keycloak", ingress.Name)
}
12 changes: 12 additions & 0 deletions tests/external/ingress_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package external

import (
"testing"

"github.com/projectsyn/component-keycloak/common"
)


func Test_IngressApiVersion(t *testing.T) {
common.IngressApiVersionTest(t, testPath)
}

0 comments on commit d7ddf23

Please sign in to comment.