PREvant's companions' configuration includes templating
capabilities. On top of that there is the possibility to define additional
parameters that are defined by an additional schema in the companions
configuration section. Based on the example from companions
documentation
the following code block illustrates how one could provide an optional enum
value to initialize the environment with some test users.
[companions.templating.userDefinedSchema]
type = "object"
properties = {
testUsers = { type = "string", enum = ["regular", "admins"] }
}
[[companions.bootstrapping.containers]]
image = "registry.example.com/user/bootstrap-helm-chart:latest"
args = [
"--set", "keycloak.httpRelativePath=/{{application.name}}/keycloak/",
"--set", "keycloak.redirectUris[0]={{application.baseUrl}}oauth_redir",
"--set", "keycloak.config.testUsers={{ userDefined.testUsers }}"
]
The hypothetical Helm chart value parameter keycloak.config.testUsers
may
allow to use two kind of test users (regular users and admin users) and thus
the userDefinedSchema
configuration provides a JSON Schema that validates
the payload used for deploying can optionally contain a definition for the test
users (see API documentation POST /api/apps/<app_name>
).
{
"userDefined": {
"testUsers": "regular"
}
}
Note, the services
field can be empty in this case because all deployed
services will be defined by the bootstrapping image.