Skip to content
Open
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
38 changes: 21 additions & 17 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ linters:
alias: runtimeserializer
- pkg: k8s.io/apimachinery/pkg/runtime/serializer/yaml
alias: yamlserializer
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
alias: clusterv1
- pkg: sigs.k8s.io/cluster-api/util/defaulting
alias: utildefaulting
- pkg: sigs.k8s.io/controller-runtime
Expand Down Expand Up @@ -169,8 +167,14 @@ linters:
alias: crclient
- pkg: k8s.io/apimachinery/pkg/types
alias: apimachinerytypes
- pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1
alias: expclusterv1
- pkg: "sigs.k8s.io/cluster-api/api/core/v1beta2"
alias: clusterv1
- pkg: "sigs.k8s.io/cluster-api/api/core/v1beta1"
alias: clusterv1beta1
- pkg: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch"
alias: v1beta1patch
- pkg: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
alias: v1beta1conditions
no-unaliased: false
nolintlint:
require-specific: true
Expand Down Expand Up @@ -212,16 +216,16 @@ linters:
# - errcheck
# text: Error return value of `outputPrinter.Print` is not checked
- linters:
- gosec
text: 'G103: Use of unsafe calls should be audited'
- gosec
text: "G103: Use of unsafe calls should be audited"
path: .*(api|types|test)\/.*\/.*conversion.*\.go$
- linters:
- staticcheck
text: 'QF1008: could remove embedded field .*'
text: "QF1008: could remove embedded field .*"
# TODO: change to use time.Time.Equal
- linters:
- staticcheck
text: 'QF1009: probably want to use time.Time.Equal instead'
text: "QF1009: probably want to use time.Time.Equal instead"
- linters:
- revive
# Ignoring stylistic checks for generated code
Expand All @@ -233,13 +237,13 @@ linters:
# Ignoring stylistic checks for generated code
path: .*(api|types)\/.*\/.*conversion.*\.go$
# By convention, receiver names in a method should reflect their identity.
text: 'receiver-naming: receiver name (.+) should be consistent with previous receiver name (.+)'
text: "receiver-naming: receiver name (.+) should be consistent with previous receiver name (.+)"
- linters:
- revive
# Ignoring stylistic checks for generated code
path: .*(api|types|test)\/.*\/.*conversion.*\.go$
# Checking if an error is nil to just after return the error or nil is redundant
text: 'if-return: redundant if ...; err != nil check, just return error instead'
text: "if-return: redundant if ...; err != nil check, just return error instead"
- linters:
- revive
text: 'exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
Expand Down Expand Up @@ -268,7 +272,7 @@ linters:
text: Error return value of (.+) is not checked
- linters:
- gosec
text: 'G108: Profiling endpoint is automatically exposed on /debug/pprof'
text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
- linters:
- godot
path: (.*)/(v1beta1|v1beta2)/(.*)types.go
Expand All @@ -282,17 +286,17 @@ linters:
- linters:
- revive
path: .*/defaults.go
text: 'var-naming: don''t use underscores in Go names; func (.+) should be (.+)'
text: "var-naming: don't use underscores in Go names; func (.+) should be (.+)"
- linters:
- revive
path: .*/.*(mock|gc_).*/.+\.go
text: 'var-naming: don''t use an underscore in package name'
text: "var-naming: don't use an underscore in package name"
- linters:
- revive
# Ignoring stylistic checks for generated code
path: .*(api|types|test)\/.*\/.*conversion.*\.go$
# This rule warns when initialism, variable or package naming conventions are not followed.
text: 'var-naming: don''t use underscores in Go names'
text: "var-naming: don't use underscores in Go names"
- linters:
- unparam
text: always receives
Expand All @@ -309,15 +313,15 @@ linters:
text: cyclomatic complexity
- linters:
- gocritic
text: 'appendAssign: append result not assigned to the same slice'
text: "appendAssign: append result not assigned to the same slice"
- path: (.+)\.go$
text: (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
- path: (.+)\.go$
text: 'exported: (func|type) name will be used as (.+) by other packages, and that stutters; consider calling this (.+)'
text: "exported: (func|type) name will be used as (.+) by other packages, and that stutters; consider calling this (.+)"
- path: (.+)\.go$
text: (G104|G107|G404|G505|ST1000)
- path: (.+)\.go$
text: 'G108: Profiling endpoint is automatically exposed on /debug/pprof'
text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
- path: (.+)\.go$
text: net/http.Get must not be called
- linters:
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ endif
.PHONY: defaulters
defaulters: $(DEFAULTER_GEN) ## Generate all Go types
$(DEFAULTER_GEN) \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/core/v1beta2 \
--v=0 \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
--output-file=zz_generated.defaults.go \
Expand Down Expand Up @@ -262,36 +262,36 @@ generate-go-apis: ## Alias for .build/generate-go-apis
$(MAKE) defaulters

$(CONVERSION_GEN) \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/core/v1beta2 \
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
./api/v1beta1 \
./cmd/clusterawsadm/api/bootstrap/v1alpha1

$(CONVERSION_GEN) \
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/core/v1beta2 \
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
./$(EXP_DIR)/api/v1beta1

$(CONVERSION_GEN) \
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/core/v1beta2 \
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
./bootstrap/eks/api/v1beta1

$(CONVERSION_GEN) \
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/core/v1beta2 \
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
./controlplane/eks/api/v1beta1

$(CONVERSION_GEN) \
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/core/v1beta2 \
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
./controlplane/rosa/api/v1beta2
Expand Down
20 changes: 10 additions & 10 deletions api/v1beta1/awscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint:staticcheck
)

