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
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.23.7
1.23.11
12 changes: 10 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ linters-settings:
- pkg: github.com/smartxworks/cluster-api-provider-elf/api/v1beta1
alias: infrav1
staticcheck:
go: "1.22"
go: "1.23"
stylecheck:
go: "1.22"
go: "1.23"
issues:
max-same-issues: 0
max-issues-per-linter: 0
Expand Down Expand Up @@ -167,6 +167,14 @@ issues:
text: should not use dot imports
- path: _test\.go
text: cyclomatic complexity
# Deprecations for FailureReason
- linters:
- staticcheck
text: "SA1019: \"sigs.k8s.io/cluster-api/errors\" is deprecated:"
# Deprecations for FailureMessage, FailureReason, UnavailableReplicas
- linters:
- staticcheck
text: "SA1019: .*\\.Status\\.(FailureMessage|FailureReason|UnavailableReplicas) is deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details."

run:
timeout: 10m
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ARG ARCH

# Build the manager binary
FROM golang:1.23.7 as builder
FROM golang:1.23.11 as builder
WORKDIR /workspace

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VERSION ?= $(shell cat clusterctl-settings.json | jq .config.nextVersion -r)
#
# Go.
#
GO_VERSION ?= 1.23.7
GO_VERSION ?= 1.23.11

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -155,19 +155,19 @@ kustomize: ## Download kustomize locally if necessary.

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5)

GINKGO := $(shell pwd)/bin/ginkgo
ginkgo: ## Download ginkgo locally if necessary.
$(call go-get-tool,$(GINKGO),github.com/onsi/ginkgo/v2/ginkgo@v2.23.0)
$(call go-get-tool,$(GINKGO),github.com/onsi/ginkgo/v2/ginkgo@2.23.4)

KIND := $(shell pwd)/bin/kind
kind: ## Download kind locally if necessary.
$(call go-get-tool,$(KIND),sigs.k8s.io/kind@v0.24.0)
$(call go-get-tool,$(KIND),sigs.k8s.io/kind@v0.25.0)

GOLANGCI_LINT := $(shell pwd)/bin/golangci-lint
golangci-lint: ## Download golangci-lint locally if necessary.
$(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/[email protected].6)
$(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/[email protected].8)

## --------------------------------------
## Linting and fixing linter errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.5
name: elfclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -138,20 +138,20 @@ spec:
description: |-
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may not be empty.
This field may be empty.
type: string
severity:
description: |-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
description: status of the condition, one of True, False, Unknown.
type: string
type:
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.5
name: elfmachines.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -267,6 +267,8 @@ spec:
description: Type is the type name of a virtual GPU, e.g. 'NVIDIA
A16-16A'.
type: string
required:
- type
type: object
type: array
required:
Expand Down Expand Up @@ -315,20 +317,20 @@ spec:
description: |-
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may not be empty.
This field may be empty.
type: string
severity:
description: |-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
description: status of the condition, one of True, False, Unknown.
type: string
type:
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
type: string
Expand All @@ -344,7 +346,6 @@ spec:
reconciling the Machine and will contain a more verbose string suitable
for logging and human consumption.


This field should not be set for transitive errors that a controller
faces that are expected to be fixed automatically over
time (like service outages), but instead indicate that something is
Expand All @@ -354,7 +355,6 @@ spec:
spec, values that are unsupported by the controller, or the
responsible controller itself being critically misconfigured.


Any transient errors that occur during the reconciliation of Machines
can be added as events to the Machine object and/or logged in the
controller's output.
Expand All @@ -365,7 +365,6 @@ spec:
reconciling the Machine and will contain a succinct value suitable
for machine interpretation.


This field should not be set for transitive errors that a controller
faces that are expected to be fixed automatically over
time (like service outages), but instead indicate that something is
Expand All @@ -375,7 +374,6 @@ spec:
spec, values that are unsupported by the controller, or the
responsible controller itself being critically misconfigured.


