Skip to content

Commit

Permalink
Address fra98 comments
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiolor committed Oct 24, 2024
1 parent c16a934 commit 0fb45f0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apis/core/v1beta1/foreigncluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const (
NetworkConfigurationStatusCondition ConditionType = "NetworkConfigurationStatus"
// NetworkConnectionStatusCondition shows the network connection status.
NetworkConnectionStatusCondition ConditionType = "NetworkConnectionStatus"
NetworkGatewayPresenceCondition ConditionType = "NetworkGatewayPresence"
// NetworkGatewayServerStatusCondition shows the network gateway server status.
NetworkGatewayServerStatusCondition ConditionType = "NetworkGatewayServerStatus"
// NetworkGatewayClientStatusCondition shows the network gateway client status.
Expand Down Expand Up @@ -141,7 +142,7 @@ const (
// Condition contains details about state of a.
type Condition struct {
// Type of the condition.
// +kubebuilder:validation:Enum="APIServerStatus";"NetworkConnectionStatus";"NetworkGatewayServerStatus";"NetworkGatewayClientStatus";"NetworkConfigurationStatus";"AuthIdentityControlPlaneStatus";"AuthTenantStatus";"OffloadingVirtualNodeStatus";"OffloadingNodeStatus"
// +kubebuilder:validation:Enum="APIServerStatus";"NetworkConnectionStatus";"NetworkGatewayServerStatus";"NetworkGatewayClientStatus";"NetworkGatewayPresence";"NetworkConfigurationStatus";"AuthIdentityControlPlaneStatus";"AuthTenantStatus";"OffloadingVirtualNodeStatus";"OffloadingNodeStatus"
//
//nolint:lll // ignore long lines given by Kubebuilder marker annotations
Type ConditionType `json:"type"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ spec:
- NetworkConnectionStatus
- NetworkGatewayServerStatus
- NetworkGatewayClientStatus
- NetworkGatewayPresence
- NetworkConfigurationStatus
- AuthIdentityControlPlaneStatus
- AuthTenantStatus
Expand Down Expand Up @@ -171,6 +172,7 @@ spec:
- NetworkConnectionStatus
- NetworkGatewayServerStatus
- NetworkGatewayClientStatus
- NetworkGatewayPresence
- NetworkConfigurationStatus
- AuthIdentityControlPlaneStatus
- AuthTenantStatus
Expand Down Expand Up @@ -233,6 +235,7 @@ spec:
- NetworkConnectionStatus
- NetworkGatewayServerStatus
- NetworkGatewayClientStatus
- NetworkGatewayPresence
- NetworkConfigurationStatus
- AuthIdentityControlPlaneStatus
- AuthTenantStatus
Expand Down Expand Up @@ -295,6 +298,7 @@ spec:
- NetworkConnectionStatus
- NetworkGatewayServerStatus
- NetworkGatewayClientStatus
- NetworkGatewayPresence
- NetworkConfigurationStatus
- AuthIdentityControlPlaneStatus
- AuthTenantStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ const (
gatewayMissingReason = "GatewayMissing"
gatewayMissingMessage = "The gateway resource connecting to the foreign cluster is missing"

networkConfigurationStatusReason = "NetworkConfigurationPresence"
networkConfigurationStatusMessage = "The network configuration of the peer cluster is present"
gatewayPresentReason = "GatewayPresence"
gatewayPresentMessage = "There is a gateway connecting to the foreign cluster"

networkConfigurationPresenceReason = "NetworkConfigurationPresence"
networkConfigurationPresenceMessage = "The network configuration of the peer cluster is present"

networkConfigurationMissingReason = "NetworkConfigurationMissing"
networkConfigurationMissingMessage = "The network configuration for the connection with the foreign cluster is missing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,17 @@ func (r *ForeignClusterReconciler) handleGatewaysStatus(ctx context.Context,

if errors.IsNotFound(errServer) && errors.IsNotFound(errClient) {
klog.V(6).Infof("Both GatewayServer and GatewayClient resources not found for ForeignCluster %q", clusterID)
statusExceptions[liqov1beta1.NetworkGatewayClientStatusCondition] = statusException{
statusExceptions[liqov1beta1.NetworkGatewayPresenceCondition] = statusException{
ConditionStatusType: liqov1beta1.ConditionStatusNotReady,
Reason: gatewayMissingReason,
Message: gatewayMissingMessage,
}
} else {
statusExceptions[liqov1beta1.NetworkGatewayPresenceCondition] = statusException{
ConditionStatusType: liqov1beta1.ConditionStatusReady,
Reason: gatewayPresentReason,
Message: gatewayPresentMessage,
}
}

switch {
Expand Down Expand Up @@ -207,7 +213,7 @@ func (r *ForeignClusterReconciler) handleNetworkConfigurationStatus(ctx context.
fcutils.EnableModuleNetworking(fc)
fcutils.EnsureModuleCondition(&fc.Status.Modules.Networking,
liqov1beta1.NetworkConfigurationStatusCondition, liqov1beta1.ConditionStatusReady,
networkConfigurationStatusReason, networkConfigurationStatusMessage)
networkConfigurationPresenceReason, networkConfigurationPresenceMessage)
}
return nil
}
Expand Down

0 comments on commit 0fb45f0

Please sign in to comment.