Skip to content

Commit

Permalink
Add UI configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <[email protected]>
  • Loading branch information
stefanprodan committed Sep 23, 2023
1 parent 6316e21 commit e816d1b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
10 changes: 9 additions & 1 deletion timoni/podinfo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ timoni -n default apply podinfo oci://ghcr.io/stefanprodan/modules/podinfo
To install a specific module version:

```shell
timoni -n default apply podinfo oci://ghcr.io/stefanprodan/modules/podinfo -v 6.3.5
timoni -n default apply podinfo oci://ghcr.io/stefanprodan/modules/podinfo -v 6.5.0
```

To change the [default configuration](#configuration),
Expand Down Expand Up @@ -129,3 +129,11 @@ values: {
|----------------------|----------|---------|---------------------------------------------------------|
| `caching: enabled:` | `bool` | `false` | Enable Redis caching |
| `caching: redisURL:` | `string` | `""` | Redis URL in the format `tcp://:[password]@host[:port]` |

### UI values

| Key | Type | Default | Description |
|----------------|----------|-----------|------------------|
| `ui: color:` | `string` | `#34577c` | Background color |
| `ui: message:` | `string` | `""` | Greeting message |
| `ui: backend:` | `string` | `""` | Backend URL |
7 changes: 7 additions & 0 deletions timoni/podinfo/templates/config.cue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import (

// Config defines the schema and defaults for the Instance values.
#Config: {
// UI setting
ui: {
color: *"#34577c" | string
message?: string
backend?: string
}

// Runtime version info
moduleVersion!: string
kubeVersion!: string
Expand Down
30 changes: 30 additions & 0 deletions timoni/podinfo/templates/deployment.cue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ import (
if _config.securityContext != _|_ {
securityContext: _config.securityContext
}
env: [
{
name: "PODINFO_UI_COLOR"
value: _config.ui.color
},
if _config.ui.message != _|_ {
{
name: "PODINFO_UI_MESSAGE"
value: _config.ui.message
}
},
if _config.ui.backend != _|_ {
{
name: "PODINFO_BACKEND_URL"
value: _config.ui.backend
}
},
]
command: [
"./podinfo",
"--level=info",
Expand All @@ -85,6 +103,12 @@ import (
"--cache-server=\(_config.caching.redisURL)"
},
]
volumeMounts: [
{
name: "data"
mountPath: "/data"
},
]
},
]
if _config.podSecurityContext != _|_ {
Expand All @@ -102,6 +126,12 @@ import (
if _config.imagePullSecrets != _|_ {
imagePullSecrets: _config.imagePullSecrets
}
volumes: [
{
name: "data"
emptyDir: {}
},
]
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions timoni/podinfo/test_values.cue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package main

values: {
ui: backend: "http://backend.default.svc.cluster.local/echo"

metadata: {
labels: "app.kubernetes.io/part-of": "podinfo"
annotations: "app.kubernetes.io/team": "dev"
Expand Down

0 comments on commit e816d1b

Please sign in to comment.