Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable templating within systemd unit files #351

Merged
merged 7 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added support for `Service` section in custom systemd configuration
- Added support for `After` and `BindsTo` within unit section of custom systemd configuration

## [1.4.1] - 2024-09-23

### Fixed
Expand Down
28 changes: 28 additions & 0 deletions helm/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,14 @@ Provider-specific properties that can be set by cluster-$provider chart in order
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.type` | **Type** - A file system type to mount.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.what` | **What** - An absolute path of a device node, file or other resource to mount.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.where` | **Where** - An absolute path of a file or directory for the mount point; in particular, the destination cannot be a symbolic link.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service` | **Service** - Configuration of the [Service] section.|**Type:** `object`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.additionalFields` | **AdditionalFields** - any extra fields to add to the systemd [Service] section.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.execStart` | **ExecStart** - systemd service ExecStart.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.remainAfterExit` | **RemainAfterExit** - systemd service RemainAfterExit.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.type` | **Type** - systemd service Type.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit` | **Unit** - Configuration of the [Unit] section.|**Type:** `object`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.after` | **After** - systemd unit After.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.bindsTo` | **BindsTo** - systemd unit BindsTo.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.defaultDependencies` | **DefaultDependencies** - Flag that indicates if this systemd unit should have the default systemd unit dependencies.|**Type:** `boolean`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.description` | **Description** - systemd unit description.|**Type:** `string`<br/>|
| `providerIntegration.bastion.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].dropins` | **Unit drop-ins** - The list of drop-ins for the unit|**Type:** `array`<br/>|
Expand Down Expand Up @@ -682,7 +689,14 @@ Provider-specific properties that can be set by cluster-$provider chart in order
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.type` | **Type** - A file system type to mount.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.what` | **What** - An absolute path of a device node, file or other resource to mount.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.where` | **Where** - An absolute path of a file or directory for the mount point; in particular, the destination cannot be a symbolic link.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service` | **Service** - Configuration of the [Service] section.|**Type:** `object`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.additionalFields` | **AdditionalFields** - any extra fields to add to the systemd [Service] section.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.execStart` | **ExecStart** - systemd service ExecStart.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.remainAfterExit` | **RemainAfterExit** - systemd service RemainAfterExit.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.type` | **Type** - systemd service Type.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit` | **Unit** - Configuration of the [Unit] section.|**Type:** `object`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.after` | **After** - systemd unit After.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.bindsTo` | **BindsTo** - systemd unit BindsTo.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.defaultDependencies` | **DefaultDependencies** - Flag that indicates if this systemd unit should have the default systemd unit dependencies.|**Type:** `boolean`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.description` | **Description** - systemd unit description.|**Type:** `string`<br/>|
| `providerIntegration.controlPlane.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].dropins` | **Unit drop-ins** - The list of drop-ins for the unit|**Type:** `array`<br/>|
Expand Down Expand Up @@ -771,7 +785,14 @@ Provider-specific properties that can be set by cluster-$provider chart in order
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.type` | **Type** - A file system type to mount.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.what` | **What** - An absolute path of a device node, file or other resource to mount.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.where` | **Where** - An absolute path of a file or directory for the mount point; in particular, the destination cannot be a symbolic link.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service` | **Service** - Configuration of the [Service] section.|**Type:** `object`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.additionalFields` | **AdditionalFields** - any extra fields to add to the systemd [Service] section.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.execStart` | **ExecStart** - systemd service ExecStart.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.remainAfterExit` | **RemainAfterExit** - systemd service RemainAfterExit.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.type` | **Type** - systemd service Type.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit` | **Unit** - Configuration of the [Unit] section.|**Type:** `object`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.after` | **After** - systemd unit After.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.bindsTo` | **BindsTo** - systemd unit BindsTo.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.defaultDependencies` | **DefaultDependencies** - Flag that indicates if this systemd unit should have the default systemd unit dependencies.|**Type:** `boolean`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.description` | **Description** - systemd unit description.|**Type:** `string`<br/>|
| `providerIntegration.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].dropins` | **Unit drop-ins** - The list of drop-ins for the unit|**Type:** `array`<br/>|
Expand Down Expand Up @@ -893,7 +914,14 @@ Provider-specific properties that can be set by cluster-$provider chart in order
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.type` | **Type** - A file system type to mount.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.what` | **What** - An absolute path of a device node, file or other resource to mount.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.mount.where` | **Where** - An absolute path of a file or directory for the mount point; in particular, the destination cannot be a symbolic link.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service` | **Service** - Configuration of the [Service] section.|**Type:** `object`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.additionalFields` | **AdditionalFields** - any extra fields to add to the systemd [Service] section.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.execStart` | **ExecStart** - systemd service ExecStart.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.remainAfterExit` | **RemainAfterExit** - systemd service RemainAfterExit.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.service.type` | **Type** - systemd service Type.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit` | **Unit** - Configuration of the [Unit] section.|**Type:** `object`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.after` | **After** - systemd unit After.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.bindsTo` | **BindsTo** - systemd unit BindsTo.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.defaultDependencies` | **DefaultDependencies** - Flag that indicates if this systemd unit should have the default systemd unit dependencies.|**Type:** `boolean`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].contents.unit.description` | **Description** - systemd unit description.|**Type:** `string`<br/>|
| `providerIntegration.workers.kubeadmConfig.ignition.containerLinuxConfig.additionalConfig.systemd.units[*].dropins` | **Unit drop-ins** - The list of drop-ins for the unit|**Type:** `array`<br/>|
Expand Down
17 changes: 17 additions & 0 deletions helm/cluster/templates/clusterapi/_helpers_flatcar.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@
{{- if hasKey .contents.unit "defaultDependencies" }}
DefaultDependencies={{ if .contents.unit.defaultDependencies }}yes{{ else }}no{{ end }}
{{- end }}
{{- if .contents.unit.after }}
After={{ .contents.unit.after }}
{{- end }}
{{- if .contents.unit.bindsTo }}
BindsTo={{ .contents.unit.bindsTo }}
{{- end }}
{{- end }}
{{- if .contents.service }}
[Service]
Type={{ .contents.service.type }}
RemainAfterExit={{ .contents.service.remainAfterExit }}
{{- if .contents.service.execStart }}
ExecStart={{ .contents.service.execStart }}
{{- end }}
{{- if .contents.service.additionalFields }}
{{ tpl .contents.service.additionalFields $ | nindent 4 }}
{{- end }}
{{- end }}
{{- if .contents.mount }}
[Mount]
Expand Down
42 changes: 42 additions & 0 deletions helm/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,38 @@
}
}
},
"service": {
"type": "object",
"title": "Service",
"description": "Configuration of the [Service] section.",
"required": [
"type",
"remainAfterExit"
],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"title": "Type",
"description": "systemd service Type."
},
"additionalFields": {
"type": "string",
"title": "AdditionalFields",
"description": "any extra fields to add to the systemd [Service] section."
},
"execStart": {
"type": "string",
"title": "ExecStart",
"description": "systemd service ExecStart."
},
"remainAfterExit": {
"type": "string",
"title": "RemainAfterExit",
"description": "systemd service RemainAfterExit."
}
}
},
"unit": {
"type": "object",
"title": "Unit",
Expand All @@ -940,6 +972,16 @@
"title": "Description",
"description": "systemd unit description."
},
"after": {
"type": "string",
"title": "After",
"description": "systemd unit After."
},
"bindsTo": {
"type": "string",
"title": "BindsTo",
"description": "systemd unit BindsTo."
},
"defaultDependencies": {
"type": "boolean",
"title": "DefaultDependencies",
Expand Down
Loading