Skip to content

Commit 01bc3b5

Browse files
authored
Merge pull request #11943 from mcbenjemaa/crs
✨ Integrate CRS code into regular code structure
2 parents dcea8e3 + 912fd81 commit 01bc3b5

File tree

78 files changed

+240
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+240
-306
lines changed

.golangci-kal.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ issues:
6262
- path-except: "api//*"
6363
linters:
6464
- kal
65-
- path: "api/v1beta1/*|api/v1alpha1/*"
65+
- path: "api/v1beta1/*|api/v1alpha1/*|api/addons/v1beta1/*"
6666
text: "Conditions field must be a slice of metav1.Condition"
6767
linters:
6868
- kal
@@ -86,11 +86,11 @@ issues:
8686
- kal
8787
# It does not make sense to add a maxItems marker on the *List structs as they are not used to generate CRD YAMLs.
8888
# This exclude will be removed once https://github.com/JoelSpeed/kal/issues/38 is resolved.
89-
- path: "api/v1beta1/*|api/v1alpha1/*"
89+
- path: "api/v1beta1/*|api/v1alpha1/*|api/addons/v1beta1/*"
9090
text: "maxlength: field Items must have a maximum items, add kubebuilder:validation:MaxItems marker"
9191
linters:
9292
- kal
93-
- path: "api/v1alpha1/*|api/v1beta1/*"
93+
- path: "api/v1alpha1/*|api/v1beta1/*|api/addons/v1beta1/*"
9494
text: "nobools"
9595
linters:
9696
- kal

.golangci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ linters-settings:
144144
- pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1
145145
alias: expv1
146146
# CAPI exp addons
147-
- pkg: sigs.k8s.io/cluster-api/internal/apis/core/exp/addons/v1alpha3
147+
- pkg: sigs.k8s.io/cluster-api/internal/apis/addons/v1alpha3
148148
alias: addonsv1alpha3
149-
- pkg: sigs.k8s.io/cluster-api/internal/apis/core/exp/addons/v1alpha4
149+
- pkg: sigs.k8s.io/cluster-api/internal/apis/addons/v1alpha4
150150
alias: addonsv1alpha4
151-
- pkg: sigs.k8s.io/cluster-api/exp/addons/api/v1beta1
151+
- pkg: sigs.k8s.io/cluster-api/api/addons/v1beta1
152152
alias: addonsv1
153153
# CAPI exp IPAM
154154
- pkg: sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1
@@ -282,6 +282,12 @@ issues:
282282
- linters:
283283
- staticcheck
284284
text: "SA1019: feature.ClusterResourceSet is deprecated: ClusterResourceSet feature is now GA and the corresponding feature flag will be removed in 1.12 release."
285+
- linters:
286+
- revive
287+
text: "exported: type name will be used as clusterresourceset.ClusterResourceSetBindingReconciler by other packages, and that stutters; consider calling this BindingReconciler"
288+
- linters:
289+
- revive
290+
text: "exported: type name will be used as clusterresourceset.ClusterResourceSetReconciler by other packages, and that stutters; consider calling this Reconciler"
285291
- linters:
286292
- revive
287293
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"

Makefile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,10 @@ generate-manifests-core: $(CONTROLLER_GEN) $(KUSTOMIZE) ## Generate manifests e.
286286
paths=./internal/apis/core/... \
287287
paths=./internal/controllers/... \
288288
paths=./internal/webhooks/... \
289+
paths=./internal/apis/addons/... \
289290
paths=./$(EXP_DIR)/api/... \
290291
paths=./$(EXP_DIR)/internal/controllers/... \
291292
paths=./$(EXP_DIR)/internal/webhooks/... \
292-
paths=./$(EXP_DIR)/addons/api/... \
293-
paths=./$(EXP_DIR)/addons/internal/controllers/... \
294-
paths=./$(EXP_DIR)/addons/internal/webhooks/... \
295293
paths=./$(EXP_DIR)/ipam/api/... \
296294
paths=./$(EXP_DIR)/ipam/internal/webhooks/... \
297295
paths=./$(EXP_DIR)/runtime/api/... \
@@ -389,12 +387,12 @@ generate-go-deepcopy: ## Run all generate-go-deepcopy-* targets
389387

