change TRUNCATED to DATA+OMITTED in kubectl config view

Signed-off-by: Ibrahim AshShohail <me@ibrasho.com>

Kubernetes-commit: 23996b25c93c0fc576f5d4a547f91e1b7c4b68a3
This commit is contained in:
Ibrahim AshShohail
2018-08-01 03:23:00 +03:00
committed by Kubernetes Publisher
parent 5d107d4ebc
commit a83d2a2682
2 changed files with 11 additions and 5 deletions

View File

@@ -29,6 +29,8 @@ import (
func init() {
sDec, _ := base64.StdEncoding.DecodeString("REDACTED+")
redactedBytes = []byte(string(sDec))
sDec, _ = base64.StdEncoding.DecodeString("DATA+OMITTED")
dataOmittedBytes = []byte(string(sDec))
}
// IsConfigEmpty returns true if the config is empty.
@@ -79,7 +81,10 @@ func MinifyConfig(config *Config) error {
return nil
}
var redactedBytes []byte
var (
redactedBytes []byte
dataOmittedBytes []byte
)
// Flatten redacts raw data entries from the config object for a human-readable view.
func ShortenConfig(config *Config) {
@@ -97,7 +102,7 @@ func ShortenConfig(config *Config) {
}
for key, cluster := range config.Clusters {
if len(cluster.CertificateAuthorityData) > 0 {
cluster.CertificateAuthorityData = redactedBytes
cluster.CertificateAuthorityData = dataOmittedBytes
}
config.Clusters[key] = cluster
}