Skip to content

Commit 2a1a95f

Browse files
Fix the kubebuilder enum (#42)
* Fix the kubebuilder enum Use semi-colon to separate out enum values * Update Github action Run linting on kubebuilder annotations.
1 parent 57a9f7f commit 2a1a95f

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

.github/workflows/build-lint-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- name: Check YAML linting
3535
run: make lint-yaml
3636

37+
- name: Check Kubebuilder Annotation linting
38+
run: make lint-kubebuilder
39+
3740
- name: Run tests
3841
run: make test
3942

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Bugfix: Fix the kubebuilder enum annotations for NutanixTrustBundleKind
810

911
## [0.3.1] - 2022-11-03
1012
### Added

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ endef
3737
TOOLS_BIN_DIR := hack/tools/bin
3838
CONTROLLER_GEN_BIN := controller-gen
3939
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)
40+
# CRD_OPTIONS define options to add to the CONTROLLER_GEN
41+
CRD_OPTIONS ?= "crd:crdVersions=v1"
42+
4043

4144
$(TOOLS_BIN_DIR):
4245
mkdir -p $(TOOLS_BIN_DIR)
@@ -72,8 +75,7 @@ ifeq ($(EXPORT_RESULT), true)
7275
endif
7376

7477
## Lint:
75-
lint: lint-go lint-yaml ## Run all available linters
76-
78+
lint: lint-go lint-yaml lint-kubebuilder ## Run all available linters
7779

7880
lint-go: ## Use golintci-lint on your project
7981
$(eval OUTPUT_OPTIONS = $(shell [ "${EXPORT_RESULT}" == "true" ] && echo "--out-format checkstyle ./... | tee /dev/tty > checkstyle-report.xml" || echo "" ))
@@ -86,6 +88,10 @@ ifeq ($(EXPORT_RESULT), true)
8688
endif
8789
docker run --rm -it -v $(shell pwd):/data cytopia/yamllint -d relaxed -f parsable $(shell git ls-files '*.yml' '*.yaml') $(OUTPUT_OPTIONS)
8890

91+
.PHONY: lint-kubebuilder
92+
lint-kubebuilder: $(CONTROLLER_GEN) ## Lint Kubebuilder annotations by generating objects and checking if it is successful
93+
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=.
94+
8995
## Help:
9096
help: ## Show this help.
9197
@echo ''

environment/credentials/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const (
8989
// +kubebuilder:object:generate=true
9090
type NutanixTrustBundleReference struct {
9191
// Kind of the Nutanix trust bundle
92-
// +kubebuilder:validation:Enum=String,Secret,ConfigMap
92+
// +kubebuilder:validation:Enum=String;ConfigMap
9393
Kind NutanixTrustBundleKind `json:"kind"`
9494
// Data of the trust bundle if Kind is String.
9595
// +optional

0 commit comments

Comments
 (0)