mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-25 14:41:53 +00:00
Changed kubectl config view to redact token
Kubernetes-commit: 6fad4ee5e5f5fa6fbf38e88f165b012fa0ae5795
This commit is contained in:
parent
da706024f3
commit
d4a54d1ba8
@ -98,6 +98,9 @@ func ShortenConfig(config *Config) {
|
||||
if len(authInfo.ClientCertificateData) > 0 {
|
||||
authInfo.ClientCertificateData = redactedBytes
|
||||
}
|
||||
if len(authInfo.Token) > 0 {
|
||||
authInfo.Token = "REDACTED"
|
||||
}
|
||||
config.AuthInfos[key] = authInfo
|
||||
}
|
||||
for key, cluster := range config.Clusters {
|
||||
|
@ -243,7 +243,7 @@ func Example_minifyAndShorten() {
|
||||
// LocationOfOrigin: ""
|
||||
// client-certificate-data: REDACTED
|
||||
// client-key-data: REDACTED
|
||||
// token: red-token
|
||||
// token: REDACTED
|
||||
}
|
||||
|
||||
func TestShortenSuccess(t *testing.T) {
|
||||
@ -299,4 +299,7 @@ func TestShortenSuccess(t *testing.T) {
|
||||
if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData) != redacted {
|
||||
t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData))
|
||||
}
|
||||
if mutatingConfig.AuthInfos[changingAuthInfo].Token != "REDACTED" {
|
||||
t.Errorf("expected REDACTED, got %v", mutatingConfig.AuthInfos[changingAuthInfo].Token)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user