Fix LocationOfOrigin shows up unexpectedly

This commit is contained in:
Shiming Zhang 2023-04-25 10:58:07 +08:00
parent 78b56ce16d
commit 4d9261c756
3 changed files with 3 additions and 14 deletions

View File

@ -228,19 +228,16 @@ func Example_minifyAndShorten() {
// Output: // Output:
// clusters: // clusters:
// cow-cluster: // cow-cluster:
// LocationOfOrigin: ""
// certificate-authority-data: DATA+OMITTED // certificate-authority-data: DATA+OMITTED
// server: http://cow.org:8080 // server: http://cow.org:8080
// contexts: // contexts:
// federal-context: // federal-context:
// LocationOfOrigin: ""
// cluster: cow-cluster // cluster: cow-cluster
// user: red-user // user: red-user
// current-context: federal-context // current-context: federal-context
// preferences: {} // preferences: {}
// users: // users:
// red-user: // red-user:
// LocationOfOrigin: ""
// client-certificate-data: DATA+OMITTED // client-certificate-data: DATA+OMITTED
// client-key-data: DATA+OMITTED // client-key-data: DATA+OMITTED
// token: REDACTED // token: REDACTED

View File

@ -67,7 +67,7 @@ type Preferences struct {
type Cluster struct { type Cluster struct {
// LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized. // LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized.
// +k8s:conversion-gen=false // +k8s:conversion-gen=false
LocationOfOrigin string LocationOfOrigin string `json:"-"`
// Server is the address of the kubernetes cluster (https://hostname:port). // Server is the address of the kubernetes cluster (https://hostname:port).
Server string `json:"server"` Server string `json:"server"`
// TLSServerName is used to check server certificate. If TLSServerName is empty, the hostname used to contact the server is used. // TLSServerName is used to check server certificate. If TLSServerName is empty, the hostname used to contact the server is used.
@ -107,7 +107,7 @@ type Cluster struct {
type AuthInfo struct { type AuthInfo struct {
// LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized. // LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized.
// +k8s:conversion-gen=false // +k8s:conversion-gen=false
LocationOfOrigin string LocationOfOrigin string `json:"-"`
// ClientCertificate is the path to a client cert file for TLS. // ClientCertificate is the path to a client cert file for TLS.
// +optional // +optional
ClientCertificate string `json:"client-certificate,omitempty"` ClientCertificate string `json:"client-certificate,omitempty"`
@ -159,7 +159,7 @@ type AuthInfo struct {
type Context struct { type Context struct {
// LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized. // LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized.
// +k8s:conversion-gen=false // +k8s:conversion-gen=false
LocationOfOrigin string LocationOfOrigin string `json:"-"`
// Cluster is the name of the cluster for this context // Cluster is the name of the cluster for this context
Cluster string `json:"cluster"` Cluster string `json:"cluster"`
// AuthInfo is the name of the authInfo for this context // AuthInfo is the name of the authInfo for this context

View File

@ -94,26 +94,21 @@ func Example_ofOptionsConfig() {
// Output: // Output:
// clusters: // clusters:
// alfa: // alfa:
// LocationOfOrigin: ""
// certificate-authority: path/to/my/cert-ca-filename // certificate-authority: path/to/my/cert-ca-filename
// disable-compression: true // disable-compression: true
// insecure-skip-tls-verify: true // insecure-skip-tls-verify: true
// server: https://alfa.org:8080 // server: https://alfa.org:8080
// bravo: // bravo:
// LocationOfOrigin: ""
// server: https://bravo.org:8080 // server: https://bravo.org:8080
// contexts: // contexts:
// alfa-as-black-mage: // alfa-as-black-mage:
// LocationOfOrigin: ""
// cluster: alfa // cluster: alfa
// namespace: zulu // namespace: zulu
// user: black-mage-via-auth-provider // user: black-mage-via-auth-provider
// alfa-as-white-mage: // alfa-as-white-mage:
// LocationOfOrigin: ""
// cluster: alfa // cluster: alfa
// user: white-mage-via-cert // user: white-mage-via-cert
// bravo-as-black-mage: // bravo-as-black-mage:
// LocationOfOrigin: ""
// cluster: bravo // cluster: bravo
// namespace: yankee // namespace: yankee
// user: black-mage-via-auth-provider // user: black-mage-via-auth-provider
@ -122,17 +117,14 @@ func Example_ofOptionsConfig() {
// colors: true // colors: true
// users: // users:
// black-mage-via-auth-provider: // black-mage-via-auth-provider:
// LocationOfOrigin: ""
// auth-provider: // auth-provider:
// config: // config:
// foo: bar // foo: bar
// token: s3cr3t-t0k3n // token: s3cr3t-t0k3n
// name: gcp // name: gcp
// red-mage-via-token: // red-mage-via-token:
// LocationOfOrigin: ""
// token: my-secret-token // token: my-secret-token
// white-mage-via-cert: // white-mage-via-cert:
// LocationOfOrigin: ""
// client-certificate: path/to/my/client-cert-filename // client-certificate: path/to/my/client-cert-filename
// client-key: path/to/my/client-key-filename // client-key: path/to/my/client-key-filename
} }