Skip to content

Commit 70eec6d

Browse files
authored
feat(k8s): add field to hide token from kubeconfig (#1971)
1 parent df6cb2a commit 70eec6d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

api/k8s/v1/k8s_sdk.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,9 @@ type GetClusterKubeConfigRequest struct {
13491349

13501350
// ClusterID: cluster ID for which to download the kubeconfig.
13511351
ClusterID string `json:"-"`
1352+
1353+
// Redacted: hide the legacy token from the kubeconfig.
1354+
Redacted *bool `json:"redacted,omitempty"`
13521355
}
13531356

13541357
// GetClusterRequest: get cluster request.
@@ -2170,6 +2173,9 @@ func (s *API) getClusterKubeConfig(req *GetClusterKubeConfigRequest, opts ...scw
21702173
req.Region = defaultRegion
21712174
}
21722175

2176+
query := url.Values{}
2177+
parameter.AddToQuery(query, "redacted", req.Redacted)
2178+
21732179
if fmt.Sprint(req.Region) == "" {
21742180
return nil, errors.New("field Region cannot be empty in request")
21752181
}
@@ -2181,6 +2187,7 @@ func (s *API) getClusterKubeConfig(req *GetClusterKubeConfigRequest, opts ...scw
21812187
scwReq := &scw.ScalewayRequest{
21822188
Method: "GET",
21832189
Path: "/k8s/v1/regions/" + fmt.Sprint(req.Region) + "/clusters/" + fmt.Sprint(req.ClusterID) + "/kubeconfig",
2190+
Query: query,
21842191
}
21852192

21862193
var resp scw.File

0 commit comments

Comments
 (0)