-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: revert golang net upgrade (#782)
revert golang net
- Loading branch information
1 parent
dd30c2e
commit 331ec9c
Showing
269 changed files
with
45,380 additions
and
6,815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: thehanimo/[email protected].1 | ||
- uses: thehanimo/[email protected].2 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
pass_on_octokit_error: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type ClusterState string | ||
|
||
const ( | ||
ClusterStateJoin ClusterState = "Join" | ||
ClusterStateLeave ClusterState = "Leave" | ||
) | ||
|
||
// ResourceUsage contains the observed resource usage of a member cluster. | ||
type ResourceUsage struct { | ||
// Capacity represents the total resource capacity of all the nodes on a member cluster. | ||
// | ||
// A node's total capacity is the amount of resource installed on the node. | ||
// +optional | ||
Capacity corev1.ResourceList `json:"capacity,omitempty"` | ||
|
||
// Allocatable represents the total allocatable resources of all the nodes on a member cluster. | ||
// | ||
// A node's allocatable capacity is the amount of resource that can actually be used | ||
// for user workloads, i.e., | ||
// allocatable capacity = total capacity - capacities reserved for the OS, kubelet, etc. | ||
// | ||
// For more information, see | ||
// https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/. | ||
// +optional | ||
Allocatable corev1.ResourceList `json:"allocatable,omitempty"` | ||
|
||
// Available represents the total available resources of all the nodes on a member cluster. | ||
// | ||
// A node's available capacity is the amount of resource that has not been used yet, i.e., | ||
// available capacity = allocatable capacity - capacity that has been requested by workloads. | ||
// | ||
// This field is beta-level; it is for the property-based scheduling feature and is only | ||
// populated when a property provider is enabled in the deployment. | ||
// +optional | ||
Available corev1.ResourceList `json:"available,omitempty"` | ||
|
||
// When the resource usage is observed. | ||
// +optional | ||
ObservationTime metav1.Time `json:"observationTime,omitempty"` | ||
} | ||
|
||
// AgentType defines a type of agent/binary running in a member cluster. | ||
type AgentType string | ||
|
||
const ( | ||
// MemberAgent (core) handles member cluster joining/leaving as well as k8s object placement from hub to member clusters. | ||
MemberAgent AgentType = "MemberAgent" | ||
// MultiClusterServiceAgent (networking) is responsible for exposing multi-cluster services via L4 load | ||
// balancer. | ||
MultiClusterServiceAgent AgentType = "MultiClusterServiceAgent" | ||
// ServiceExportImportAgent (networking) is responsible for export or import services across multi-clusters. | ||
ServiceExportImportAgent AgentType = "ServiceExportImportAgent" | ||
) | ||
|
||
// AgentStatus defines the observed status of the member agent of the given type. | ||
type AgentStatus struct { | ||
// Type of the member agent. | ||
// +required | ||
Type AgentType `json:"type"` | ||
|
||
// +patchMergeKey=type | ||
// +patchStrategy=merge | ||
// +listType=map | ||
// +listMapKey=type | ||
|
||
// Conditions is an array of current observed conditions for the member agent. | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
|
||
// Last time we received a heartbeat from the member agent. | ||
// +optional | ||
LastReceivedHeartbeat metav1.Time `json:"lastReceivedHeartbeat,omitempty"` | ||
} | ||
|
||
// AgentConditionType identifies a specific condition on the Agent. | ||
type AgentConditionType string | ||
|
||
const ( | ||
// AgentJoined indicates the join condition of the given member agent. | ||
// Its condition status can be one of the following: | ||
// - "True" means the member agent has joined. | ||
// - "False" means the member agent has left. | ||
// - "Unknown" means the member agent is joining or leaving or in an unknown status. | ||
AgentJoined AgentConditionType = "Joined" | ||
// AgentHealthy indicates the health condition of the given member agent. | ||
// Its condition status can be one of the following: | ||
// - "True" means the member agent is healthy. | ||
// - "False" means the member agent is unhealthy. | ||
// - "Unknown" means the member agent has an unknown health status. | ||
AgentHealthy AgentConditionType = "Healthy" | ||
) | ||
|
||
const ( | ||
MemberClusterKind = "MemberCluster" | ||
MemberClusterResource = "memberclusters" | ||
InternalMemberClusterKind = "InternalMemberCluster" | ||
ClusterResourcePlacementResource = "clusterresourceplacements" | ||
) | ||
|
||
// A ConditionedWithType may have conditions set or retrieved based on agent type. Conditions typically | ||
// indicate the status of both a resource and its reconciliation process. | ||
// +kubebuilder:object:generate=false | ||
type ConditionedWithType interface { | ||
SetConditionsWithType(AgentType, ...metav1.Condition) | ||
GetConditionWithType(AgentType, string) *metav1.Condition | ||
} | ||
|
||
// A ConditionedAgentObj is for kubernetes resources where multiple agents can set and update conditions within AgentStatus. | ||
// +kubebuilder:object:generate=false | ||
type ConditionedAgentObj interface { | ||
client.Object | ||
ConditionedWithType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
|
||
// Package v1 contains API Schema definitions for the fleet cluster v1 API group. | ||
|
||
// +kubebuilder:object:generate=true | ||
// +k8s:deepcopy-gen=package,register | ||
// +groupName=cluster.kubernetes-fleet.io | ||
package v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
|
||
// +kubebuilder:object:generate=true | ||
// +groupName=cluster.kubernetes-fleet.io | ||
package v1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects. | ||
GroupVersion = schema.GroupVersion{Group: "cluster.kubernetes-fleet.io", Version: "v1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme. | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/api/meta" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:scope=Namespaced,categories={fleet,fleet-cluster},shortName=imc | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date | ||
|
||
// InternalMemberCluster is used by hub agent to notify the member agents about the member cluster state changes, and is used by the member agents to report their status. | ||
type InternalMemberCluster struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// The desired state of InternalMemberCluster. | ||
// +required | ||
Spec InternalMemberClusterSpec `json:"spec"` | ||
|
||
// The observed status of InternalMemberCluster. | ||
// +optional | ||
Status InternalMemberClusterStatus `json:"status,omitempty"` | ||
} | ||
|
||
// InternalMemberClusterSpec defines the desired state of InternalMemberCluster. Set by the hub agent. | ||
type InternalMemberClusterSpec struct { | ||
// +kubebuilder:validation:Required,Enum=Join;Leave | ||
|
||
// The desired state of the member cluster. Possible values: Join, Leave. | ||
// +required | ||
State ClusterState `json:"state"` | ||
|
||
// +kubebuilder:default=60 | ||
// +kubebuilder:validation:Minimum=1 | ||
// +kubebuilder:validation:Maximum=600 | ||
|
||
// How often (in seconds) for the member cluster to send a heartbeat to the hub cluster. Default: 60 seconds. Min: 1 second. Max: 10 minutes. | ||
// +optional | ||
HeartbeatPeriodSeconds int32 `json:"heartbeatPeriodSeconds,omitempty"` | ||
} | ||
|
||
// InternalMemberClusterStatus defines the observed state of InternalMemberCluster. | ||
type InternalMemberClusterStatus struct { | ||
// Conditions is an array of current observed conditions for the member cluster. | ||
// +optional | ||
Conditions []metav1.Condition `json:"conditions"` | ||
|
||
// Properties is an array of properties observed for the member cluster. | ||
// | ||
// This field is beta-level; it is for the property-based scheduling feature and is only | ||
// populated when a property provider is enabled in the deployment. | ||
// +optional | ||
Properties map[PropertyName]PropertyValue `json:"properties,omitempty"` | ||
|
||
// The current observed resource usage of the member cluster. It is populated by the member agent. | ||
// +optional | ||
ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"` | ||
|
||
// AgentStatus is an array of current observed status, each corresponding to one member agent running in the member cluster. | ||
// +optional | ||
AgentStatus []AgentStatus `json:"agentStatus,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// InternalMemberClusterList contains a list of InternalMemberCluster. | ||
type InternalMemberClusterList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []InternalMemberCluster `json:"items"` | ||
} | ||
|
||
// SetConditionsWithType is used to add condition to AgentStatus for a given agentType. | ||
func (m *InternalMemberCluster) SetConditionsWithType(agentType AgentType, conditions ...metav1.Condition) { | ||
desiredAgentStatus := m.GetAgentStatus(agentType) | ||
for _, c := range conditions { | ||
meta.SetStatusCondition(&desiredAgentStatus.Conditions, c) | ||
} | ||
} | ||
|
||
// GetConditionWithType is used to retrieve the desired condition from AgentStatus for given agentType | ||
func (m *InternalMemberCluster) GetConditionWithType(agentType AgentType, conditionType string) *metav1.Condition { | ||
var desiredAgentStatus AgentStatus | ||
for _, agentStatus := range m.Status.AgentStatus { | ||
if agentType == agentStatus.Type { | ||
desiredAgentStatus = agentStatus | ||
} | ||
} | ||
if desiredAgentStatus.Type == agentType { | ||
return meta.FindStatusCondition(desiredAgentStatus.Conditions, conditionType) | ||
} | ||
return nil | ||
} | ||
|
||
// GetAgentStatus is used to retrieve agent status from internal member cluster, | ||
// if it doesn't exist it creates the expected agent status and returns it. | ||
func (m *InternalMemberCluster) GetAgentStatus(agentType AgentType) *AgentStatus { | ||
for i := range m.Status.AgentStatus { | ||
if m.Status.AgentStatus[i].Type == agentType { | ||
return &m.Status.AgentStatus[i] | ||
} | ||
} | ||
agentStatus := AgentStatus{ | ||
Type: agentType, | ||
Conditions: []metav1.Condition{}, | ||
} | ||
m.Status.AgentStatus = append(m.Status.AgentStatus, agentStatus) | ||
return &m.Status.AgentStatus[len(m.Status.AgentStatus)-1] | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&InternalMemberCluster{}, &InternalMemberClusterList{}) | ||
} |
Oops, something went wrong.