Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
[stable/keycloak] Refactor CLI scripts (#10503)
Browse files Browse the repository at this point in the history
Refactor custom CLI commands into their own files so they can also
be run separately with jboss-cli.sh for easier testing.

Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
  • Loading branch information
unguiculus authored and k8s-ci-robot committed Jan 9, 2019
1 parent 50497c0 commit bb47f58
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion stable/keycloak/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: keycloak
version: 4.1.0
version: 4.2.0
appVersion: 4.5.0.Final
description: Open Source Identity and Access Management For Modern Applications and Services
keywords:
Expand Down
6 changes: 6 additions & 0 deletions stable/keycloak/scripts/ha.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})

/subsystem=jgroups/channel=ee:write-attribute(name=stack, value=tcp)
3 changes: 3 additions & 0 deletions stable/keycloak/scripts/logging.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Allow log level to be configured via environment variable
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=${env.WILDFLY_LOGLEVEL:INFO})
/subsystem=logging/root-logger=ROOT:write-attribute(name=level, value=${env.WILDFLY_LOGLEVEL:INFO})
3 changes: 3 additions & 0 deletions stable/keycloak/scripts/node-identifier.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Sets the node identifier to the node name (= pod name). Node identifiers have to be unique. They can have a
## maximum length of 23 characters. Thus, the chart's fullname template truncates its length accordingly.
/subsystem=transactions:write-attribute(name=node-identifier, value=${jboss.node.name})
3 changes: 3 additions & 0 deletions stable/keycloak/scripts/reverse-proxy.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/socket-binding-group=standard-sockets/socket-binding=proxy-https:add(port=443)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=redirect-socket, value=proxy-https)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true)
10 changes: 5 additions & 5 deletions stable/keycloak/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ data:

{{- with .Values.keycloak.cli }}

{{ .nodeIdentifier | indent 4 }}
{{ tpl .nodeIdentifier $ | indent 4 }}

{{ .logging | indent 4 }}
{{ tpl .logging $ | indent 4 }}

{{ .reverseProxy | indent 4 }}
{{ tpl .reverseProxy $ | indent 4 }}

{{- if $highAvailability }}
{{ .ha | indent 4 }}
{{ tpl .ha $ | indent 4 }}
{{- end }}

{{- with .custom }}
{{ . | indent 4 }}
{{ tpl . $ | indent 4 }}
{{- end }}

{{- end }}
Expand Down
27 changes: 6 additions & 21 deletions stable/keycloak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,38 +110,23 @@ keycloak:
# cpu: "100m"
# memory: "1024Mi"

## WildFly CLI configurations. They all end up in the file 'keycloak.cli' configured in the configmap whichn is
## WildFly CLI configurations. They all end up in the file 'keycloak.cli' configured in the configmap which is
## executed on server startup.
cli:
## Sets the node identifier to the node name (= pod name). Node identifiers have to be unique. They can have a
## maximum length of 23 characters. Thus, the chart's fullname template truncates its length accordingly.
nodeIdentifier: |
# Makes node identifier unique getting rid of a warning in the logs
/subsystem=transactions:write-attribute(name=node-identifier, value=${jboss.node.name})
{{ .Files.Get "scripts/node-identifier.cli" }}
logging: |
# Allow log level to be configured via environment variable
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=${env.WILDFLY_LOGLEVEL:INFO})
/subsystem=logging/root-logger=ROOT:write-attribute(name=level, value=${env.WILDFLY_LOGLEVEL:INFO})
# Log only to console
/subsystem=logging/root-logger=ROOT:write-attribute(name=handlers, value=[CONSOLE])
{{ .Files.Get "scripts/logging.cli" }}
reverseProxy: |
/socket-binding-group=standard-sockets/socket-binding=proxy-https:add(port=443)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=redirect-socket, value=proxy-https)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true)
{{ .Files.Get "scripts/reverse-proxy.cli" }}
ha: |
/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures:write-attribute(name=owners, value=${env.CACHE_OWNERS:2})
/subsystem=jgroups/channel=ee:write-attribute(name=stack, value=tcp)
{{ .Files.Get "scripts/ha.cli" }}
# Custom CLI script
custom: ""
custom: |
## Add additional volumes and mounts, e. g. for custom themes
extraVolumes: |
Expand Down

0 comments on commit bb47f58

Please sign in to comment.