Any transient errors that occur during the reconciliation of Machines
can be added as events to the Machine object and/or logged in the
controller's output.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.5
name: elfmachinetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -254,6 +254,8 @@ spec:
description: Type is the type name of a virtual GPU,
e.g. 'NVIDIA A16-16A'.
type: string
required:
- type
type: object
type: array
required:
Expand Down
57 changes: 13 additions & 44 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,20 @@ rules:
- update
- watch
- apiGroups:
- cluster.x-k8s.io
resources:
- clusters
- clusters/status
verbs:
- get
- list
- watch
- apiGroups:
- cluster.x-k8s.io
- ""
resources:
- machinedeployments
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cluster.x-k8s.io
resources:
- machinedeployments
- clusters
- clusters/status
- machinedeployments/status
verbs:
- get
Expand All @@ -48,17 +38,7 @@ rules:
- apiGroups:
- cluster.x-k8s.io
resources:
- machines
- machines/status
verbs:
- get
- list
- patch
- watch
- apiGroups:
- controlplane.cluster.x-k8s.io
resources:
- '*'
- machinedeployments
verbs:
- create
- delete
Expand All @@ -68,19 +48,19 @@ rules:
- update
- watch
- apiGroups:
- ""
- cluster.x-k8s.io
resources:
- secrets
- machines
- machines/status
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- infrastructure.cluster.x-k8s.io
- controlplane.cluster.x-k8s.io
resources:
- elfclusters
- '*'
verbs:
- create
- delete
Expand All @@ -92,20 +72,7 @@ rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- elfclusters/finalizers
verbs:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- elfclusters/status
verbs:
- get
- patch
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- elfclusters
- elfmachines
verbs:
- create
Expand All @@ -118,12 +85,14 @@ rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- elfclusters/finalizers
- elfmachines/finalizers
verbs:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
resources:
- elfclusters/status
- elfmachines/status
verbs:
- get
Expand Down
3 changes: 2 additions & 1 deletion controllers/elfcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func AddClusterControllerToManager(ctx goctx.Context, ctrlMgrCtx *context.Contro
ControllerManagerContext: ctrlMgrCtx,
NewVMService: service.NewVMService,
}
predicateLog := ctrl.LoggerFrom(ctx).WithValues("controller", "elfcluster")

return ctrl.NewControllerManagedBy(mgr).
// Watch the controlled, infrastructure resource.
Expand All @@ -76,7 +77,7 @@ func AddClusterControllerToManager(ctx goctx.Context, ctrlMgrCtx *context.Contro
&clusterv1.Cluster{},
handler.EnqueueRequestsFromMapFunc(capiutil.ClusterToInfrastructureMapFunc(ctx, clusterControlledTypeGVK, mgr.GetClient(), &infrav1.ElfCluster{})),
).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), ctrlMgrCtx.WatchFilterValue)).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, ctrlMgrCtx.WatchFilterValue)).
WithOptions(options).
Complete(reconciler)
}
Expand Down
3 changes: 2 additions & 1 deletion controllers/elfmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func AddMachineControllerToManager(ctx goctx.Context, ctrlMgrCtx *context.Contro
ControllerManagerContext: ctrlMgrCtx,
NewVMService: service.NewVMService,
}
predicateLog := ctrl.LoggerFrom(ctx).WithValues("controller", "elfmachine")

return ctrl.NewControllerManagedBy(mgr).
// Watch the controlled, infrastructure resource.
Expand All @@ -100,7 +101,7 @@ func AddMachineControllerToManager(ctx goctx.Context, ctrlMgrCtx *context.Contro
handler.EnqueueRequestsFromMapFunc(capiutil.MachineToInfrastructureMapFunc(controlledTypeGVK)),
).
WithOptions(options).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), ctrlMgrCtx.WatchFilterValue)).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, ctrlMgrCtx.WatchFilterValue)).
Complete(reconciler)
}

Expand Down
Loading