-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IPAM API and controllers (IPs, Networks)
- Loading branch information
Showing
25 changed files
with
1,867 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2019-2023 The Liqo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package v1alpha1 contains API Schema definitions for the IPAM v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=ipam.liqo.io | ||
package v1alpha1 | ||
|
||
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: "ipam.liqo.io", Version: "v1alpha1"} | ||
|
||
// 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,74 @@ | ||
// Copyright 2019-2023 The Liqo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
var ( | ||
// IPKind is the kind name used to register the IP CRD. | ||
IPKind = "IP" | ||
|
||
// IPResource is the resource name used to register the IP CRD. | ||
IPResource = "ips" | ||
|
||
// IPGroupVersionResource is the group version resource used to register IP CRD. | ||
IPGroupVersionResource = GroupVersion.WithResource(IPResource) | ||
|
||
// IPGroupResource is the group resource used to register IP CRD. | ||
IPGroupResource = schema.GroupResource{Group: GroupVersion.Group, Resource: IPResource} | ||
) | ||
|
||
// IPSpec defines a local IP. | ||
type IPSpec struct { | ||
// IP is the local IP. | ||
IP string `json:"ip"` | ||
} | ||
|
||
// IPStatus defines remapped IPs. | ||
type IPStatus struct { | ||
// IPMappings contains the mapping of the local IP for each remote cluster. | ||
IPMappings map[string]string `json:"ipMappings,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Local IP",type=string,JSONPath=`.spec.ip` | ||
// +kubebuilder:printcolumn:name="Remapped IPs",type=string,JSONPath=`.status.ipMappings`,priority=1 | ||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` | ||
|
||
// IP is the Schema for the IP API. | ||
type IP struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IPSpec `json:"spec"` | ||
Status IPStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// IPList contains a list of IP. | ||
type IPList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IP `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&IP{}, &IPList{}) | ||
} |
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,74 @@ | ||
// Copyright 2019-2023 The Liqo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
var ( | ||
// NetworkKind is the kind name used to register the Network CRD. | ||
NetworkKind = "Network" | ||
|
||
// NetworkResource is the resource name used to register the Network CRD. | ||
NetworkResource = "networks" | ||
|
||
// NetworkGroupVersionResource is the group version resource used to register the Network CRD. | ||
NetworkGroupVersionResource = GroupVersion.WithResource(NetworkResource) | ||
|
||
// NetworkGroupResource is the group resource used to register the Network CRD. | ||
NetworkGroupResource = schema.GroupResource{Group: GroupVersion.Group, Resource: NetworkResource} | ||
) | ||
|
||
// NetworkSpec defines the desired state of Network. | ||
type NetworkSpec struct { | ||
// CIDR is the desired CIDR for the remote cluster. | ||
CIDR string `json:"cidr"` | ||
} | ||
|
||
// NetworkStatus defines the observed state of Network. | ||
type NetworkStatus struct { | ||
// CIDR is the remapped CIDR for the remote cluster. | ||
CIDR string `json:"cidr,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Desired CIDR",type=string,JSONPath=`.spec.cidr` | ||
// +kubebuilder:printcolumn:name="Remapped CIDR",type=string,JSONPath=`.status.cidr` | ||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` | ||
|
||
// Network is the Schema for the Network API. | ||
type Network struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NetworkSpec `json:"spec"` | ||
Status NetworkStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// NetworkList contains a list of Network. | ||
type NetworkList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Network `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Network{}, &NetworkList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.