Skip to content

Commit

Permalink
Added the networkconfig.liqonet.liqo.io CRD to the network api
Browse files Browse the repository at this point in the history
Refactoring of the network api
  • Loading branch information
alacuku committed Aug 13, 2020
1 parent 390ce8f commit 6f55bf7
Show file tree
Hide file tree
Showing 22 changed files with 413 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "liqonet.liqo.io", Version: "v1"}
GroupVersion = schema.GroupVersion{Group: "liqonet.liqo.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions api/liqonet/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
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 liqonetliqoio v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=liqonet.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: "liqonet.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
)
73 changes: 73 additions & 0 deletions api/liqonet/v1alpha1/networkconfig_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
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"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// NetworkConfigSpec defines the desired state of NetworkConfig
type NetworkConfigSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
//the ID of the remote cluster that will receive this CRD
ClusterID string `json:"clusterID"`
//network subnet used in the local cluster for the pod IPs
PodCIDR string `json:"podCIDR"`
//public IP of the node where the VPN tunnel is created
TunnelPublicIP string `json:"tunnelPublicIP"`
//the IP address of the node in the private VPN subnet
TunnelPrivateIP string `json:"tunnelPrivateIP"`
}

// NetworkConfigStatus defines the observed state of NetworkConfig
type NetworkConfigStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
//indicates if the NAT is enabled for the remote cluster
NATEnabled bool `json:"natEnabled,omitempty"`
//the new subnet used to NAT the pods' subnet of the remote cluster
PodCIDRNAT string `json:"podCIDRNAT,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// NetworkConfig is the Schema for the networkconfigs API
type NetworkConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec NetworkConfigSpec `json:"spec,omitempty"`
Status NetworkConfigStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// NetworkConfigList contains a list of NetworkConfig
type NetworkConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NetworkConfig `json:"items"`
}

func init() {
SchemeBuilder.Register(&NetworkConfig{}, &NetworkConfigList{})
}
113 changes: 113 additions & 0 deletions api/liqonet/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion cmd/advertisement-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"time"

protocolv1 "github.com/liqoTech/liqo/api/advertisement-operator/v1"
liqonetv1 "github.com/liqoTech/liqo/api/tunnel-endpoint/v1"
liqonetv1 "github.com/liqoTech/liqo/api/liqonet/v1"
"github.com/liqoTech/liqo/internal/advertisement-operator"
"github.com/liqoTech/liqo/pkg/csrApprover"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down
2 changes: 1 addition & 1 deletion cmd/liqonet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/coreos/go-iptables/iptables"
protocolv1 "github.com/liqoTech/liqo/api/advertisement-operator/v1"
clusterConfig "github.com/liqoTech/liqo/api/cluster-config/v1"
"github.com/liqoTech/liqo/api/tunnel-endpoint/v1"
"github.com/liqoTech/liqo/api/liqonet/v1"
"github.com/liqoTech/liqo/internal/liqonet"
"github.com/liqoTech/liqo/pkg/liqonet"
"github.com/vishvananda/netlink"
Expand Down
83 changes: 83 additions & 0 deletions config/liqonet/crd/bases/liqonet.liqo.io_networkconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: networkconfigs.liqonet.liqo.io
spec:
group: liqonet.liqo.io
names:
kind: NetworkConfig
listKind: NetworkConfigList
plural: networkconfigs
singular: networkconfig
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: NetworkConfig is the Schema for the networkconfigs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: NetworkConfigSpec defines the desired state of NetworkConfig
properties:
clusterID:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "make" to regenerate code after modifying this file
the ID of the remote cluster that will receive this CRD'
type: string
podCIDR:
description: network subnet used in the local cluster for the pod IPs
type: string
tunnelPrivateIP:
description: the IP address of the node in the private VPN subnet
type: string
tunnelPublicIP:
description: public IP of the node where the VPN tunnel is created
type: string
required:
- clusterID
- podCIDR
- tunnelPrivateIP
- tunnelPublicIP
type: object
status:
description: NetworkConfigStatus defines the observed state of NetworkConfig
properties:
natEnabled:
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
of cluster Important: Run "make" to regenerate code after modifying
this file indicates if the NAT is enabled for the remote cluster'
type: boolean
podCIDRNAT:
description: the new subnet used to NAT the pods' subnet of the remote
cluster
type: string
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: tunnelendpoints.liqonet.liqo.io
spec:
Expand Down

0 comments on commit 6f55bf7

Please sign in to comment.