diff --git a/.markdownlint.yaml b/.markdownlint.yaml index ecb7e11b5e..655c3eec63 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -7,4 +7,4 @@ MD033: false MD024: false MD013: - line_length: 200 + line_length: 300 diff --git a/library/common-test/tests/pod/enable_service_links_test.yaml b/library/common-test/tests/pod/enable_service_links_test.yaml new file mode 100644 index 0000000000..1ee9fe93b7 --- /dev/null +++ b/library/common-test/tests/pod/enable_service_links_test.yaml @@ -0,0 +1,75 @@ +suite: pod enableServiceLinks test +templates: + - common.yaml +tests: + - it: should pass with enableServiceLinks disabled from "global" + set: + podOptions: + enableServiceLinks: false + controllers: + controller-name1: + enabled: true + primary: true + type: DaemonSet + podSpec: {} + asserts: + - documentIndex: &daemonSetDoc 0 + isKind: + of: DaemonSet + - documentIndex: *daemonSetDoc + equal: + path: spec.template.spec.enableServiceLinks + value: false + + - it: should pass with enableServiceLinks enabled from "global" + set: + podOptions: + enableServiceLinks: true + controllers: + controller-name1: + enabled: true + primary: true + type: DaemonSet + podSpec: {} + asserts: + - documentIndex: *daemonSetDoc + isKind: + of: DaemonSet + - documentIndex: *daemonSetDoc + equal: + path: spec.template.spec.enableServiceLinks + value: true + + - it: should pass with disabled enableServiceLinks from pod + set: + podOptions: + enableServiceLinks: true + controllers: + controller-name1: + enabled: true + primary: true + type: DaemonSet + podSpec: + enableServiceLinks: false + asserts: + - documentIndex: *daemonSetDoc + equal: + path: spec.template.spec.enableServiceLinks + value: false + + - it: should pass with enabled enableServiceLinks from pod + set: + podOptions: + enableServiceLinks: false + controllers: + controller-name1: + enabled: true + primary: true + type: DaemonSet + podSpec: + enableServiceLinks: true + asserts: + - documentIndex: *daemonSetDoc + equal: + path: spec.template.spec.enableServiceLinks + value: true diff --git a/library/common-test/tests/pod/host_network_test.yaml b/library/common-test/tests/pod/host_network_test.yaml new file mode 100644 index 0000000000..17595e416d --- /dev/null +++ b/library/common-test/tests/pod/host_network_test.yaml @@ -0,0 +1,75 @@ +suite: pod hostnetwork test +templates: + - common.yaml +tests: + - it: should pass with hostnetwork disabled from "global" + set: + podOptions: + hostNetwork: false + controllers: + controller-name1: + enabled: true + primary: true + type: Deployment + podSpec: {} + asserts: + - documentIndex: &deploymentDoc 0 + isKind: + of: Deployment + - documentIndex: *deploymentDoc + equal: + path: spec.template.spec.hostNetwork + value: false + + - it: should pass with hostnetwork enabled from "global" + set: + podOptions: + hostNetwork: true + controllers: + controller-name1: + enabled: true + primary: true + type: Deployment + podSpec: {} + asserts: + - documentIndex: *deploymentDoc + isKind: + of: Deployment + - documentIndex: *deploymentDoc + equal: + path: spec.template.spec.hostNetwork + value: true + + - it: should pass with disabled hostnetwork from pod + set: + podOptions: + hostNetwork: true + controllers: + controller-name1: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: false + asserts: + - documentIndex: *deploymentDoc + equal: + path: spec.template.spec.hostNetwork + value: false + + - it: should pass with enabled hostnetwork from pod + set: + podOptions: + hostNetwork: false + controllers: + controller-name1: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: true + asserts: + - documentIndex: *deploymentDoc + equal: + path: spec.template.spec.hostNetwork + value: true diff --git a/library/common/1.0.0/docs/cronjob.md b/library/common/1.0.0/docs/cronjob.md index ca3ee4b934..ea13e043e9 100644 --- a/library/common/1.0.0/docs/cronjob.md +++ b/library/common/1.0.0/docs/cronjob.md @@ -1,29 +1,31 @@ # CronJob -| Key | Type | Required | Helm Template | Default | Description | -| :------------------------------------------------------- | :-------: | :------: | :-----------: | :----------------: | :---------------------------------------------------- | -| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | -| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | -| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | -| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | -| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | -| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | -| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | -| controllers.[controller-name].schedule | `string` | ✅ | ✅ | `""` | Define the schedule | -| controllers.[controller-name].timezone | `string` | ❌ | ✅ | `{{ .Values.TZ }}` | Define the timezone | -| controllers.[controller-name].concurrencyPolicy | `string` | ❌ | ✅ | `Forbid` | Define the concurrencyPolicy (Allow, Replace, Forbid) | -| controllers.[controller-name].failedJobsHistoryLimit | `int` | ❌ | ❌ | `1` | Define the failedJobsHistoryLimit | -| controllers.[controller-name].successfulJobsHistoryLimit | `int` | ❌ | ❌ | `3` | Define the successfulJobsHistoryLimit | -| controllers.[controller-name].startingDeadlineSeconds | `int` | ❌ | ❌ | | Define the startingDeadlineSeconds | -| controllers.[controller-name].completionMode | `string` | ❌ | ❌ | `NonIndexed` | Define the completionMode (Indexed, NonIndexed) | -| controllers.[controller-name].backoffLimit | `int` | ❌ | ❌ | `5` | Define the backoffLimit | -| controllers.[controller-name].completions | `int` | ❌ | ❌ | | Define the completions | -| controllers.[controller-name].parallelism | `int` | ❌ | ❌ | `1` | Define the parallelism | -| controllers.[controller-name].ttlSecondsAfterFinished | `int` | ❌ | ❌ | `120` | Define the ttlSecondsAfterFinished | -| controllers.[controller-name].activeDeadlineSeconds | `int` | ❌ | ❌ | | Define the activeDeadlineSeconds | -| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | -| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | -| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| Key | Type | Required | Helm Template | Default | Description | +| :------------------------------------------------------- | :-------: | :------: | :-----------: | :---------------------------------------------------: | :---------------------------------------------------- | +| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | +| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | +| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | +| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | +| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | +| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | +| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | +| controllers.[controller-name].schedule | `string` | ✅ | ✅ | `""` | Define the schedule | +| controllers.[controller-name].timezone | `string` | ❌ | ✅ | `{{ .Values.TZ }}` | Define the timezone | +| controllers.[controller-name].concurrencyPolicy | `string` | ❌ | ✅ | `Forbid` | Define the concurrencyPolicy (Allow, Replace, Forbid) | +| controllers.[controller-name].failedJobsHistoryLimit | `int` | ❌ | ❌ | `1` | Define the failedJobsHistoryLimit | +| controllers.[controller-name].successfulJobsHistoryLimit | `int` | ❌ | ❌ | `3` | Define the successfulJobsHistoryLimit | +| controllers.[controller-name].startingDeadlineSeconds | `int` | ❌ | ❌ | | Define the startingDeadlineSeconds | +| controllers.[controller-name].completionMode | `string` | ❌ | ❌ | `NonIndexed` | Define the completionMode (Indexed, NonIndexed) | +| controllers.[controller-name].backoffLimit | `int` | ❌ | ❌ | `5` | Define the backoffLimit | +| controllers.[controller-name].completions | `int` | ❌ | ❌ | | Define the completions | +| controllers.[controller-name].parallelism | `int` | ❌ | ❌ | `1` | Define the parallelism | +| controllers.[controller-name].ttlSecondsAfterFinished | `int` | ❌ | ❌ | `120` | Define the ttlSecondsAfterFinished | +| controllers.[controller-name].activeDeadlineSeconds | `int` | ❌ | ❌ | | Define the activeDeadlineSeconds | +| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | +| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | +| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| controllers.[controller-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | +| controllers.[controller-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | --- @@ -65,6 +67,8 @@ controllers: podSpec: labels: {} annotations: {} + hostNetwork: false + enableServiceLinks: false other-controller-name: enabled: true diff --git a/library/common/1.0.0/docs/daemonset.md b/library/common/1.0.0/docs/daemonset.md index 8ab84eb226..d7041ff3f2 100644 --- a/library/common/1.0.0/docs/daemonset.md +++ b/library/common/1.0.0/docs/daemonset.md @@ -1,21 +1,23 @@ # DaemonSet -| Key | Type | Required | Helm Template | Default | Description | -| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :-------------: | :------------------------------------------------------------------- | -| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | -| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | -| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | -| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | -| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | -| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | -| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | -| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the controller (OnDelete, RollingUpdate) | -| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | -| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | -| controllers.[controller-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate | -| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | -| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | -| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| Key | Type | Required | Helm Template | Default | Description | +| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :---------------------------------------------------: | :------------------------------------------------------------------- | +| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | +| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | +| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | +| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | +| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | +| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | +| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | +| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the controller (OnDelete, RollingUpdate) | +| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate | +| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | +| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | +| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| controllers.[controller-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | +| controllers.[controller-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | --- @@ -51,6 +53,8 @@ controllers: podSpec: labels: {} annotations: {} + hostNetwork: false + enableServiceLinks: false other-controller-name: enabled: true diff --git a/library/common/1.0.0/docs/deployment.md b/library/common/1.0.0/docs/deployment.md index 61c08bdeb5..612ad7b28f 100644 --- a/library/common/1.0.0/docs/deployment.md +++ b/library/common/1.0.0/docs/deployment.md @@ -1,21 +1,23 @@ # Deployment -| Key | Type | Required | Helm Template | Default | Description | -| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :--------: | :------------------------------------------------------------------- | -| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | -| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | -| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | -| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | -| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | -| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | -| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | -| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `Recreate` | Define the strategy of the controller (Recreate, RollingUpdate) | -| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | -| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | -| controllers.[controller-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate | -| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | -| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | -| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| Key | Type | Required | Helm Template | Default | Description | +| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :---------------------------------------------------: | :------------------------------------------------------------------- | +| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | +| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | +| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | +| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | +| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | +| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | +| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | +| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `Recreate` | Define the strategy of the controller (Recreate, RollingUpdate) | +| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate | +| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | +| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | +| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| controllers.[controller-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | +| controllers.[controller-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | --- @@ -51,6 +53,8 @@ controllers: podSpec: labels: {} annotations: {} + hostNetwork: false + enableServiceLinks: false other-controller-name: enabled: true diff --git a/library/common/1.0.0/docs/job.md b/library/common/1.0.0/docs/job.md index f0036b3890..de36b30bfc 100644 --- a/library/common/1.0.0/docs/job.md +++ b/library/common/1.0.0/docs/job.md @@ -1,23 +1,25 @@ # Job -| Key | Type | Required | Helm Template | Default | Description | -| :---------------------------------------------------- | :-------: | :------: | :-----------: | :----------: | :---------------------------------------------- | -| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | -| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | -| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | -| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | -| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | -| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | -| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | -| controllers.[controller-name].completionMode | `string` | ❌ | ❌ | `NonIndexed` | Define the completionMode (Indexed, NonIndexed) | -| controllers.[controller-name].backoffLimit | `int` | ❌ | ❌ | `5` | Define the backoffLimit | -| controllers.[controller-name].completions | `int` | ❌ | ❌ | | Define the completions | -| controllers.[controller-name].parallelism | `int` | ❌ | ❌ | `1` | Define the parallelism | -| controllers.[controller-name].ttlSecondsAfterFinished | `int` | ❌ | ❌ | `120` | Define the ttlSecondsAfterFinished | -| controllers.[controller-name].activeDeadlineSeconds | `int` | ❌ | ❌ | | Define the activeDeadlineSeconds | -| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | -| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | -| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| Key | Type | Required | Helm Template | Default | Description | +| :------------------------------------------------------- | :-------: | :------: | :-----------: | :---------------------------------------------------: | :---------------------------------------------- | +| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | +| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | +| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | +| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | +| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | +| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | +| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | +| controllers.[controller-name].completionMode | `string` | ❌ | ❌ | `NonIndexed` | Define the completionMode (Indexed, NonIndexed) | +| controllers.[controller-name].backoffLimit | `int` | ❌ | ❌ | `5` | Define the backoffLimit | +| controllers.[controller-name].completions | `int` | ❌ | ❌ | | Define the completions | +| controllers.[controller-name].parallelism | `int` | ❌ | ❌ | `1` | Define the parallelism | +| controllers.[controller-name].ttlSecondsAfterFinished | `int` | ❌ | ❌ | `120` | Define the ttlSecondsAfterFinished | +| controllers.[controller-name].activeDeadlineSeconds | `int` | ❌ | ❌ | | Define the activeDeadlineSeconds | +| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | +| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | +| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| controllers.[controller-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | +| controllers.[controller-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | --- @@ -53,6 +55,8 @@ controllers: podSpec: labels: {} annotations: {} + hostNetwork: false + enableServiceLinks: false other-controller-name: enabled: true diff --git a/library/common/1.0.0/docs/statefulset.md b/library/common/1.0.0/docs/statefulset.md index c8291c3f78..7917bfbddb 100644 --- a/library/common/1.0.0/docs/statefulset.md +++ b/library/common/1.0.0/docs/statefulset.md @@ -1,21 +1,23 @@ # DaemonSet -| Key | Type | Required | Helm Template | Default | Description | -| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :-------------: | :------------------------------------------------------------------- | -| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | -| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | -| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | -| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | -| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | -| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | -| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | -| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the controller (OnDelete, RollingUpdate) | -| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | -| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | -| controllers.[controller-name].rollingUpdate.partition | `int` | ❌ | ❌ | | Define the partition, Only when strategy is RollingUpdate | -| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | -| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | -| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| Key | Type | Required | Helm Template | Default | Description | +| :--------------------------------------------------------- | :-------: | :------: | :-----------: | :---------------------------------------------------: | :------------------------------------------------------------------- | +| controllers | `dict` | ❌ | ❌ | `{}` | Define the controllers as dicts | +| controllers.[controller-name] | `dict` | ✅ | ❌ | `{}` | Holds controller definition | +| controllers.[controller-name].enabled | `boolean` | ✅ | ❌ | `false` | Enables or Disables the controller | +| controllers.[controller-name].primary | `boolean` | ✅ | ❌ | `false` | Sets the controller as primary | +| controllers.[controller-name].labels | `dict` | ❌ | ✅ | `{}` | Additional labels for controller | +| controllers.[controller-name].annotations | `dict` | ❌ | ✅ | `{}` | Additional annotations for controller | +| controllers.[controller-name].type | `string` | ✅ | ❌ | `""` | Define the type (kind) of the controller | +| controllers.[controller-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the controller (OnDelete, RollingUpdate) | +| controllers.[controller-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate | +| controllers.[controller-name].rollingUpdate.partition | `int` | ❌ | ❌ | | Define the partition, Only when strategy is RollingUpdate | +| controllers.[controller-name].podSpec | `dict` | ✅ | ❌ | `{}` | Holds the pod definition | +| controllers.[controller-name].podSpec.labels | `dict` | ❌ | ✅ | `{}` | Pod Labels | +| controllers.[controller-name].podSpec.annotations | `dict` | ❌ | ✅ | `{}` | Pod Annotations | +| controllers.[controller-name].podSpec.hostNetwork | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.hostNetwork }}` (false) | Pod's hostNetwork | +| controllers.[controller-name].podSpec.enableServiceLinks | `boolean` | ❌ | ❌ | `{{ .Values.podOptions.enableServiceLinks }}` (false) | Pod's enableServiceLinks | --- @@ -51,6 +53,8 @@ controllers: podSpec: labels: {} annotations: {} + hostNetwork: false + enableServiceLinks: false other-controller-name: enabled: true diff --git a/library/common/1.0.0/templates/lib/controller/_pod.tpl b/library/common/1.0.0/templates/lib/controller/_pod.tpl index c95298c938..f3efc30063 100644 --- a/library/common/1.0.0/templates/lib/controller/_pod.tpl +++ b/library/common/1.0.0/templates/lib/controller/_pod.tpl @@ -11,6 +11,6 @@ objectData: The object data to be used to render the Pod. imagePullSecrets: {{- . | nindent 2 }} {{- end }} -hostNetwork: false - +hostNetwork: {{ include "ix.v1.common.lib.pod.hostNetwork" (dict "rootCtx" $rootCtx "objectData" $objectData) }} +enableServiceLinks: {{ include "ix.v1.common.lib.pod.enableServiceLinks" (dict "rootCtx" $rootCtx "objectData" $objectData) }} {{- end -}} diff --git a/library/common/1.0.0/templates/lib/pod/_enableServiceLinks.tpl b/library/common/1.0.0/templates/lib/pod/_enableServiceLinks.tpl new file mode 100644 index 0000000000..928dddcd15 --- /dev/null +++ b/library/common/1.0.0/templates/lib/pod/_enableServiceLinks.tpl @@ -0,0 +1,24 @@ +{{/* Returns enableServiceLinks */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.pod.enableServiceLinks" (dict "rootCtx" $ "objectData" $objectData) }} +rootCtx: The root context of the template. It is used to access the global context. +objectData: The object data to be used to render the Pod. +*/}} +{{- define "ix.v1.common.lib.pod.enableServiceLinks" -}} + {{- $rootCtx := .rootCtx -}} + {{- $objectData := .objectData -}} + + {{- $enableServiceLinks := false -}} + + {{/* Initialize from the "global" option */}} + {{- if (kindIs "bool" $rootCtx.Values.podOptions.enableServiceLinks) -}} + {{- $enableServiceLinks = $rootCtx.Values.podOptions.enableServiceLinks -}} + {{- end -}} + + {{/* Override with pod's option */}} + {{- if (kindIs "bool" $objectData.podSpec.enableServiceLinks) -}} + {{- $enableServiceLinks = $objectData.podSpec.enableServiceLinks -}} + {{- end -}} + + {{- $enableServiceLinks -}} +{{- end -}} diff --git a/library/common/1.0.0/templates/lib/pod/_hostNetwork.tpl b/library/common/1.0.0/templates/lib/pod/_hostNetwork.tpl new file mode 100644 index 0000000000..97dca3a5b5 --- /dev/null +++ b/library/common/1.0.0/templates/lib/pod/_hostNetwork.tpl @@ -0,0 +1,24 @@ +{{/* Returns Host Network */}} +{{/* Call this template: +{{ include "ix.v1.common.lib.pod.hostNetwork" (dict "rootCtx" $ "objectData" $objectData) }} +rootCtx: The root context of the template. It is used to access the global context. +objectData: The object data to be used to render the Pod. +*/}} +{{- define "ix.v1.common.lib.pod.hostNetwork" -}} + {{- $rootCtx := .rootCtx -}} + {{- $objectData := .objectData -}} + + {{- $hostNet := false -}} + + {{/* Initialize from the "global" option */}} + {{- if (kindIs "bool" $rootCtx.Values.podOptions.hostNetwork) -}} + {{- $hostNet = $rootCtx.Values.podOptions.hostNetwork -}} + {{- end -}} + + {{/* Override with pod's option */}} + {{- if (kindIs "bool" $objectData.podSpec.hostNetwork) -}} + {{- $hostNet = $objectData.podSpec.hostNetwork -}} + {{- end -}} + + {{- $hostNet -}} +{{- end -}}