feat(common): Release common v4.1.0 (#416)

This commit is contained in:
Bernd Schorgers 2025-06-11 16:09:46 +02:00 committed by GitHub
parent f3660654f4
commit db552e2dee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 705 additions and 129 deletions

View file

@ -15,32 +15,36 @@ Override the default resource name entirely.
#### prefix
Prefix to prepend to the resource name.
Prefix to prepend to the resource name. Will not be added if the resource name already starts with the prefix.
#### suffix
Suffix to append to the resource name. Defaults to the resource identifier if there are multiple enabled items, otherwise it defaults to an empty value.
Suffix to append to the resource name. Will not be added if the resource name already ends with the suffix. Defaults to the resource identifier if there are multiple enabled items, otherwise it defaults to an empty value.
### Behavior
By default, all resource names are based on the `bjw-s.common.lib.chart.names.fullname` template which defaults to the Helm Release name. This template can be further controlled by the `global.nameOverride` and `global.fullnameOverride` values.
The resource identifier (key) is only appended when there are multiple resources of the same kind or if the value `global.alwaysAppendIdentifierToResourceName` is set to `true`.
!!! info
All resource names are based on the `bjw-s.common.lib.chart.names.fullname` template. This defaults to the Helm Release name, but can be further controlled by the `global.nameOverride` and `global.fullnameOverride` values. The identifier only comes in to play when there are multiple resources of the same kind.
When the resource name already equals the identifier or if the identifier suffix is already present, it will not be added a second time. This is to prevent names like `vaultwarden-vaultwarden`
Assuming a Helm Release with the name `base_name`, the following table gives an overview of how the resource name is generated:
| item key | enabled items | `prefix` | `suffix` | `forceRename` | Generated name |
|----------|---------------|----------|----------|----------------------------|------------------------|
| `id` | 1 | | | `random_name` | `random_name` |
| `id` | 1 | | | `{{ .Release.Namespace }}` | `default` |
| `id` | 1 | | | | `base_name` |
| `id` | 1 | `pfx` | | | `pfx-base_name` |
| `id` | 1 | | `sfx` | | `base_name-sfx` |
| `id` | 2 | | | | `base_name-id` |
| `id` | 1 | `pfx` | `sfx` | | `pfx-base_name-sfx` |
| `id` | 2 | `pfx` | | | `pfx-base_name-id` |
| `id` | 2 | | `sfx` | | `base_name-id-sfx` |
| `id` | 2 | `pfx` | `sfx` | | `pfx-base_name-id-sfx` |
| `id` | 1 | | `sfx` | | `base_name-sfx` |
| `id` | 1 | `pfx` | | | `pfx-base_name` |
| `id` | 1 | `pfx` | `sfx` | | `pfx-base_name-sfx` |
| `forceRename` | Enabled items | Always append identifier | `identifier` | `prefix` | `suffix` | Expected name | Notes |
|------------------------------|---------------|--------------------------|---------------|---------------|-------------|-------------------------------|--------------------------------------------------|
| `custom-name` | | | | | | `custom-name` | Force rename overrides all logic |
| `"{{ .Release.Namespace }}"` | | | | | | `default` | Force rename with a template overrides all logic |
| | 1 | | `abc` | | | `base_name` | Base case, no additional configuration |
| | 1 | | `abc` | `team` | | `team-base_name` | Prefix added |
| | 1 | | `abc` | `base_name` | | `base_name` | Prefix equal to fullname skipped |
| | 1 | | `abc` | | `svc` | `base_name-svc` | Suffix added |
| | 1 | | `abc` | | `base_name` | `base_name` | Suffix equal to fullname - skipped |
| | 1 | | `abc` | `team` | `svc` | `team-base_name-svc` | Prefix + suffix, no identifier |
| | 1 | `true` | `abc` | | | `base_name-abc` | identifier suffix via global flag |
| | 1 | `true` | `abc` | `team` | `svc` | `team-base_name-abc-svc` | Prefix + identifier + suffix via global flag |
| | 2 | | `abc` | | | `base_name-abc` | Identifier due to itemCount > 1 |
| | 2 | | `abc` | `team` | `svc` | `team-base_name-abc-svc` | Prefix + Identifier + Suffix |
| | 2 | | `base_name` | | | `base_name` | Identifier equal to fullname skipped |
| | 2 | | `abc` | | `abc` | `base_name-abc` | Suffix skipped already included by identifer |