|
| 1 | +/* |
| 2 | +Copyright 2023 Akamai Technologies, Inc. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha2 |
| 18 | + |
| 19 | +import ( |
| 20 | + "github.com/linode/linodego" |
| 21 | + corev1 "k8s.io/api/core/v1" |
| 22 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 23 | +) |
| 24 | + |
| 25 | +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! |
| 26 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 27 | + |
| 28 | +// FirewallRuleSpec defines the desired state of FirewallRule |
| 29 | +type FirewallRuleSpec struct { |
| 30 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 31 | + // Important: Run "make" to regenerate code after modifying this file |
| 32 | + Action string `json:"action"` |
| 33 | + Label string `json:"label"` |
| 34 | + Description string `json:"description,omitempty"` |
| 35 | + Ports string `json:"ports,omitempty"` |
| 36 | + // +kubebuilder:validation:Enum=TCP;UDP;ICMP;IPENCAP |
| 37 | + Protocol linodego.NetworkProtocol `json:"protocol"` |
| 38 | + Addresses *NetworkAddresses `json:"addresses,omitempty"` |
| 39 | + // AddressSetRefs is a list of references to AddressSets as an alternative to |
| 40 | + // using Addresses but can be used in conjunction with it |
| 41 | + AddressSetRefs []*corev1.ObjectReference `json:"addressSetRefs,omitempty"` |
| 42 | +} |
| 43 | + |
| 44 | +// NetworkAddresses holds a list of IPv4 and IPv6 addresses |
| 45 | +// We don't use linodego here since kubebuilder can't generate DeepCopyInto |
| 46 | +// for linodego.NetworkAddresses |
| 47 | +type NetworkAddresses struct { |
| 48 | + IPv4 *[]string `json:"ipv4,omitempty"` |
| 49 | + IPv6 *[]string `json:"ipv6,omitempty"` |
| 50 | +} |
| 51 | + |
| 52 | +// FirewallRuleStatus defines the observed state of FirewallRule |
| 53 | +type FirewallRuleStatus struct { |
| 54 | + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
| 55 | + // Important: Run "make" to regenerate code after modifying this file |
| 56 | +} |
| 57 | + |
| 58 | +//+kubebuilder:object:root=true |
| 59 | +//+kubebuilder:resource:path=firewallrules,scope=Namespaced,categories=cluster-api,shortName=fwr |
| 60 | +//+kubebuilder:subresource:status |
| 61 | +// +kubebuilder:metadata:labels="clusterctl.cluster.x-k8s.io/move-hierarchy=true" |
| 62 | + |
| 63 | +// FirewallRule is the Schema for the firewallrules API |
| 64 | +type FirewallRule struct { |
| 65 | + metav1.TypeMeta `json:",inline"` |
| 66 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 67 | + |
| 68 | + Spec FirewallRuleSpec `json:"spec,omitempty"` |
| 69 | + Status FirewallRuleStatus `json:"status,omitempty"` |
| 70 | +} |
| 71 | + |
| 72 | +//+kubebuilder:object:root=true |
| 73 | + |
| 74 | +// FirewallRuleList contains a list of FirewallRule |
| 75 | +type FirewallRuleList struct { |
| 76 | + metav1.TypeMeta `json:",inline"` |
| 77 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 78 | + Items []FirewallRule `json:"items"` |
| 79 | +} |
| 80 | + |
| 81 | +func init() { |
| 82 | + SchemeBuilder.Register(&FirewallRule{}, &FirewallRuleList{}) |
| 83 | +} |
0 commit comments