Skip to content
Draft
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
23 changes: 20 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ linters:
settings:
linters:
disable:
- optionalfields
# NOTE: conflicts with the lack of validation in the Status structs
- arrayofstruct
enable:
- commentstart
- conditions
- defaults
- duplicatemarkers
- integers
- jsontags
Expand All @@ -48,6 +50,7 @@ linters:
- nodurations
- nofloats
- nomaps
- nonpointerstructs
- nonullable
- notimestamp
- nophase
Expand All @@ -62,11 +65,14 @@ linters:
isFirstField: Warn
usePatchStrategy: Ignore
useProtobuf: Forbid
defaults:
# Let's use `+kubebuilder:default` until elastic/crd-ref-docs supports `+default`
preferredDefaultMarker: "kubebuilder:default"
requiredfields:
omitempty:
policy: Ignore
exclusions:
generated: lax
generated: disable
rules:
- linters:
- lll
Expand All @@ -75,13 +81,22 @@ linters:
- dupl
- lll
path: internal/*
- linters:
- dupl
- goimports
- unparam
path: zz_generated
- linters:
- kubeapilinter
path-except: api/*
path-except: ^api/*
paths:
- third_party$
- builtin$
- examples$
- applyconfiguration/*
- clientset/*
- informers/*
- listers/*
formatters:
enable:
- gofmt
Expand All @@ -92,3 +107,5 @@ formatters:
- third_party$
- builtin$
- examples$
issues:
exclude-generated: disable
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ KUSTOMIZE_VERSION ?= v5.6.0
CONTROLLER_TOOLS_VERSION ?= v0.17.1
ENVTEST_VERSION ?= release-0.22
GOLANGCI_LINT_VERSION ?= v2.7.2
KAL_VERSION ?= v0.0.0-20250924094418-502783c08f9d
KAL_VERSION ?= v0.0.0-20260114104534-18147eee9c49
MOCKGEN_VERSION ?= v0.5.0
KUTTL_VERSION ?= v0.24.0
GOVULNCHECK_VERSION ?= v1.1.4
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha1/controller_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ type ManagedOptions struct {
// default is `delete`.
// +kubebuilder:default:=delete
// +optional
OnDelete OnDelete `json:"onDelete,omitempty"`
OnDelete *OnDelete `json:"onDelete,omitempty"`
}

// GetOnDelete returns the delete behaviour from ManagedOptions. If called on a
// nil receiver it safely returns the default.
func (o *ManagedOptions) GetOnDelete() OnDelete {
if o == nil {
if o == nil || o.OnDelete == nil {
return OnDeleteDelete
}
return o.OnDelete
return *o.OnDelete
}
4 changes: 2 additions & 2 deletions api/v1alpha1/domain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ type DomainResourceStatus struct {
// name is a Human-readable name for the resource. Might not be unique.
// +kubebuilder:validation:MaxLength=1024
// +optional
Name string `json:"name,omitempty"`
Name *string `json:"name,omitempty"`

// description is a human-readable description for the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// enabled defines whether a domain is enabled or not. Default is true.
// Note: Users can only authorize against an enabled domain (and any of its projects).
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha1/flavor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type FlavorResourceSpec struct {
// MiB. If 0 (the default), no dedicated swap disk will be created.
// +kubebuilder:validation:Minimum=0
// +optional
Swap int32 `json:"swap,omitempty"`
Swap *int32 `json:"swap,omitempty"`

// isPublic flags a flavor as being available to all projects or not.
// +optional
Expand All @@ -68,7 +68,7 @@ type FlavorResourceSpec struct {
// limitations. Defaults to 0.
// +kubebuilder:validation:Minimum=0
// +optional
Ephemeral int32 `json:"ephemeral,omitempty"`
Ephemeral *int32 `json:"ephemeral,omitempty"`
}

// FlavorFilter defines an existing resource by its properties
Expand Down Expand Up @@ -99,12 +99,12 @@ type FlavorResourceStatus struct {
// name is a Human-readable name for the flavor. Might not be unique.
// +kubebuilder:validation:MaxLength=1024
// +optional
Name string `json:"name,omitempty"`
Name *string `json:"name,omitempty"`

// description is a human-readable description for the resource.
// +kubebuilder:validation:MaxLength:=65535
// +optional
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// ram is the memory of the flavor, measured in MB.
// +optional
Expand Down
20 changes: 10 additions & 10 deletions api/v1alpha1/floatingip_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type FloatingIPFilter struct {
// status is the status of the floatingip.
// +kubebuilder:validation:MaxLength=1024
// +optional
Status string `json:"status,omitempty"`
Status *string `json:"status,omitempty"`

FilterByNeutronTags `json:",inline"`
}
Expand Down Expand Up @@ -98,47 +98,47 @@ type FloatingIPResourceStatus struct {
// description is a human-readable description for the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// floatingNetworkID is the ID of the network to which the floatingip is associated.
// +kubebuilder:validation:MaxLength=1024
// +optional
FloatingNetworkID string `json:"floatingNetworkID,omitempty"`
FloatingNetworkID *string `json:"floatingNetworkID,omitempty"`

// floatingIP is the IP address of the floatingip.
// +kubebuilder:validation:MaxLength=1024
// +optional
FloatingIP string `json:"floatingIP,omitempty"`
FloatingIP *string `json:"floatingIP,omitempty"`

// portID is the ID of the port to which the floatingip is associated.
// +kubebuilder:validation:MaxLength=1024
// +optional
PortID string `json:"portID,omitempty"`
PortID *string `json:"portID,omitempty"`

// fixedIP is the IP address of the port to which the floatingip is associated.
// +kubebuilder:validation:MaxLength=1024
// +optional
FixedIP string `json:"fixedIP,omitempty"`
FixedIP *string `json:"fixedIP,omitempty"`

// tenantID is the project owner of the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
TenantID string `json:"tenantID,omitempty"`
TenantID *string `json:"tenantID,omitempty"`

// projectID is the project owner of the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
ProjectID string `json:"projectID,omitempty"`
ProjectID *string `json:"projectID,omitempty"`

// status indicates the current status of the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
Status string `json:"status,omitempty"`
Status *string `json:"status,omitempty"`

// routerID is the ID of the router to which the floatingip is associated.
// +kubebuilder:validation:MaxLength=1024
// +optional
RouterID string `json:"routerID,omitempty"`
RouterID *string `json:"routerID,omitempty"`

// tags is the list of tags on the resource.
// +kubebuilder:validation:MaxItems:=64
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha1/group_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ type GroupResourceStatus struct {
// name is a Human-readable name for the resource. Might not be unique.
// +kubebuilder:validation:MaxLength=1024
// +optional
Name string `json:"name,omitempty"`
Name *string `json:"name,omitempty"`

// description is a human-readable description for the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// domainID is the ID of the Domain to which the resource is associated.
// +kubebuilder:validation:MaxLength=1024
// +optional
DomainID string `json:"domainID,omitempty"`
DomainID *string `json:"domainID,omitempty"`
}
13 changes: 6 additions & 7 deletions api/v1alpha1/image_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ type ImageContent struct {
// Permitted values are ami, ari, aki, bare, compressed, ovf, ova, and docker.
// +kubebuilder:default:=bare
// +optional
ContainerFormat ImageContainerFormat `json:"containerFormat,omitempty"`
ContainerFormat *ImageContainerFormat `json:"containerFormat,omitempty"`

// diskFormat is the format of the disk image.
// Normal values are "qcow2", or "raw". Glance may be configured to support others.
Expand All @@ -267,8 +267,7 @@ type ImageContent struct {
// download describes how to obtain image data by downloading it from a URL.
// Must be set when creating a managed image.
// +required
//nolint:kubeapilinter
Download *ImageContentSourceDownload `json:"download"`
Download *ImageContentSourceDownload `json:"download,omitempty"`
}

type ImageContentSourceDownload struct {
Expand Down Expand Up @@ -364,21 +363,21 @@ type ImageResourceStatus struct {
// name is a Human-readable name for the image. Might not be unique.
// +kubebuilder:validation:MaxLength=1024
// +optional
Name string `json:"name,omitempty"`
Name *string `json:"name,omitempty"`

// status is the image status as reported by Glance
// +kubebuilder:validation:MaxLength=1024
// +optional
Status string `json:"status,omitempty"`
Status *string `json:"status,omitempty"`

// protected specifies that the image is protected from deletion.
// +optional
Protected bool `json:"protected,omitempty"`
Protected *bool `json:"protected,omitempty"`

// visibility of the image
// +kubebuilder:validation:MaxLength=1024
// +optional
Visibility string `json:"visibility,omitempty"`
Visibility *string `json:"visibility,omitempty"`

// hash is the hash of the image data published by Glance. Note that this is
// a hash of the data stored internally by Glance, which will have been
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha1/keypair_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ type KeyPairResourceStatus struct {
// name is a Human-readable name for the resource. Might not be unique.
// +kubebuilder:validation:MaxLength=1024
// +optional
Name string `json:"name,omitempty"`
Name *string `json:"name,omitempty"`

// fingerprint is the fingerprint of the public key
// +kubebuilder:validation:MaxLength=1024
// +optional
Fingerprint string `json:"fingerprint,omitempty"`
Fingerprint *string `json:"fingerprint,omitempty"`

// publicKey is the public key of the Keypair
// +kubebuilder:validation:MaxLength=16384
// +optional
PublicKey string `json:"publicKey,omitempty"`
PublicKey *string `json:"publicKey,omitempty"`

// type is the type of the Keypair (ssh or x509)
// +kubebuilder:validation:MaxLength=64
// +optional
Type string `json:"type,omitempty"`
Type *string `json:"type,omitempty"`
}
16 changes: 8 additions & 8 deletions api/v1alpha1/network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ProviderPropertiesStatus struct {
// Valid values depend on the networking back-end.
// +kubebuilder:validation:MaxLength=1024
// +optional
NetworkType string `json:"networkType,omitempty"`
NetworkType *string `json:"networkType,omitempty"`

// physicalNetwork is the physical network where this network
// should be implemented. The Networking API v2.0 does not provide a
Expand All @@ -31,7 +31,7 @@ type ProviderPropertiesStatus struct {
// to specific bridges on each compute host.
// +kubebuilder:validation:MaxLength=1024
// +optional
PhysicalNetwork string `json:"physicalNetwork,omitempty"`
PhysicalNetwork *string `json:"physicalNetwork,omitempty"`

// segmentationID is the ID of the isolated segment on the
// physical network. The network_type attribute defines the
Expand Down Expand Up @@ -146,24 +146,24 @@ type NetworkResourceStatus struct {
// name is a Human-readable name for the network. Might not be unique.
// +kubebuilder:validation:MaxLength=1024
// +optional
Name string `json:"name,omitempty"`
Name *string `json:"name,omitempty"`

// description is a human-readable description for the resource.
// +kubebuilder:validation:MaxLength=1024
// +optional
Description string `json:"description,omitempty"`
Description *string `json:"description,omitempty"`

// projectID is the project owner of the network.
// +kubebuilder:validation:MaxLength=1024
// +optional
ProjectID string `json:"projectID,omitempty"`
ProjectID *string `json:"projectID,omitempty"`

// status indicates whether network is currently operational. Possible values
// include `ACTIVE', `DOWN', `BUILD', or `ERROR'. Plug-ins might define
// additional values.
// +kubebuilder:validation:MaxLength=1024
// +optional
Status string `json:"status,omitempty"`
Status *string `json:"status,omitempty"`

// tags is the list of tags on the resource.
// +kubebuilder:validation:MaxItems=64
Expand All @@ -177,7 +177,7 @@ type NetworkResourceStatus struct {
// adminStateUp is the administrative state of the network,
// which is up (true) or down (false).
// +optional
AdminStateUp *bool `json:"adminStateUp"`
AdminStateUp *bool `json:"adminStateUp,omitempty"`

// availabilityZoneHints is the availability zone candidate for the
// network.
Expand All @@ -190,7 +190,7 @@ type NetworkResourceStatus struct {
// dnsDomain is the DNS domain of the network
// +kubebuilder:validation:MaxLength=1024
// +optional
DNSDomain string `json:"dnsDomain,omitempty"`
DNSDomain *string `json:"dnsDomain,omitempty"`

// mtu is the the maximum transmission unit value to address
// fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
Expand Down
Loading
Loading