chore(common): add widget version on homepage integration (#29819)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  #29818 

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [x] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning
- [x] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
Stavros Kois
2024-12-11 11:48:43 +02:00
committed by GitHub
parent 12237d520f
commit 56a1632cb0
4 changed files with 72 additions and 35 deletions
@@ -85,6 +85,8 @@ tests:
traefik: *traefik traefik: *traefik
homepage: homepage:
enabled: true enabled: true
widget:
version: 2
hosts: hosts:
- host: "{{ .Values.someHost }}" - host: "{{ .Values.someHost }}"
paths: paths:
@@ -133,6 +135,7 @@ tests:
gethomepage.dev/widget.url: https://test-release-name-common-test.test-release-namespace.svc:9443 gethomepage.dev/widget.url: https://test-release-name-common-test.test-release-namespace.svc:9443
gethomepage.dev/icon: https://truecharts.org/img/hotlink-ok/chart-icons/common-test.webp gethomepage.dev/icon: https://truecharts.org/img/hotlink-ok/chart-icons/common-test.webp
gethomepage.dev/widget.type: commontest gethomepage.dev/widget.type: commontest
gethomepage.dev/widget.version: "1"
gethomepage.dev/pod-selector: app.kubernetes.io/instance=test-release-name,pod.lifecycle in (permanent) gethomepage.dev/pod-selector: app.kubernetes.io/instance=test-release-name,pod.lifecycle in (permanent)
- documentIndex: *ingressDoc - documentIndex: *ingressDoc
matchRegex: matchRegex:
@@ -165,6 +168,7 @@ tests:
gethomepage.dev/icon: some-icon gethomepage.dev/icon: some-icon
gethomepage.dev/widget.url: some-url gethomepage.dev/widget.url: some-url
gethomepage.dev/weight: "1" gethomepage.dev/weight: "1"
gethomepage.dev/widget.version: "1"
gethomepage.dev/widget.type: some-type gethomepage.dev/widget.type: some-type
gethomepage.dev/pod-selector: pod.name in (main,other),pod.lifecycle in (permanent) gethomepage.dev/pod-selector: pod.name in (main,other),pod.lifecycle in (permanent)
gethomepage.dev/widget.some-key: some-value gethomepage.dev/widget.some-key: some-value
@@ -193,6 +197,7 @@ tests:
gethomepage.dev/widget.url: http://test-release-name-common-test-my-service2.test-release-namespace.svc:80 gethomepage.dev/widget.url: http://test-release-name-common-test-my-service2.test-release-namespace.svc:80
gethomepage.dev/icon: https://truecharts.org/img/hotlink-ok/chart-icons/common-test.webp gethomepage.dev/icon: https://truecharts.org/img/hotlink-ok/chart-icons/common-test.webp
gethomepage.dev/widget.type: commontest gethomepage.dev/widget.type: commontest
gethomepage.dev/widget.version: "2"
gethomepage.dev/pod-selector: app.kubernetes.io/instance=test-release-name,pod.lifecycle in (permanent) gethomepage.dev/pod-selector: app.kubernetes.io/instance=test-release-name,pod.lifecycle in (permanent)
- documentIndex: *thirdIngressDoc - documentIndex: *thirdIngressDoc
equal: equal:
+1 -1
View File
@@ -48,4 +48,4 @@ sources:
- https://hub.docker.com/_/ - https://hub.docker.com/_/
- https://hub.docker.com/r/mikefarah/yq - https://hub.docker.com/r/mikefarah/yq
type: library type: library
version: 25.2.1 version: 25.2.2
@@ -23,6 +23,7 @@
{{- $defaultType = regexReplaceAll "\\W+" $defaultType "" -}} {{- $defaultType = regexReplaceAll "\\W+" $defaultType "" -}}
{{- $type := $homepage.widget.type | default $defaultType -}} {{- $type := $homepage.widget.type | default $defaultType -}}
{{- $url := $homepage.widget.url -}} {{- $url := $homepage.widget.url -}}
{{- $version := $homepage.widget.version | default 1 | toString -}}
{{- $href := $homepage.href -}} {{- $href := $homepage.href -}}
{{- if not $href -}} {{- if not $href -}}
@@ -64,6 +65,7 @@
{{- if $widEnabled -}} {{- if $widEnabled -}}
{{- $_ := set $objectData.annotations "gethomepage.dev/widget.type" (tpl $type $rootCtx) -}} {{- $_ := set $objectData.annotations "gethomepage.dev/widget.type" (tpl $type $rootCtx) -}}
{{- $_ := set $objectData.annotations "gethomepage.dev/widget.version" (tpl $version $rootCtx) -}}
{{- with $url -}} {{- with $url -}}
{{- $_ := set $objectData.annotations "gethomepage.dev/widget.url" (tpl $url $rootCtx) -}} {{- $_ := set $objectData.annotations "gethomepage.dev/widget.url" (tpl $url $rootCtx) -}}
@@ -29,8 +29,8 @@ Enables or Disables the homepage integration
| ---------- | --------------------------------------------- | | ---------- | --------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.enabled` | | Key | `ingress.$name.integrations.homepage.enabled` |
| Type | `bool` | | Type | `bool` |
| Required | ✅ | | Required | ✅ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `false` | | Default | `false` |
Example Example
@@ -59,8 +59,8 @@ Sets the `gethomepage.dev/name` annotation
| ---------- | ------------------------------------------ | | ---------- | ------------------------------------------ |
| Key | `ingress.$name.integrations.homepage.name` | | Key | `ingress.$name.integrations.homepage.name` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | The Release Name | | Default | The Release Name |
Example Example
@@ -89,8 +89,8 @@ Sets the `gethomepage.dev/description` annotation
| ---------- | ------------------------------------------------- | | ---------- | ------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.description` | | Key | `ingress.$name.integrations.homepage.description` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | The Description of the Chart | | Default | The Description of the Chart |
Example Example
@@ -119,8 +119,8 @@ Sets the `gethomepage.dev/group` annotation
| ---------- | ------------------------------------------- | | ---------- | ------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.group` | | Key | `ingress.$name.integrations.homepage.group` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `""` | | Default | `""` |
Example Example
@@ -149,8 +149,8 @@ Sets the `gethomepage.dev/icon` annotation
| ---------- | ------------------------------------------ | | ---------- | ------------------------------------------ |
| Key | `ingress.$name.integrations.homepage.icon` | | Key | `ingress.$name.integrations.homepage.icon` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | The Chart Icon | | Default | The Chart Icon |
Example Example
@@ -179,8 +179,8 @@ Sets the `gethomepage.dev/href` annotation
| ---------- | ------------------------------------------ | | ---------- | ------------------------------------------ |
| Key | `ingress.$name.integrations.homepage.href` | | Key | `ingress.$name.integrations.homepage.href` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | The first ingress host | | Default | The first ingress host |
Example Example
@@ -209,8 +209,8 @@ Sets the `gethomepage.dev/weight` annotation
| ---------- | -------------------------------------------- | | ---------- | -------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.weight` | | Key | `ingress.$name.integrations.homepage.weight` |
| Type | `int` | | Type | `int` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | unset | | Default | unset |
Example Example
@@ -239,8 +239,8 @@ Sets the `gethomepage.dev/pod-selector` annotation
| ---------- | ------------------------------------------------- | | ---------- | ------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.podSelector` | | Key | `ingress.$name.integrations.homepage.podSelector` |
| Type | `list` of `string` | | Type | `list` of `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `[]` | | Default | `[]` |
Example Example
@@ -265,8 +265,8 @@ Define configuration for the widget
| ---------- | -------------------------------------------- | | ---------- | -------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget` | | Key | `ingress.$name.integrations.homepage.widget` |
| Type | `map` | | Type | `map` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `{}` | | Default | `{}` |
Example Example
@@ -285,14 +285,13 @@ ingress:
Enables or Disables the widget Enables or Disables the widget
| | | | | |
| ---------- | ---------------------------------------------------- | | ---------- | ---------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.enabled` | | Key | `ingress.$name.integrations.homepage.widget.enabled` |
| Type | `bool` | | Type | `bool` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `true` | | Default | `true` |
Example Example
@@ -321,8 +320,8 @@ Sets the `gethomepage.dev/widget.type` annotation
| ---------- | ------------------------------------------------- | | ---------- | ------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.type` | | Key | `ingress.$name.integrations.homepage.widget.type` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | The Chart Name | | Default | The Chart Name |
Example Example
@@ -338,6 +337,37 @@ ingress:
--- ---
### `widget.version`
Define the version of the widget
:::note
Sets the `gethomepage.dev/widget.version` annotation
:::
| | |
| ---------- | ---------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.version` |
| Type | `int` |
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `1` |
Example
```yaml
ingress:
ingress-name:
integrations:
homepage:
widget:
version: 1
```
---
### `widget.url` ### `widget.url`
Define the url for the widget Define the url for the widget
@@ -352,8 +382,8 @@ Sets the `gethomepage.dev/widget.url` annotation
| ---------- | ------------------------------------------------ | | ---------- | ------------------------------------------------ |
| Key | `ingress.$name.integrations.homepage.widget.url` | | Key | `ingress.$name.integrations.homepage.widget.url` |
| Type | `string` | | Type | `string` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | The first ingress host | | Default | The first ingress host |
Example Example
@@ -383,8 +413,8 @@ Sets the `gethomepage.dev/widget.$key` annotation
| ---------- | --------------------------------------------------- | | ---------- | --------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.custom` | | Key | `ingress.$name.integrations.homepage.widget.custom` |
| Type | `map` | | Type | `map` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `{}` | | Default | `{}` |
Example Example
@@ -408,8 +438,8 @@ Define custom annotations for the widget as a list
| ---------- | ----------------------------------------------------- | | ---------- | ----------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.customkv` | | Key | `ingress.$name.integrations.homepage.widget.customkv` |
| Type | `list` of `map` | | Type | `list` of `map` |
| Required | ❌ | | Required | ❌ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `[]` | | Default | `[]` |
Example Example
@@ -439,8 +469,8 @@ Sets the `gethomepage.dev/widget.$key` annotation
| ---------- | ----------------------------------------------------------- | | ---------- | ----------------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.customkv[].key` | | Key | `ingress.$name.integrations.homepage.widget.customkv[].key` |
| Type | `string` | | Type | `string` |
| Required | ✅ | | Required | ✅ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `""` | | Default | `""` |
Example Example
@@ -465,8 +495,8 @@ Define the value for the custom annotation
| ---------- | ------------------------------------------------------------- | | ---------- | ------------------------------------------------------------- |
| Key | `ingress.$name.integrations.homepage.widget.customkv[].value` | | Key | `ingress.$name.integrations.homepage.widget.customkv[].value` |
| Type | `string` | | Type | `string` |
| Required | ✅ | | Required | ✅ |
| Helm `tpl` | ❌ | | Helm `tpl` | ❌ |
| Default | `""` | | Default | `""` |
Example Example