Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .golangci-kal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ linters:
description: Kube API LInter lints Kube like APIs based on API conventions and best practices.
settings:
linters:
enable:
- "commentstart"
# TODO: remove linters from this list as we add support from them
disable:
- "*"
- "ssatags"
- "nomaps"
- "integers"
- "conditions"
- "jsontags"
- "requiredfields"
- "optionalfields"
lintersConfig: { }
exclusions:
rules:
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha2/addressset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import (
// AddressSetSpec defines the desired state of AddressSet
type AddressSetSpec struct {
// ipv4 defines a list of IPv4 address strings
// +optional
IPv4 *[]string `json:"ipv4,omitempty"`
// ipv6 defines a list of IPv6 address strings
// +optional
IPv6 *[]string `json:"ipv6,omitempty"`
}

Expand All @@ -41,10 +43,13 @@ type AddressSetStatus struct {
type AddressSet struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// spec is the desired state of the AddressSet
// +optional
Spec AddressSetSpec `json:"spec,omitempty"`
// status is the observed state of the AddressSet
// +optional
Status AddressSetStatus `json:"status,omitempty"`
}

Expand Down
23 changes: 23 additions & 0 deletions api/v1alpha2/firewallrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,33 @@ import (
// FirewallRuleSpec defines the desired state of FirewallRule.
type FirewallRuleSpec struct {
// action is the action to take when the rule matches.
// +required
Action string `json:"action"`

// label is the label of the rule.
// +required
Label string `json:"label"`

// description is the description of the rule.
// +optional
Description string `json:"description,omitempty"`

// ports is the ports to apply the rule to.
// +optional
Ports string `json:"ports,omitempty"`

// protocol is the protocol to apply the rule to.
// +kubebuilder:validation:Enum=TCP;UDP;ICMP;IPENCAP
// +required
Protocol linodego.NetworkProtocol `json:"protocol"`

// addresses is a list of addresses to apply the rule to.
// +optional
Addresses *NetworkAddresses `json:"addresses,omitempty"`

// addressSetRefs is a list of references to AddressSets as an alternative to
// using Addresses but can be used in conjunction with it.
// +optional
AddressSetRefs []*corev1.ObjectReference `json:"addressSetRefs,omitempty"`
}

Expand All @@ -47,8 +60,11 @@ type FirewallRuleSpec struct {
// for linodego.NetworkAddresses
type NetworkAddresses struct {
// ipv4 defines a list of IPv4 address strings.
// +optional
IPv4 *[]string `json:"ipv4,omitempty"`

// ipv6 defines a list of IPv6 address strings.
// +optional
IPv6 *[]string `json:"ipv6,omitempty"`
}

Expand All @@ -66,11 +82,17 @@ type FirewallRuleStatus struct {
// FirewallRule is the Schema for the firewallrules API
type FirewallRule struct {
metav1.TypeMeta `json:",inline"`

// metadata is the standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

// spec is the desired state of the FirewallRule.
// +optional
Spec FirewallRuleSpec `json:"spec,omitempty"`

// status is the observed state of the FirewallRule.
// +optional
Status FirewallRuleStatus `json:"status,omitempty"`
}

Expand All @@ -80,6 +102,7 @@ type FirewallRule struct {
type FirewallRuleList struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard object's metadata.
// +optional
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing optional below for Items? But also, wouldn't Items for all the *List structs be required since we don't have omitempty?

metav1.ListMeta `json:"metadata,omitempty"`
// items is a list of FirewallRule.
Items []FirewallRule `json:"items"`
Expand Down
24 changes: 23 additions & 1 deletion api/v1alpha2/linodecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
// LinodeClusterSpec defines the desired state of LinodeCluster
type LinodeClusterSpec struct {
// region the LinodeCluster lives in.
// +required
Region string `json:"region"`

// controlPlaneEndpoint represents the endpoint used to communicate with the LinodeCluster control plane
Expand Down Expand Up @@ -102,11 +103,17 @@ type LinodeClusterStatus struct {
// LinodeCluster is the Schema for the linodeclusters API
type LinodeCluster struct {
metav1.TypeMeta `json:",inline"`

// metadata is the standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

// spec is the desired state of the LinodeCluster.
// +optional
Spec LinodeClusterSpec `json:"spec,omitempty"`

// status is the observed state of the LinodeCluster.
// +optional
Status LinodeClusterStatus `json:"status,omitempty"`
}

Expand Down Expand Up @@ -139,56 +146,69 @@ type NetworkSpec struct {
// +kubebuilder:default=NodeBalancer
// +optional
LoadBalancerType string `json:"loadBalancerType,omitempty"`

// dnsProvider is the provider who manages the domain.
// Ignored if the LoadBalancerType is set to anything other than dns
// If not set, defaults linode dns
// +kubebuilder:validation:Enum=linode;akamai
// +optional
DNSProvider string `json:"dnsProvider,omitempty"`

// dnsRootDomain is the root domain used to create a DNS entry for the control-plane endpoint.
// Ignored if the LoadBalancerType is set to anything other than dns
// +optional
DNSRootDomain string `json:"dnsRootDomain,omitempty"`

// dnsUniqueIdentifier is the unique identifier for the DNS. This let clusters with the same name have unique
// DNS record
// Ignored if the LoadBalancerType is set to anything other than dns
// If not set, CAPL will create a unique identifier for you
// +optional
DNSUniqueIdentifier string `json:"dnsUniqueIdentifier,omitempty"`

// dnsTTLsec is the TTL for the domain record
// Ignored if the LoadBalancerType is set to anything other than dns
// If not set, defaults to 30
// +optional
DNSTTLSec int `json:"dnsTTLsec,omitempty"`

// dnsSubDomainOverride is used to override CAPL's construction of the controlplane endpoint
// If set, this will override the DNS subdomain from <clustername>-<uniqueid>.<rootdomain> to <overridevalue>.<rootdomain>
// +optional
DNSSubDomainOverride string `json:"dnsSubDomainOverride,omitempty"`

// apiserverLoadBalancerPort used by the api server. It must be valid ports range (1-65535).
// If omitted, default value is 6443.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// +optional
ApiserverLoadBalancerPort int `json:"apiserverLoadBalancerPort,omitempty"`

// nodeBalancerID is the id of NodeBalancer.
// +optional
NodeBalancerID *int `json:"nodeBalancerID,omitempty"`

// nodeBalancerFirewallID is the id of NodeBalancer Firewall.
// +optional
NodeBalancerFirewallID *int `json:"nodeBalancerFirewallID,omitempty"`

// apiserverNodeBalancerConfigID is the config ID of api server NodeBalancer config.
// +optional
ApiserverNodeBalancerConfigID *int `json:"apiserverNodeBalancerConfigID,omitempty"`

// additionalPorts contains list of ports to be configured with NodeBalancer.
// +optional
AdditionalPorts []LinodeNBPortConfig `json:"additionalPorts,omitempty"`

// subnetName is the name/label of the VPC subnet to be used by the cluster
// +optional
SubnetName string `json:"subnetName,omitempty"`

// useVlan provisions a cluster that uses VLANs instead of VPCs. IPAM is managed internally.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
// +optional
UseVlan bool `json:"useVlan,omitempty"`

// nodeBalancerBackendIPv4Range is the subnet range we want to provide for creating nodebalancer in VPC.
// example: 10.10.10.0/30
// +optional
Expand All @@ -209,7 +229,9 @@ type LinodeNBPortConfig struct {
// port configured on the NodeBalancer. It must be valid port range (1-65535).
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// +required
Port int `json:"port"`

// nodeBalancerConfigID is the config ID of port's NodeBalancer config.
// +optional
NodeBalancerConfigID *int `json:"nodeBalancerConfigID,omitempty"`
Expand All @@ -222,11 +244,11 @@ type ObjectStore struct {
//
// This is used to generate presigned URLs for S3 Bucket objects, which are used by
// control-plane and worker nodes to fetch bootstrap data.
//
// +optional
PresignedURLDuration *metav1.Duration `json:"presignedURLDuration,omitempty"`

// credentialsRef is a reference to a Secret that contains the credentials to use for accessing the Cluster Object Store.
// +optional
CredentialsRef corev1.SecretReference `json:"credentialsRef,omitempty"`
}

Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha2/linodeclustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ import (
// LinodeClusterTemplateSpec defines the desired state of LinodeClusterTemplate
type LinodeClusterTemplateSpec struct {
// template defines the specification for a LinodeCluster.
// +required
Template LinodeClusterTemplateResource `json:"template"`
}

// LinodeClusterTemplateResource describes the data needed to create a LinodeCluster from a template.
type LinodeClusterTemplateResource struct {
// spec is the specification of the LinodeCluster.
// +required
Spec LinodeClusterSpec `json:"spec"`
}

Expand All @@ -40,8 +42,11 @@ type LinodeClusterTemplateResource struct {
type LinodeClusterTemplate struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

// spec is the desired state of the LinodeClusterTemplate.
// +optional
Spec LinodeClusterTemplateSpec `json:"spec,omitempty"`
}

Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha2/linodefirewall_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,15 @@ type LinodeFirewallStatus struct {
type LinodeFirewall struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

// spec is the desired state of the LinodeFirewall.
// +optional
Spec LinodeFirewallSpec `json:"spec,omitempty"`

// status is the observed state of the LinodeFirewall.
// +optional
Status LinodeFirewallStatus `json:"status,omitempty"`
}

Expand Down
Loading
Loading