const (
Expand All @@ -45,7 +45,7 @@ type AWSClusterSpec struct {

// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`

// AdditionalTags is an optional set of tags to add to AWS resources managed by the AWS provider, in addition to the
// ones added by default.
Expand Down Expand Up @@ -200,11 +200,11 @@ type AWSLoadBalancerSpec struct {
// AWSClusterStatus defines the observed state of AWSCluster.
type AWSClusterStatus struct {
// +kubebuilder:default=false
Ready bool `json:"ready"`
Network NetworkStatus `json:"networkStatus,omitempty"`
FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`
Bastion *Instance `json:"bastion,omitempty"`
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Ready bool `json:"ready"`
Network NetworkStatus `json:"networkStatus,omitempty"`
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
Bastion *Instance `json:"bastion,omitempty"`
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
}

// S3Bucket defines a supporting S3 bucket for the cluster, currently can be optionally used for Ignition.
Expand Down Expand Up @@ -254,12 +254,12 @@ type AWSClusterList struct {
}

// GetConditions returns the observations of the operational state of the AWSCluster resource.
func (r *AWSCluster) GetConditions() clusterv1.Conditions {
func (r *AWSCluster) GetConditions() clusterv1beta1.Conditions {
return r.Status.Conditions
}

// SetConditions sets the underlying service state of the AWSCluster to the predescribed clusterv1.Conditions.
func (r *AWSCluster) SetConditions(conditions clusterv1.Conditions) {
// SetConditions sets the underlying service state of the AWSCluster to the predescribed clusterv1beta1.Conditions.
func (r *AWSCluster) SetConditions(conditions clusterv1beta1.Conditions) {
r.Status.Conditions = conditions
}

Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/awsclustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint:staticcheck
)

// AWSClusterTemplateSpec defines the desired state of AWSClusterTemplate.
Expand Down Expand Up @@ -58,6 +58,6 @@ type AWSClusterTemplateResource struct {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"`
Spec AWSClusterSpec `json:"spec"`
ObjectMeta clusterv1beta1.ObjectMeta `json:"metadata,omitempty"`
Spec AWSClusterSpec `json:"spec"`
}
12 changes: 6 additions & 6 deletions api/v1beta1/awsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint:staticcheck
)

const (
Expand Down Expand Up @@ -207,7 +207,7 @@ type AWSMachineStatus struct {
Interruptible bool `json:"interruptible,omitempty"`

// Addresses contains the AWS instance associated addresses.
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
Addresses []clusterv1beta1.MachineAddress `json:"addresses,omitempty"`

// InstanceState is the state of the AWS instance for this machine.
// +optional
Expand Down Expand Up @@ -253,7 +253,7 @@ type AWSMachineStatus struct {

// Conditions defines current service state of the AWSMachine.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -276,12 +276,12 @@ type AWSMachine struct {
}

// GetConditions returns the observations of the operational state of the AWSMachine resource.
func (r *AWSMachine) GetConditions() clusterv1.Conditions {
func (r *AWSMachine) GetConditions() clusterv1beta1.Conditions {
return r.Status.Conditions
}

// SetConditions sets the underlying service state of the AWSMachine to the predescribed clusterv1.Conditions.
func (r *AWSMachine) SetConditions(conditions clusterv1.Conditions) {
// SetConditions sets the underlying service state of the AWSMachine to the predescribed clusterv1beta1.Conditions.
func (r *AWSMachine) SetConditions(conditions clusterv1beta1.Conditions) {
r.Status.Conditions = conditions
}

Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/awsmachinetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint:staticcheck
)

// AWSMachineTemplateStatus defines a status for an AWSMachineTemplate.
Expand Down Expand Up @@ -65,7 +65,7 @@ type AWSMachineTemplateResource struct {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"`
ObjectMeta clusterv1beta1.ObjectMeta `json:"metadata,omitempty"`

// Spec is the specification of the desired behavior of the machine.
Spec AWSMachineSpec `json:"spec"`
Expand Down
Loading