Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenAPI descriptions for AntreaAgentInfo and AntreaControllerInfo #4390

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 69 additions & 36 deletions pkg/apis/crd/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,57 @@ import (
type AntreaAgentInfo struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Version string `json:"version,omitempty"` // Antrea binary version
PodRef corev1.ObjectReference `json:"podRef,omitempty"` // The Pod that Antrea Agent is running in
NodeRef corev1.ObjectReference `json:"nodeRef,omitempty"` // The Node that Antrea Agent is running in
NodeSubnets []string `json:"nodeSubnets,omitempty"` // Node subnets
OVSInfo OVSInfo `json:"ovsInfo,omitempty"` // OVS Information
NetworkPolicyControllerInfo NetworkPolicyControllerInfo `json:"networkPolicyControllerInfo,omitempty"` // Antrea Agent NetworkPolicy information
LocalPodNum int32 `json:"localPodNum,omitempty"` // The number of Pods which the agent is in charge of
AgentConditions []AgentCondition `json:"agentConditions,omitempty"` // Agent condition contains types like AgentHealthy
APIPort int `json:"apiPort,omitempty"` // The port of antrea agent API Server
// Antrea binary version
Version string `json:"version,omitempty"`
// The Pod that Antrea Agent is running in
PodRef corev1.ObjectReference `json:"podRef,omitempty"`
// The Node that Antrea Agent is running in
NodeRef corev1.ObjectReference `json:"nodeRef,omitempty"`
// Node subnets
NodeSubnets []string `json:"nodeSubnets,omitempty"`
// OVS Information
OVSInfo OVSInfo `json:"ovsInfo,omitempty"`
// Antrea Agent NetworkPolicy information
NetworkPolicyControllerInfo NetworkPolicyControllerInfo `json:"networkPolicyControllerInfo,omitempty"`
// The number of Pods which the agent is in charge of
LocalPodNum int32 `json:"localPodNum,omitempty"`
// Agent condition contains types like AgentHealthy
AgentConditions []AgentCondition `json:"agentConditions,omitempty"`
// The port of antrea agent API Server
APIPort int `json:"apiPort,omitempty"`
}

type OVSInfo struct {
Version string `json:"version,omitempty"`
BridgeName string `json:"bridgeName,omitempty"`
FlowTable map[string]int32 `json:"flowTable,omitempty"` // Key: flow table name, Value: flow number
Version string `json:"version,omitempty"`
BridgeName string `json:"bridgeName,omitempty"`
// Key: flow table name, Value: flow number
FlowTable map[string]int32 `json:"flowTable,omitempty"`
}

type AgentConditionType string

const (
AgentHealthy AgentConditionType = "AgentHealthy" // Status is always set to be True and LastHeartbeatTime is used to check Agent health status.
ControllerConnectionUp AgentConditionType = "ControllerConnectionUp" // Status True/False is used to mark the connection status between Agent and Controller.
OVSDBConnectionUp AgentConditionType = "OVSDBConnectionUp" // Status True/False is used to mark OVSDB connection status.
OpenflowConnectionUp AgentConditionType = "OpenflowConnectionUp" // Status True/False is used to mark Openflow connection status.
// AgentHealthy's Status is always set to be True and its LastHeartbeatTime is used to check Agent health status.
AgentHealthy AgentConditionType = "AgentHealthy"
// ControllerConnectionUp is used to mark the connection status between Agent and Controller.
ControllerConnectionUp AgentConditionType = "ControllerConnectionUp"
// OVSDBConnectionUp is used to mark OVSDB connection status.
OVSDBConnectionUp AgentConditionType = "OVSDBConnectionUp"
// OpenflowConnectionUp is used to mark Openflow connection status.
OpenflowConnectionUp AgentConditionType = "OpenflowConnectionUp"
)

