Skip to content

Commit b3cf2a0

Browse files
committed
🌱 Add alias to GenericProviderReconciler type
1 parent 6b72fcd commit b3cf2a0

File tree

11 files changed

+55
-34
lines changed

11 files changed

+55
-34
lines changed

.golangci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
run:
22
timeout: 5m
33
go: "1.23"
4-
skip-files:
5-
- "zz_generated.*\\.go$"
64
allow-parallel-runners: true
75

86
linters:
@@ -145,6 +143,8 @@ issues:
145143
# supported will be caught by the default case in the switches.
146144
- "missing cases in switch of type v1.PlatformType: (\\.*)"
147145
exclude-use-default: false
146+
exclude-files:
147+
- "zz_generated.*\\.go$"
148148
exclude-rules:
149149
- linters:
150150
- staticcheck

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ GOTESTSUM_VER := v1.11.0
9090
GOTESTSUM_BIN := gotestsum
9191
GOTESTSUM := $(TOOLS_BIN_DIR)/$(GOTESTSUM_BIN)-$(GOTESTSUM_VER)
9292

93-
GINKGO_VER := v2.20.1
93+
GINKGO_VER := v2.22.2
9494
GINKGO_BIN := ginkgo
9595
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)
9696

api/v1alpha2/conditions_consts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ const (
2929
// IncorrectVersionFormatReason documents that the provider version is in the incorrect format.
3030
IncorrectVersionFormatReason = "IncorrectVersionFormat"
3131

32-
// IncorrectCoreProviderNameReason documents that the provider name is incorrect.
32+
// IncorrectCoreProviderNameReason documents that the Core provider name is incorrect.
3333
IncorrectCoreProviderNameReason = "IncorrectCoreProviderNameReason"
3434

3535
// EmptyVersionReason documents that the provider version is in the incorrect format.
3636
EmptyVersionReason = "EmptyVersionReason"
3737

38-
// FetchConfigValidationError documents that the FetchConfig is configured incorrectly.
38+
// FetchConfigValidationErrorReason documents that the FetchConfig is configured incorrectly.
3939
FetchConfigValidationErrorReason = "FetchConfigValidationError"
4040

4141
// UnknownProviderReason documents that the provider name is not the name of a known provider.

api/v1alpha2/provider_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import (
2323
)
2424

2525
const (
26-
ProviderFinalizer = "provider.cluster.x-k8s.io"
26+
ProviderFinalizer = "provider.cluster.x-k8s.io"
27+
2728
ConfigMapVersionLabelName = "provider.cluster.x-k8s.io/version"
29+
ConfigMapTypeLabel = "provider.cluster.x-k8s.io/type"
30+
ConfigMapNameLabel = "provider.cluster.x-k8s.io/name"
2831

2932
CompressedAnnotation = "provider.cluster.x-k8s.io/compressed"
3033

cmd/plugin/cmd/init_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
"sigs.k8s.io/cluster-api-operator/util"
3636
)
3737

38-
func TestCheckCAPIOpearatorAvailability(t *testing.T) {
38+
func TestCheckCAPIOperatorAvailability(t *testing.T) {
3939
tests := []struct {
4040
name string
4141
want bool
@@ -425,7 +425,7 @@ func getGenericProvider(ctx context.Context, client ctrlclient.Client, providerK
425425
}
426426

427427
return provider, nil
428-
case "RuntimExtensionProvider":
428+
case "RuntimeExtensionProvider":
429429
provider := &operatorv1.RuntimeExtensionProvider{}
430430
if err := client.Get(ctx, types.NamespacedName{Name: providerName, Namespace: providerNamespace}, provider); err != nil {
431431
return nil, err

controller/alias.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
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 controller
18+
19+
import providercontroller "sigs.k8s.io/cluster-api-operator/internal/controller"
20+
21+
type GenericProviderReconciler = providercontroller.GenericProviderReconciler

internal/controller/manifests_downloader.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ import (
3838
)
3939

4040
const (
41-
configMapVersionLabel = "provider.cluster.x-k8s.io/version"
42-
configMapTypeLabel = "provider.cluster.x-k8s.io/type"
43-
configMapNameLabel = "provider.cluster.x-k8s.io/name"
4441
configMapSourceLabel = "provider.cluster.x-k8s.io/source"
4542
configMapSourceAnnotation = "provider.cluster.x-k8s.io/source"
4643
operatorManagedLabel = "managed-by.operator.cluster.x-k8s.io"
@@ -292,10 +289,10 @@ func providerLabelSelector(provider operatorv1.GenericProvider) *metav1.LabelSel
292289
// ProviderLabels returns default set of labels that identify a config map with downloaded manifests.
293290
func ProviderLabels(provider operatorv1.GenericProvider) map[string]string {
294291
labels := map[string]string{
295-
configMapVersionLabel: provider.GetSpec().Version,
296-
configMapTypeLabel: provider.GetType(),
297-
configMapNameLabel: provider.GetName(),
298-
operatorManagedLabel: "true",
292+
operatorv1.ConfigMapVersionLabelName: provider.GetSpec().Version,
293+
operatorv1.ConfigMapTypeLabel: provider.GetType(),
294+
operatorv1.ConfigMapNameLabel: provider.GetName(),
295+
operatorManagedLabel: "true",
299296
}
300297

301298
if provider.GetSpec().FetchConfig != nil && provider.GetSpec().FetchConfig.OCI != "" {

internal/controller/phases_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,10 @@ releaseSeries:
529529
Name: testCurrentVersion,
530530
Namespace: "default",
531531
Labels: map[string]string{
532-
configMapVersionLabel: testCurrentVersion,
533-
configMapTypeLabel: core.GetType(),
534-
configMapNameLabel: core.GetName(),
535-
operatorManagedLabel: "true",
532+
operatorv1.ConfigMapVersionLabelName: testCurrentVersion,
533+
operatorv1.ConfigMapTypeLabel: core.GetType(),
534+
operatorv1.ConfigMapNameLabel: core.GetName(),
535+
operatorManagedLabel: "true",
536536
},
537537
},
538538
Data: map[string]string{"metadata": metadata, "components": ""},

test/e2e/air_gapped_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ var _ = Describe("Install Core Provider in an air-gapped environment", func() {
102102
HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
103103
), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
104104

105-
By("Waiting for status.IntalledVersion to be set")
105+
By("Waiting for status.InstalledVersion to be set")
106106
WaitFor(ctx, For(coreProvider).In(bootstrapCluster).ToSatisfy(func() bool {
107107
return ptr.Equal(coreProvider.Status.InstalledVersion, ptr.To(coreProvider.Spec.Version))
108108
}), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
@@ -129,7 +129,7 @@ var _ = Describe("Install Core Provider in an air-gapped environment", func() {
129129
HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
130130
), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
131131

132-
By("Waiting for status.IntalledVersion to be set")
132+
By("Waiting for status.InstalledVersion to be set")
133133
WaitFor(ctx, For(coreProvider).In(bootstrapCluster).ToSatisfy(func() bool {
134134
return ptr.Equal(coreProvider.Status.InstalledVersion, ptr.To(coreProvider.Spec.Version))
135135
}), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

test/e2e/compressed_manifests_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the
6767
HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
6868
), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
6969

70-
By("Waiting for status.IntalledVersion to be set")
70+
By("Waiting for status.InstalledVersion to be set")
7171
WaitFor(ctx, For(coreProvider).In(bootstrapCluster).ToSatisfy(func() bool {
7272
return ptr.Equal(coreProvider.Status.InstalledVersion, ptr.To(coreProvider.Spec.Version))
7373
}), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
@@ -94,7 +94,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the
9494
HaveStatusCondition(&infraProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
9595
), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
9696

97-
By("Waiting for status.IntalledVersion to be set")
97+
By("Waiting for status.InstalledVersion to be set")
9898
WaitFor(ctx, For(infraProvider).In(bootstrapCluster).ToSatisfy(func() bool {
9999
return ptr.Equal(infraProvider.Status.InstalledVersion, ptr.To(infraProvider.Spec.Version))
100100
}), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
@@ -168,7 +168,7 @@ var _ = Describe("Create and delete a provider with manifests that don't fit the
168168
HaveStatusCondition(&infraProvider.Status.Conditions, operatorv1.ProviderInstalledCondition)),
169169
e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
170170

171-
By("Waiting for status.IntalledVersion to be set")
171+
By("Waiting for status.InstalledVersion to be set")
172172
WaitFor(ctx, For(infraProvider).In(bootstrapCluster).ToSatisfy(func() bool {
173173
return ptr.Equal(infraProvider.Status.InstalledVersion, ptr.To(infraProvider.Spec.Version))
174174
}), e2eConfig.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)

0 commit comments

Comments
 (0)