-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
update apis to v2beta2
Signed-off-by: Cyclinder Kuo <[email protected]>
Showing
43 changed files
with
4,338 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright 2022 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package v2beta1 is the v2beta1 version of the API. | ||
// +groupName=spiderpool.spidernet.io | ||
package v2beta1 |
26 changes: 26 additions & 0 deletions
26
pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go
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,26 @@ | ||
// Copyright 2022 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// +kubebuilder:object:generate=true | ||
// +groupName=spiderpool.spidernet.io | ||
|
||
// Package v1 contains API Schema definitions for the spiderpool v1 API group | ||
package v2beta1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
|
||
"github.com/spidernet-io/spiderpool/pkg/constant" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: constant.SpiderpoolAPIGroup, Version: constant.SpiderpoolAPIVersionV2beta2} | ||
|
||
// 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,24 @@ | ||
// Copyright 2022 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spiderippools,verbs=get;list;watch;create;update;patch;delete;deletecollection | ||
// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidersubnets;spiderendpoints;spiderreservedips;spidermultusconfigs;spiderclaimparameters,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidercoordinators,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidersubnets/status;spiderippools/status;spidercoordinators/status,verbs=get;update;patch | ||
// +kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=create;get;update | ||
// +kubebuilder:rbac:groups="apps",resources=statefulsets;deployments;replicasets;daemonsets,verbs=get;list;watch;update | ||
// +kubebuilder:rbac:groups="resource.k8s.io",resources=resourceclaims;resourceclaims/status;podschedulingcontexts/status;resourceclaimtemplates;resourceclasses;podschedulingcontexts,verbs=get;list;patch;watch;update | ||
// +kubebuilder:rbac:groups="networking.k8s.io",resources=servicecidrs,verbs=get;list;watch | ||
// +kubebuilder:rbac:groups="batch",resources=jobs;cronjobs,verbs=get;list;watch;update;delete | ||
// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch | ||
// +kubebuilder:rbac:groups="",resources=namespaces;endpoints;pods;pods/status;configmaps,verbs=get;list;watch;update;patch;delete;deletecollection | ||
// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups=kubevirt.io,resources=virtualmachines;virtualmachineinstances,verbs=get;list | ||
// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations;validatingwebhookconfigurations,verbs=get;list;watch;delete;update | ||
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch;create;update;patch;delete | ||
// +kubebuilder:rbac:groups=apps.kruise.io,resources=clonesets;statefulsets,verbs=get;list;watch | ||
// +kubebuilder:rbac:groups=crd.projectcalico.org,resources=ippools,verbs=get;list;watch | ||
// +kubebuilder:rbac:groups=cilium.io,resources=ciliumpodippools,verbs=get;list;watch | ||
|
||
package v2beta1 |
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,16 @@ | ||
// Copyright 2022 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v2beta1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects. | ||
var SchemeGroupVersion = GroupVersion | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} |
140 changes: 140 additions & 0 deletions
140
pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go
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,140 @@ | ||
// Copyright 2022 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v2beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// CoordinationSpec defines the desired state of SpiderCoordinator. | ||
type CoordinatorSpec struct { | ||
|
||
// Mode mode specifies the mode in which the coordinator runs, | ||
// and the configurable values include auto (default), underlay, | ||
// overlay, disabled. | ||
// +kubebuilder:validation:Enum=auto;underlay;overlay;disabled | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=auto | ||
Mode *string `json:"mode,omitempty"` | ||
|
||
// CoordinatorSpec is used by SpiderCoordinator and SpiderMultusConfig | ||
// in spidermultusconfig CRD , podCIDRType should not be required, which | ||
// could be merged from SpiderCoordinator CR | ||
// but in SpiderCoordinator CRD, podCIDRType should be required | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:validation:Enum=auto;cluster;calico;cilium;none | ||
PodCIDRType *string `json:"podCIDRType,omitempty"` | ||
|
||
// HijackCIDR configure static routing tables in the pod that target these | ||
// subnets to ensure that when the pod accesses these subnets, packets | ||
// are forwarded through the host network stack, such as nodelocaldns(169.254.0.0/16) | ||
// +kubebuilder:validation:Optional | ||
HijackCIDR []string `json:"hijackCIDR,omitempty"` | ||
|
||
// PodMACPrefix the fixed MAC address prefix, the length is two bytes. | ||
// the lowest bit of the first byte must be 0, which indicates the | ||
// unicast MAC address. example: 0a:1b | ||
// +kubebuilder:validation:Optional | ||
PodMACPrefix *string `json:"podMACPrefix,omitempty"` | ||
|
||
// TunePodRoutes specifies whether to tune pod routes of multiple NICs on pods. | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=true | ||
TunePodRoutes *bool `json:"tunePodRoutes,omitempty"` | ||
|
||
// PodDefaultRouteNIC PodDefaultRouteNIC is used to configure the NIC where | ||
// the pod's default route resides. the default value is empty, which means | ||
// the default route will remain at eth0. | ||
// +kubebuilder:validation:Optional | ||
PodDefaultRouteNIC *string `json:"podDefaultRouteNIC,omitempty"` | ||
|
||
// HostRuleTable specifies the table number of the routing table used | ||
// to configure the communication between the pod and the local node. | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=500 | ||
HostRuleTable *int `json:"hostRuleTable,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=0 | ||
// HostRPFilter is used for coordiantor to help set the rp_filter parameters | ||
// of the node. NOTE: This field is considered deprecated in the future. | ||
// the rp_filter of the node should be configured by spiderpool-agent | ||
// rather than coordinator plugin. | ||
// Configurable values: <negative number>/0/1/2, -1 means leave it as it is. the default value is 0. | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=0 | ||
HostRPFilter *int `json:"hostRPFilter,omitempty"` | ||
|
||
// PodRPFilter is used for coordiantor to help set the rp_filter parameters of the pod. | ||
// Configurable values: <negative number>/0/1/2. negative number means leave it as it is. | ||
// the default value is 0. | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=0 | ||
PodRPFilter *int `json:"podRPFilter,omitempty"` | ||
|
||
// TxQueueLen to set the tx_queue_len of the pod. requirement is a positive integer | ||
// the default value is 0, which means leaving it as it is. | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=0 | ||
TxQueueLen *int `json:"txQueueLen,omitempty"` | ||
|
||
// DetectIPConflict to detect the ip conflict for the pod | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=false | ||
DetectIPConflict *bool `json:"detectIPConflict,omitempty"` | ||
|
||
// DetectGateway to detect the gateway for the pod | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default=false | ||
DetectGateway *bool `json:"detectGateway,omitempty"` | ||
|
||
// VethLinkAddress configure a ipv4 link-local address | ||
// for veth0 device. empty means disable. default is empty. | ||
// Format is like 169.254.100.1 | ||
VethLinkAddress *string `json:"vethLinkAddress,omitempty"` | ||
} | ||
|
||
// CoordinationStatus defines the observed state of SpiderCoordinator. | ||
type CoordinatorStatus struct { | ||
// +kubebuilder:validation:Requred | ||
Phase string `json:"phase"` | ||
|
||
// +kubebuilder: validation:Optional | ||
Reason string `json:"reason,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
OverlayPodCIDR []string `json:"overlayPodCIDR"` | ||
|
||
// +kubebuilder:validation:Optional | ||
ServiceCIDR []string `json:"serviceCIDR"` | ||
} | ||
|
||
// +kubebuilder:resource:categories={spiderpool},path="spidercoordinators",scope="Cluster",shortName={scc},singular="spidercoordinator" | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +genclient | ||
// +genclient:nonNamespaced | ||
|
||
// SpiderCoordinator is the Schema for the spidercoordinators API. | ||
type SpiderCoordinator struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec CoordinatorSpec `json:"spec,omitempty"` | ||
Status CoordinatorStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// SpiderCoordinatorList contains a list of SpiderCoordinator. | ||
type SpiderCoordinatorList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []SpiderCoordinator `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&SpiderCoordinator{}, &SpiderCoordinatorList{}) | ||
} |
98 changes: 98 additions & 0 deletions
98
pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go
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,98 @@ | ||
// Copyright 2022 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v2beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// WorkloadEndpointStatus defines the observed state of SpiderEndpoint. | ||
type WorkloadEndpointStatus struct { | ||
// +kubebuilder:validation:Required | ||
Current PodIPAllocation `json:"current"` | ||
|
||
// +kubebuilder:validation:Required | ||
OwnerControllerType string `json:"ownerControllerType"` | ||
|
||
// +kubebuilder:validation:Required | ||
OwnerControllerName string `json:"ownerControllerName"` | ||
} | ||
|
||
type PodIPAllocation struct { | ||
// +kubebuilder:validation:Required | ||
UID string `json:"uid"` | ||
|
||
// +kubebuilder:validation:Required | ||
Node string `json:"node"` | ||
|
||
// +kubebuilder:validation:Required | ||
IPs []IPAllocationDetail `json:"ips"` | ||
} | ||
|
||
type IPAllocationDetail struct { | ||
// +kubebuilder:validation:Required | ||
NIC string `json:"interface"` | ||
|
||
// +kubebuilder:validation:Optional | ||
IPv4 *string `json:"ipv4,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
IPv6 *string `json:"ipv6,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
IPv4Pool *string `json:"ipv4Pool,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
IPv6Pool *string `json:"ipv6Pool,omitempty"` | ||
|
||
// DEPRECATED: Vlan is deprecated. | ||
// +kubebuilder:default=0 | ||
// +kubebuilder:validation:Maximum=4094 | ||
// +kubebuilder:validation:Minimum=0 | ||
// +kubebuilder:validation:Optional | ||
Vlan *int64 `json:"vlan,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
IPv4Gateway *string `json:"ipv4Gateway,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
IPv6Gateway *string `json:"ipv6Gateway,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
CleanGateway *bool `json:"cleanGateway,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
Routes []Route `json:"routes,omitempty"` | ||
} | ||
|
||
// +kubebuilder:resource:categories={spiderpool},path="spiderendpoints",scope="Namespaced",shortName={se},singular="spiderendpoint" | ||
// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].interface",description="interface",name="INTERFACE",type=string | ||
// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv4Pool",description="ipv4Pool",name="IPV4POOL",type=string | ||
// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv4",description="ipv4",name="IPV4",type=string | ||
// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv6Pool",description="ipv6Pool",name="IPV6POOL",type=string | ||
// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv6",description="ipv6",name="IPV6",type=string | ||
// +kubebuilder:printcolumn:JSONPath=".status.current.node",description="node",name="NODE",type=string | ||
// +kubebuilder:object:root=true | ||
|
||
// Spiderndpoint is the Schema for the spiderendpoints API. | ||
type SpiderEndpoint struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Status WorkloadEndpointStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// SpiderEndpointList contains a list of SpiderEndpoint. | ||
type SpiderEndpointList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []SpiderEndpoint `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&SpiderEndpoint{}, &SpiderEndpointList{}) | ||
} |
Oops, something went wrong.