-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
40,590 additions
and
0 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,89 @@ | ||
// 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" | ||
) | ||
|
||
// 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. | ||
|
||
// ConfigurationResource the name of the configuration resources. | ||
var ConfigurationResource = "configuration" | ||
|
||
// ConfigurationKind is the kind name used to register the Configuration CRD. | ||
var ConfigurationKind = "Configuration" | ||
|
||
// ConfigurationGroupResource is group resource used to register these objects. | ||
var ConfigurationGroupResource = schema.GroupResource{Group: GroupVersion.Group, Resource: ConfigurationResource} | ||
|
||
// ConfigurationGroupVersionResource is groupResourceVersion used to register these objects. | ||
var ConfigurationGroupVersionResource = GroupVersion.WithResource(ConfigurationResource) | ||
|
||
// CIDR defines the CIDR of the cluster. | ||
type CIDR struct { | ||
// Pod CIDR of the cluster. | ||
Pod string `json:"pod,omitempty"` | ||
// External CIDR of the cluster. | ||
External string `json:"external,omitempty"` | ||
} | ||
|
||
// ClusterConfig defines the configuration of a cluster. | ||
type ClusterConfig struct { | ||
// CIDR of the cluster. | ||
CIDR CIDR `json:"cidr,omitempty"` | ||
} | ||
|
||
// ConfigurationSpec defines the desired state of Configuration. | ||
type ConfigurationSpec struct { | ||
// Local configuration. | ||
Local ClusterConfig `json:"local,omitempty"` | ||
// Remote configuration. | ||
Remote ClusterConfig `json:"remote,omitempty"` | ||
} | ||
|
||
// ConfigurationStatus defines the observed state of Configuration. | ||
type ConfigurationStatus struct { | ||
// Remote remapped configuration. | ||
Remote ClusterConfig `json:"remote,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:categories=liqo | ||
// +kubebuilder:subresource:status | ||
|
||
// Configuration is the Schema for the configuration API. | ||
type Configuration struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ConfigurationSpec `json:"spec,omitempty"` | ||
Status ConfigurationStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ConfigurationList contains a list of Configuration. | ||
type ConfigurationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Configuration `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Configuration{}, &ConfigurationList{}) | ||
} |
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,141 @@ | ||
// 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 ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// 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. | ||
|
||
// ConnectionResource the name of the connection resources. | ||
var ConnectionResource = "connection" | ||
|
||
// ConnectionKind specifies the kind of the connection. | ||
var ConnectionKind = "Connection" | ||
|
||
// ConnectionGroupResource is group resource used to register these objects. | ||
var ConnectionGroupResource = schema.GroupResource{Group: GroupVersion.Group, Resource: ConnectionResource} | ||
|
||
// ConnectionGroupVersionResource is groupResourceVersion used to register these objects. | ||
var ConnectionGroupVersionResource = GroupVersion.WithResource(ConnectionResource) | ||
|
||
// ConnectionType represents the type of a connection. | ||
type ConnectionType string | ||
|
||
const ( | ||
// ConnectionTypeServer represents a server connection. | ||
ConnectionTypeServer ConnectionType = "Server" | ||
// ConnectionTypeClient represents a client connection. | ||
ConnectionTypeClient ConnectionType = "Client" | ||
) | ||
|
||
// PingSpec defines the desired state of Ping. | ||
type PingSpec struct { | ||
// Enabled specifies whether the ping is enabled or not. | ||
// +kubebuilder:default=true | ||
Enabled bool `json:"enabled,omitempty"` | ||
// Endpoint specifies the endpoint to ping. | ||
Endpoint EndpointStatus `json:"endpoint,omitempty"` | ||
} | ||
|
||
// ConnectionSpec defines the desired state of Connection. | ||
type ConnectionSpec struct { | ||
// Type of the connection. | ||
// +kubebuilder:validation:Enum=Server;Client | ||
Type ConnectionType `json:"type"` | ||
// GatewayRef specifies the reference to the gateway. | ||
GatewayRef corev1.ObjectReference `json:"gatewayRef"` | ||
// Ping specifies the ping configuration. | ||
Ping PingSpec `json:"ping,omitempty"` | ||
} | ||
|
||
// ConnectionConditionType represents different conditions that a connection could assume. | ||
type ConnectionConditionType string | ||
|
||
const ( | ||
// ConnectionConditionEstablished represents a connection that is established. | ||
ConnectionConditionEstablished ConnectionConditionType = "Established" | ||
// ConnectionConditionPending represents a connection that is pending. | ||
ConnectionConditionPending ConnectionConditionType = "Pending" | ||
// ConnectionConditionDenied represents a connection that is denied. | ||
ConnectionConditionDenied ConnectionConditionType = "Denied" | ||
// ConnectionConditionError represents a connection that is in error. | ||
ConnectionConditionError ConnectionConditionType = "Error" | ||
) | ||
|
||
// ConnectionConditionStatusType represents the status of a connection condition. | ||
type ConnectionConditionStatusType string | ||
|
||
const ( | ||
// ConnectionConditionStatusTrue represents a connection condition that is true. | ||
ConnectionConditionStatusTrue ConnectionConditionStatusType = "True" | ||
// ConnectionConditionStatusFalse represents a connection condition that is false. | ||
ConnectionConditionStatusFalse ConnectionConditionStatusType = "False" | ||
// ConnectionConditionStatusUnknown represents a connection condition that is unknown. | ||
ConnectionConditionStatusUnknown ConnectionConditionStatusType = "Unknown" | ||
) | ||
|
||
// ConnectionCondition contains details about state of the connection. | ||
type ConnectionCondition struct { | ||
// Type of the connection condition. | ||
// +kubebuilder:validation:Enum="Established";"Pending";"Denied";"Error" | ||
Type ConnectionConditionType `json:"type"` | ||
// Status of the condition. | ||
// +kubebuilder:validation:Enum="True";"False";"Unknown" | ||
// +kubebuilder:default="Unknown" | ||
Status ConnectionConditionStatusType `json:"status"` | ||
// LastTransitionTime -> timestamp for when the condition last transitioned from one status to another. | ||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
// Reason -> Machine-readable, UpperCamelCase text indicating the reason for the condition's last transition. | ||
Reason string `json:"reason,omitempty"` | ||
// Message -> Human-readable message indicating details about the last status transition. | ||
Message string `json:"message,omitempty"` | ||
} | ||
|
||
// ConnectionStatus defines the observed state of Connection. | ||
type ConnectionStatus struct { | ||
// Conditions contains the conditions of the connection. | ||
Conditions []ConnectionCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:categories=liqo | ||
// +kubebuilder:subresource:status | ||
|
||
// Connection is the Schema for the connection API. | ||
type Connection struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ConnectionSpec `json:"spec,omitempty"` | ||
Status ConnectionStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ConnectionList contains a list of Connection. | ||
type ConnectionList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Connection `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Connection{}, &ConnectionList{}) | ||
} |
127 changes: 127 additions & 0 deletions
127
apis/networking/v1alpha1/firewallconfiguration_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,127 @@ | ||
// 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" | ||
) | ||
|
||
// 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. | ||
|
||
// FirewallConfigurationResource the name of the firewallconfiguration resources. | ||
var FirewallConfigurationResource = "firewallconfiguration" | ||
|
||
// FirewallConfigurationKind is the kind name used to register the FirewallConfiguration CRD. | ||
var FirewallConfigurationKind = "FirewallConfiguration" | ||
|
||
// FirewallConfigurationGroupResource is group resource used to register these objects. | ||
var FirewallConfigurationGroupResource = schema.GroupResource{Group: GroupVersion.Group, Resource: FirewallConfigurationResource} | ||
|
||
// FirewallConfigurationGroupVersionResource is groupResourceVersion used to register these objects. | ||
var FirewallConfigurationGroupVersionResource = GroupVersion.WithResource(FirewallConfigurationResource) | ||
|
||
// AddRemove contains the commands to add or remove rules. | ||
type AddRemove struct { | ||
// Add contains the commands to add rules. | ||
Add []string `json:"add,omitempty"` | ||
// Remove contains the commands to remove rules. | ||
Remove []string `json:"remove,omitempty"` | ||
} | ||
|
||
// FirewallConfigurationSpec defines the desired state of FirewallConfiguration. | ||
type FirewallConfigurationSpec struct { | ||
// Command to add or remove rules. | ||
Command AddRemove `json:"command,omitempty"` | ||
// ExpectedRule contains the expected rule. | ||
ExpectedRule string `json:"expectedRule,omitempty"` | ||
// Table contains the table where the rule is applied. | ||
Table string `json:"table,omitempty"` | ||
} | ||
|
||
// FirewallConfigurationConditionType represents different conditions that a firewallconfiguration could assume. | ||
type FirewallConfigurationConditionType string | ||
|
||
const ( | ||
// FirewallConfigurationConditionApplied represents the condition applied. | ||
FirewallConfigurationConditionApplied FirewallConfigurationConditionType = "Applied" | ||
// FirewallConfigurationConditionError represents the condition error. | ||
FirewallConfigurationConditionError FirewallConfigurationConditionType = "Error" | ||
// FirewallConfigurationConditionPending represents the condition pending. | ||
FirewallConfigurationConditionPending FirewallConfigurationConditionType = "Pending" | ||
) | ||
|
||
// FirewallConfigurationConditionStatusType represents the status of a firewallconfiguration condition. | ||
type FirewallConfigurationConditionStatusType string | ||
|
||
const ( | ||
// FirewallConfigurationConditionStatusTrue represents the condition status true. | ||
FirewallConfigurationConditionStatusTrue FirewallConfigurationConditionStatusType = "True" | ||
// FirewallConfigurationConditionStatusFalse represents the condition status false. | ||
FirewallConfigurationConditionStatusFalse FirewallConfigurationConditionStatusType = "False" | ||
// FirewallConfigurationConditionStatusUnknown represents the condition status unknown. | ||
FirewallConfigurationConditionStatusUnknown FirewallConfigurationConditionStatusType = "Unknown" | ||
) | ||
|
||
// FirewallConfigurationCondition contains details about state of the firewallconfiguration. | ||
type FirewallConfigurationCondition struct { | ||
// Type of the firewallconfiguration condition. | ||
// +kubebuilder:validation:Enum="Applied";"Error";"Pending" | ||
// +kubebuilder:default="Pending" | ||
Type FirewallConfigurationConditionType `json:"type"` | ||
// Status of the condition. | ||
// +kubebuilder:validation:Enum="True";"False";"Unknown" | ||
// +kubebuilder:default="Unknown" | ||
Status FirewallConfigurationConditionStatusType `json:"status"` | ||
// LastTransitionTime -> timestamp for when the condition last transitioned from one status to another. | ||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
// Reason -> Machine-readable, UpperCamelCase text indicating the reason for the condition's last transition. | ||
Reason string `json:"reason,omitempty"` | ||
// Message -> Human-readable message indicating details about the last status transition. | ||
Message string `json:"message,omitempty"` | ||
} | ||
|
||
// FirewallConfigurationStatus defines the observed state of FirewallConfiguration. | ||
type FirewallConfigurationStatus struct { | ||
// Conditions contains the conditions of the firewallconfiguration. | ||
Conditions []FirewallConfigurationCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:categories=liqo | ||
// +kubebuilder:subresource:status | ||
|
||
// FirewallConfiguration is the Schema for the firewallconfiguration API. | ||
type FirewallConfiguration struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec FirewallConfigurationSpec `json:"spec,omitempty"` | ||
Status FirewallConfigurationStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// FirewallConfigurationList contains a list of FirewallConfiguration. | ||
type FirewallConfigurationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []FirewallConfiguration `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&FirewallConfiguration{}, &FirewallConfigurationList{}) | ||
} |
Oops, something went wrong.