Skip to content

Commit 5481529

Browse files
authored
feat(k8s): add field to hide token from kubeconfig (#415)
1 parent 4050224 commit 5481529

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

scaleway-async/scaleway_async/k8s/v1/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,15 @@ async def _get_cluster_kube_config(
650650
*,
651651
cluster_id: str,
652652
region: Optional[Region] = None,
653+
redacted: Optional[bool] = None,
653654
) -> Optional[ScwFile]:
654655
"""
655656
Download the kubeconfig for a Cluster.
656657
Download the Kubernetes cluster config file (also known as `kubeconfig`) for a specific cluster to use it with `kubectl`.
657658
Tip: add `?dl=1` at the end of the URL to directly retrieve the base64 decoded kubeconfig. If you choose not to, the kubeconfig will be base64 encoded.
658659
:param region: Region to target. If none is passed will use default region from the config.
659660
:param cluster_id: Cluster ID for which to download the kubeconfig.
661+
:param redacted: Hide the legacy token from the kubeconfig.
660662
:return: :class:`Optional[ScwFile] <Optional[ScwFile]>`
661663
662664
Usage:
@@ -673,6 +675,9 @@ async def _get_cluster_kube_config(
673675
res = self._request(
674676
"GET",
675677
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/kubeconfig",
678+
params={
679+
"redacted": redacted,
680+
},
676681
)
677682

678683
self._throw_on_error(res)

scaleway-async/scaleway_async/k8s/v1/types_private.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ class _GetClusterKubeConfigRequest:
2121
"""
2222
Cluster ID for which to download the kubeconfig.
2323
"""
24+
25+
redacted: Optional[bool]
26+
"""
27+
Hide the legacy token from the kubeconfig.
28+
"""

scaleway/scaleway/k8s/v1/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,15 @@ def _get_cluster_kube_config(
650650
*,
651651
cluster_id: str,
652652
region: Optional[Region] = None,
653+
redacted: Optional[bool] = None,
653654
) -> Optional[ScwFile]:
654655
"""
655656
Download the kubeconfig for a Cluster.
656657
Download the Kubernetes cluster config file (also known as `kubeconfig`) for a specific cluster to use it with `kubectl`.
657658
Tip: add `?dl=1` at the end of the URL to directly retrieve the base64 decoded kubeconfig. If you choose not to, the kubeconfig will be base64 encoded.
658659
:param region: Region to target. If none is passed will use default region from the config.
659660
:param cluster_id: Cluster ID for which to download the kubeconfig.
661+
:param redacted: Hide the legacy token from the kubeconfig.
660662
:return: :class:`Optional[ScwFile] <Optional[ScwFile]>`
661663
662664
Usage:
@@ -673,6 +675,9 @@ def _get_cluster_kube_config(
673675
res = self._request(
674676
"GET",
675677
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/kubeconfig",
678+
params={
679+
"redacted": redacted,
680+
},
676681
)
677682

678683
self._throw_on_error(res)

scaleway/scaleway/k8s/v1/types_private.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ class _GetClusterKubeConfigRequest:
2121
"""
2222
Cluster ID for which to download the kubeconfig.
2323
"""
24+
25+
redacted: Optional[bool]
26+
"""
27+
Hide the legacy token from the kubeconfig.
28+
"""

0 commit comments

Comments
 (0)