@@ -46,14 +46,16 @@ const (
4646 LabelZoneRegion = "failure-domain.beta.kubernetes.io/region"
4747
4848 // Common ClusterConditions for KubeFedClusterStatus
49- ClusterReady = "ClusterReady"
50- HealthzOk = "/healthz responded with ok"
51- ClusterNotReady = "ClusterNotReady"
52- HealthzNotOk = "/healthz responded without ok"
53- ClusterNotReachableReason = "ClusterNotReachable"
54- ClusterNotReachableMsg = "cluster is not reachable"
55- ClusterReachableReason = "ClusterReachable"
56- ClusterReachableMsg = "cluster is reachable"
49+ ClusterReady = "ClusterReady"
50+ HealthzOk = "/healthz responded with ok"
51+ ClusterNotReady = "ClusterNotReady"
52+ HealthzNotOk = "/healthz responded without ok"
53+ ClusterNotReachableReason = "ClusterNotReachable"
54+ ClusterNotReachableMsg = "cluster is not reachable"
55+ ClusterReachableReason = "ClusterReachable"
56+ ClusterReachableMsg = "cluster is reachable"
57+ ClusterConfigMalformedReason = "ClusterConfigMalformed"
58+ ClusterConfigMalformedMsg = "cluster's configuration may be malformed"
5759)
5860
5961// ClusterClient provides methods for determining the status and zones of a
@@ -124,6 +126,21 @@ func (c *ClusterClient) GetClusterHealthStatus() (*fedv1b1.KubeFedClusterStatus,
124126 LastProbeTime : currentTime ,
125127 LastTransitionTime : & currentTime ,
126128 }
129+ clusterConfigMalformedReason := ClusterConfigMalformedReason
130+ clusterConfigMalformedMsg := ClusterConfigMalformedMsg
131+ newClusterConfigMalformedCondition := fedv1b1.ClusterCondition {
132+ Type : fedcommon .ClusterConfigMalformed ,
133+ Status : corev1 .ConditionTrue ,
134+ Reason : & clusterConfigMalformedReason ,
135+ Message : & clusterConfigMalformedMsg ,
136+ LastProbeTime : currentTime ,
137+ LastTransitionTime : & currentTime ,
138+ }
139+ if c == nil {
140+ clusterStatus .Conditions = append (clusterStatus .Conditions , newClusterConfigMalformedCondition )
141+ metrics .RegisterKubefedClusterTotal (metrics .ClusterNotReady , c .clusterName )
142+ return & clusterStatus , nil
143+ }
127144 body , err := c .kubeClient .DiscoveryClient .RESTClient ().Get ().AbsPath ("/healthz" ).Do (context .Background ()).Raw ()
128145 if err != nil {
129146 runtime .HandleError (errors .Wrapf (err , "Failed to do cluster health check for cluster %q" , c .clusterName ))
0 commit comments