Skip to content

Commit

Permalink
Consistent field names in k8s status outputs (#589)
Browse files Browse the repository at this point in the history
* fix yaml status output

* silence config in k8s status json and yaml

* update node status output in yaml
  • Loading branch information
neoaggelos authored Aug 7, 2024
1 parent c134c90 commit a33cd3e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions src/k8s/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ const (
type NodeStatus struct {
// Name is the name for this cluster member that was when joining the cluster.
// This is typically the hostname of the node.
Name string `json:"name,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// Address is the IP address of the node.
Address string `json:"address,omitempty"`
Address string `json:"address,omitempty" yaml:"address,omitempty"`
// ClusterRole is the role that the node has within the k8s cluster.
ClusterRole ClusterRole `json:"cluster-role,omitempty"`
ClusterRole ClusterRole `json:"cluster-role,omitempty" yaml:"cluster-role,omitempty"`
// DatastoreRole is the role that the node has within the datastore cluster.
// Only applicable for control-plane nodes, empty for workers.
DatastoreRole DatastoreRole `json:"datastore-role,omitempty"`
DatastoreRole DatastoreRole `json:"datastore-role,omitempty" yaml:"datastore-role,omitempty"`
}

// FeatureStatus encapsulates the deployment status of a feature.
type FeatureStatus struct {
// Enabled shows whether or not the deployment of manifests for a status was successful.
Enabled bool
Enabled bool `json:"enabled" yaml:"enabled"`
// Message contains information about the status of a feature. It is only supposed to be human readable and informative and should not be programmatically parsed.
Message string
Message string `json:"message" yaml:"message"`
// Version shows the version of the deployed feature.
Version string
Version string `json:"version" yaml:"version"`
// UpdatedAt shows when the last update was done.
UpdatedAt time.Time
UpdatedAt time.Time `json:"updated-at" yaml:"updated-at"`
}

func (f FeatureStatus) String() string {
Expand All @@ -76,13 +76,13 @@ type ClusterStatus struct {
Config UserFacingClusterConfig `json:"config,omitempty"`
Datastore Datastore `json:"datastore,omitempty"`

DNS FeatureStatus `json:"dns,omitempty"`
Network FeatureStatus `json:"network,omitempty"`
LoadBalancer FeatureStatus `json:"load-balancer,omitempty"`
Ingress FeatureStatus `json:"ingress,omitempty"`
Gateway FeatureStatus `json:"gateway,omitempty"`
MetricsServer FeatureStatus `json:"metrics-server,omitempty"`
LocalStorage FeatureStatus `json:"local-storage,omitempty"`
DNS FeatureStatus `json:"dns,omitempty" yaml:"dns,omitempty"`
Network FeatureStatus `json:"network,omitempty" yaml:"network,omitempty"`
LoadBalancer FeatureStatus `json:"load-balancer,omitempty" yaml:"load-balancer,omitempty"`
Ingress FeatureStatus `json:"ingress,omitempty" yaml:"ingress,omitempty"`
Gateway FeatureStatus `json:"gateway,omitempty" yaml:"gateway,omitempty"`
MetricsServer FeatureStatus `json:"metrics-server,omitempty" yaml:"metrics-server,omitempty"`
LocalStorage FeatureStatus `json:"local-storage,omitempty" yaml:"local-storage,omitempty"`
}

// HaClusterFormed returns true if the cluster is in high-availability mode (more than two voter nodes).
Expand Down
4 changes: 2 additions & 2 deletions src/k8s/cmd/k8s/k8s_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func newStatusCmd(env cmdutil.ExecutionEnvironment) *cobra.Command {
return
}

status.Config.MetricsServer = apiv1.MetricsServerConfig{}
status.Config.CloudProvider = nil
// silence the config, this should be retrieved with "k8s get".
status.Config = apiv1.UserFacingClusterConfig{}

outputFormatter.Print(status)
},
Expand Down

0 comments on commit a33cd3e

Please sign in to comment.