diff --git a/class/defaults.yml b/class/defaults.yml index 0356235..341e7ab 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -13,4 +13,5 @@ parameters: args: [] + api_timeout_seconds: null api_token: ?{vaultkv:${cluster:tenant}/${cluster:name}/cloudscale/token} diff --git a/component/main.jsonnet b/component/main.jsonnet index 6b76694..da4c0c0 100644 --- a/component/main.jsonnet +++ b/component/main.jsonnet @@ -36,6 +36,13 @@ local patchDaemonset(obj) = '%(registry)s/%(repository)s:%(tag)s' % params.images.cloudscale_cloud_controller_manager, command+: params.args, + env+: + if params.api_timeout_seconds != null then [ + { + name: 'CLOUDSCALE_API_TIMEOUT', + value: std.toString(params.api_timeout_seconds), + }, + ] else [], } else c diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index 091c0e3..8084078 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -43,6 +43,18 @@ defaults:: `[]` Additional arguments to provide to the cloudscale CCM. The contents of this parameter are appended to the upstream manifest verbatim. +== `api_timeout_seconds` + +[horizontal] +type:: number +default:: `null` + +The API timeout to be used by the CCM driver when communicating with the cloudscale.ch API. +Unit is seconds. +If not set the CCM driver will use its upstream default. + +The current upstream timeout default is 20 seconds (https://github.com/cloudscale-ch/cloudscale-cloud-controller-manager/blob/74832bae401dc0fc79dcfba923ae154eac684779/pkg/cloudscale_ccm/cloud.go#L28[upstream code]). + == `api_token` [horizontal] diff --git a/tests/golden/openshift4/cloudscale-cloud-controller-manager/cloudscale-cloud-controller-manager/10_ccm_daemonset_kube_system_cloudscale_cloud_controller_manager.yaml b/tests/golden/openshift4/cloudscale-cloud-controller-manager/cloudscale-cloud-controller-manager/10_ccm_daemonset_kube_system_cloudscale_cloud_controller_manager.yaml index 346bdb5..6739308 100644 --- a/tests/golden/openshift4/cloudscale-cloud-controller-manager/cloudscale-cloud-controller-manager/10_ccm_daemonset_kube_system_cloudscale_cloud_controller_manager.yaml +++ b/tests/golden/openshift4/cloudscale-cloud-controller-manager/cloudscale-cloud-controller-manager/10_ccm_daemonset_kube_system_cloudscale_cloud_controller_manager.yaml @@ -28,6 +28,8 @@ spec: secretKeyRef: key: access-token name: cloudscale + - name: CLOUDSCALE_API_TIMEOUT + value: '50' image: quay.io/cloudscalech/cloudscale-cloud-controller-manager:1.2.0 imagePullPolicy: IfNotPresent name: cloudscale-cloud-controller-manager diff --git a/tests/openshift4.yml b/tests/openshift4.yml index 97d8e9b..3ee41f3 100644 --- a/tests/openshift4.yml +++ b/tests/openshift4.yml @@ -1,3 +1,6 @@ parameters: facts: distribution: openshift4 + + cloudscale_cloud_controller_manager: + api_timeout_seconds: 50