-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use subnet crd to manage logical switch
- Loading branch information
Showing
689 changed files
with
84,212 additions
and
17,214 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
set -x | ||
|
||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. | ||
CODEGEN_PKG=$GOPATH/src/k8s.io/code-generator | ||
|
||
# generate the code with: | ||
# --output-base because this script should also be able to run inside the vendor dir of | ||
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir | ||
# instead of the $GOPATH directly. For normal projects this can be dropped. | ||
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ | ||
github.com/alauda/kube-ovn/pkg/client github.com/alauda/kube-ovn/pkg/apis \ | ||
kubeovn: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,5 @@ | ||
package kubeovn | ||
|
||
const ( | ||
GroupName = "kubeovn.io" | ||
) |
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,4 @@ | ||
// +k8s:deepcopy-gen=package | ||
// +groupName=kubeovn.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,41 @@ | ||
package v1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
"github.com/alauda/kube-ovn/pkg/apis/kubeovn" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: kubeovn.GroupName, Version: "v1"} | ||
|
||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind | ||
func Kind(kind string) schema.GroupKind { | ||
return SchemeGroupVersion.WithKind(kind).GroupKind() | ||
} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
// SchemeBuilder initializes a scheme builder | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
// AddToScheme is a global function that registers this API group & version to a scheme | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&IP{}, | ||
&IPList{}, | ||
&Subnet{}, | ||
&SubnetList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
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,81 @@ | ||
package v1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
ProtocolIPv4 = "IPv4" | ||
ProtocolIPv6 = "IPv6" | ||
PrtotcolDual = "Dual" | ||
|
||
GWDistributedType = "distributed" | ||
GWCentralizedType = "centralized" | ||
) | ||
|
||
// +genclient | ||
// +genclient:noStatus | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +genclient:nonNamespaced | ||
|
||
type IP struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IPSpec `json:"spec"` | ||
} | ||
|
||
type IPSpec struct { | ||
PodName string `json:"podName"` | ||
Namespace string `json:"namespace"` | ||
NodeName string `json:"nodeName"` | ||
IPAddress string `json:"ipAddress"` | ||
MacAddress string `json:"macAddress"` | ||
ContainerID string `json:"containerID"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
type IPList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
|
||
Items []IP `json:"items"` | ||
} | ||
|
||
// +genclient | ||
// +genclient:noStatus | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +genclient:nonNamespaced | ||
|
||
type Subnet struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec SubnetSpec `json:"spec"` | ||
} | ||
|
||
type SubnetSpec struct { | ||
Default bool `json:"default"` | ||
Protocol string `json:"protocol"` | ||
Namespaces []string `json:"namespaces,omitempty"` | ||
CIDRBlock string `json:"cidrBlock"` | ||
Gateway string `json:"gateway"` | ||
ExcludeIps []string `json:"excludeIps,omitempty"` | ||
|
||
GatewayType string `json:"gatewayType"` | ||
GatewayNode string `json:"gatewayNode"` | ||
NatOutgoing bool `json:"natOutgoing"` | ||
|
||
Private bool `json:"private"` | ||
AllowSubnets []string `json:"allowSubnets,omitempty"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
type SubnetList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
|
||
Items []Subnet `json:"items"` | ||
} |
Oops, something went wrong.