390388
.PHONY: generate-go-deepcopy-core
391389
generate-go-deepcopy-core: $(CONTROLLER_GEN) ## Generate deepcopy go code for core
392-
$(MAKE) clean-generated-deepcopy SRC_DIRS="./api,./$(EXP_DIR)/api,./$(EXP_DIR)/addons/api,./$(EXP_DIR)/runtime/api,./$(EXP_DIR)/runtime/hooks/api"
390+
$(MAKE) clean-generated-deepcopy SRC_DIRS="./api,./internal/apis/addons,./$(EXP_DIR)/api,./$(EXP_DIR)/runtime/api,./$(EXP_DIR)/runtime/hooks/api"
393391
$(CONTROLLER_GEN) \
394392
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
395393
paths=./api/... \
394+
paths=./internal/apis/addons/... \
396395
paths=./$(EXP_DIR)/api/... \
397-
paths=./$(EXP_DIR)/addons/api/... \
398396
paths=./$(EXP_DIR)/ipam/api/... \
399397
paths=./$(EXP_DIR)/runtime/api/... \
400398
paths=./$(EXP_DIR)/runtime/hooks/api/... \
@@ -443,6 +441,7 @@ generate-go-conversions: ## Run all generate-go-conversions-* targets
443441
.PHONY: generate-go-conversions-core
444442
generate-go-conversions-core: ## Run all generate-go-conversions-core-* targets
445443
$(MAKE) generate-go-conversions-core-api
444+
$(MAKE) generate-go-conversions-addons-api
446445
$(MAKE) generate-go-conversions-core-exp
447446
$(MAKE) generate-go-conversions-core-exp-ipam
448447
$(MAKE) generate-go-conversions-core-runtime
@@ -456,16 +455,23 @@ generate-go-conversions-core-api: $(CONVERSION_GEN) ## Generate conversions go c
456455
./internal/apis/core/v1alpha3 \
457456
./internal/apis/core/v1alpha4
458457

458+
.PHONY: generate-go-conversions-addons-api
459+
generate-go-conversions-addons-api: $(CONVERSION_GEN) ## Generate conversions go code for addons api
460+
$(MAKE) clean-generated-conversions SRC_DIRS="./internal/apis/addons/v1alpha3,./internal/apis/addons/v1alpha4"
461+
$(CONVERSION_GEN) \
462+
--output-file=zz_generated.conversion.go \
463+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
464+
./internal/apis/addons/v1alpha3 \
465+
./internal/apis/addons/v1alpha4
466+
459467
.PHONY: generate-go-conversions-core-exp
460468
generate-go-conversions-core-exp: $(CONVERSION_GEN) ## Generate conversions go code for core exp
461-
$(MAKE) clean-generated-conversions SRC_DIRS="./internal/apis/core/exp/v1alpha3,./internal/apis/core/exp/addons/v1alpha3,./internal/apis/core/exp/v1alpha4,./internal/apis/core/exp/addons/v1alpha4"
469+
$(MAKE) clean-generated-conversions SRC_DIRS="./internal/apis/core/exp/v1alpha3,./internal/apis/core/exp/v1alpha4"
462470
$(CONVERSION_GEN) \
463471
--output-file=zz_generated.conversion.go \
464472
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
465473
./internal/apis/core/exp/v1alpha3 \
466-
./internal/apis/core/exp/v1alpha4 \
467-
./internal/apis/core/exp/addons/v1alpha3 \
468-
./internal/apis/core/exp/addons/v1alpha4
474+
./internal/apis/core/exp/v1alpha4
469475

470476
.PHONY: generate-go-conversions-core-exp-ipam
471477
generate-go-conversions-core-exp-ipam: $(CONVERSION_GEN) ## Generate conversions go code for core exp IPAM
@@ -527,7 +533,7 @@ generate-go-conversions-test-extension: $(CONVERSION_GEN) ## Generate conversion
527533
.PHONY: generate-go-openapi
528534
generate-go-openapi: $(OPENAPI_GEN) ## Generate openapi go code for runtime SDK
529535
@mkdir -p ./tmp/sigs.k8s.io; ln -s $(ROOT_DIR) ./tmp/sigs.k8s.io/; cd ./tmp; \
530-
for pkg in "api/v1beta1" "$(EXP_DIR)/runtime/hooks/api/v1alpha1"; do \
536+
for pkg in "api/v1beta1" "api/addons/v1beta1" "$(EXP_DIR)/runtime/hooks/api/v1alpha1"; do \
531537
(cd ../ && $(MAKE) clean-generated-openapi-definitions SRC_DIRS="./$${pkg}"); \
532538
echo "** Generating openapi schema for types in ./$${pkg} **"; \
533539
$(OPENAPI_GEN) \
File renamed without changes.

exp/addons/api/v1beta1/clusterresourceset_types.go renamed to api/addons/v1beta1/clusterresourceset_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ type ClusterResourceSetList struct {
205205
// +optional
206206
metav1.ListMeta `json:"metadata,omitempty"`
207207
// items is the list of ClusterResourceSets.
208+
// +required
208209
Items []ClusterResourceSet `json:"items"`
209210
}
210211

exp/addons/api/v1beta1/clusterresourcesetbinding_types.go renamed to api/addons/v1beta1/clusterresourcesetbinding_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ type ClusterResourceSetBindingList struct {
219219
// +optional
220220
metav1.ListMeta `json:"metadata,omitempty"`
221221
// items is the list of ClusterResourceSetBindings.
222+
// +required
222223
Items []ClusterResourceSetBinding `json:"items"`
223224
}
224225

exp/addons/api/v1beta1/condition_consts.go renamed to api/addons/v1beta1/condition_consts.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package v1beta1
1919
import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2020

2121
// Conditions and condition Reasons for the ClusterResourceSet object.
22-
2322
const (
2423
// ResourcesAppliedCondition documents that all resources in the ClusterResourceSet object are applied to
2524
// all matching clusters. This indicates all resources exist, and no errors during applying them to all clusters.

0 commit comments

Comments
 (0)