type AgentCondition struct {
Type AgentConditionType `json:"type"` // One of the AgentConditionType listed above
Status corev1.ConditionStatus `json:"status"` // Mark certain type status, one of True, False, Unknown
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime"` // The timestamp when AntreaAgentInfo is created/updated, ideally heartbeat interval is 60s
Reason string `json:"reason,omitempty"` // Brief reason
Message string `json:"message,omitempty"` // Human readable message indicating details
// One of the AgentConditionType listed above
Type AgentConditionType `json:"type"`
// Mark certain type status, one of True, False, Unknown
Status corev1.ConditionStatus `json:"status"`
// The timestamp when AntreaAgentInfo is created/updated, ideally heartbeat interval is 60s
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime"`
// Brief reason
Reason string `json:"reason,omitempty"`
// Human readable message indicating details
Message string `json:"message,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -78,14 +96,22 @@ type AntreaControllerInfo struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Version string `json:"version,omitempty"` // Antrea binary version
PodRef corev1.ObjectReference `json:"podRef,omitempty"` // The Pod that Antrea Controller is running in
NodeRef corev1.ObjectReference `json:"nodeRef,omitempty"` // The Node that Antrea Controller is running in
ServiceRef corev1.ObjectReference `json:"serviceRef,omitempty"` // Antrea Controller Service
NetworkPolicyControllerInfo NetworkPolicyControllerInfo `json:"networkPolicyControllerInfo,omitempty"` // Antrea Controller NetworkPolicy information
ConnectedAgentNum int32 `json:"connectedAgentNum,omitempty"` // Number of agents which are connected to this controller
ControllerConditions []ControllerCondition `json:"controllerConditions,omitempty"` // Controller condition contains types like ControllerHealthy
APIPort int `json:"apiPort,omitempty"` // The port of antrea controller API Server
// Antrea binary version
Version string `json:"version,omitempty"`
// The Pod that Antrea Controller is running in
PodRef corev1.ObjectReference `json:"podRef,omitempty"`
// The Node that Antrea Controller is running in
NodeRef corev1.ObjectReference `json:"nodeRef,omitempty"`
// Antrea Controller Service
ServiceRef corev1.ObjectReference `json:"serviceRef,omitempty"`
// Antrea Controller NetworkPolicy information
NetworkPolicyControllerInfo NetworkPolicyControllerInfo `json:"networkPolicyControllerInfo,omitempty"`
// Number of agents which are connected to this controller
ConnectedAgentNum int32 `json:"connectedAgentNum,omitempty"`
// Controller condition contains types like ControllerHealthy
ControllerConditions []ControllerCondition `json:"controllerConditions,omitempty"`
// The port of antrea controller API Server
APIPort int `json:"apiPort,omitempty"`
}

type NetworkPolicyControllerInfo struct {
Expand All @@ -106,13 +132,20 @@ type AntreaControllerInfoList struct {
type ControllerConditionType string

const (
ControllerHealthy ControllerConditionType = "ControllerHealthy" // Status is always set to be True and LastHeartbeatTime is used to check Controller health status.
// ControllerHealthy's Status is always set to be True and its LastHeartbeatTime is used to check Controller health
// status.
ControllerHealthy ControllerConditionType = "ControllerHealthy"
)

type ControllerCondition struct {
Type ControllerConditionType `json:"type"` // One of the ControllerConditionType listed above, controllerHealthy
Status corev1.ConditionStatus `json:"status"` // Mark certain type status, one of True, False, Unknown
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime"` // The timestamp when AntreaControllerInfo is created/updated, ideally heartbeat interval is 60s
Reason string `json:"reason,omitempty"` // Brief reason
Message string `json:"message,omitempty"` // Human readable message indicating details
// One of the ControllerConditionType listed above, controllerHealthy
Type ControllerConditionType `json:"type"`
// Mark certain type status, one of True, False, Unknown
Status corev1.ConditionStatus `json:"status"`
// The timestamp when AntreaControllerInfo is created/updated, ideally heartbeat interval is 60s
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime"`
// Brief reason
Reason string `json:"reason,omitempty"`
// Human readable message indicating details
Message string `json:"message,omitempty"`
}
73 changes: 39 additions & 34 deletions pkg/apiserver/openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.