Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add kubebuilders validations for name length to be <= 63 #218

Merged
merged 70 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
cabe958
add kubebuilders validations for name length to be <= 63
jamyct Nov 15, 2024
d7110d4
add validation tests for member cluster service
jamyct Nov 19, 2024
72bcdd7
delete e2e test file
jamyct Nov 19, 2024
cd5ab5f
add tests for service export
jamyct Nov 19, 2024
8907ad1
add service import tests
jamyct Nov 20, 2024
c730655
add tests for service import and traffic manager profile/backend
jamyct Nov 20, 2024
f5faf85
add integration test to makefile
jamyct Nov 20, 2024
e6ac7e8
set TimeoutInSeconds default to 9
jamyct Nov 20, 2024
5673aef
add conditions for MonitorConfig
jamyct Nov 20, 2024
4f3a8df
add message to rule
jamyct Nov 20, 2024
e2faf02
add second values to monitorconfig
jamyct Nov 20, 2024
f6c87ba
run goimports
jamyct Nov 20, 2024
0630e47
resolve type comparison issue in CEL
jamyct Nov 21, 2024
a5d9fac
add case fo when intervalInSeconds is not 30 or 10
jamyct Nov 21, 2024
9023bdf
when IntervalInSeconds is 10, TimeoutInSeconds should be between 5 & 9
jamyct Nov 21, 2024
40ea19a
add integration-test to test
jamyct Dec 1, 2024
dccfcae
test all integration potential files
jamyct Dec 1, 2024
08f1c64
remove additional conditions
jamyct Dec 3, 2024
41ac502
remove role.yaml changes
jamyct Dec 3, 2024
50f4a8f
fix filepath in hubtestenv
jamyct Dec 3, 2024
679cdea
add copyright banner, fix format and change wording
jamyct Dec 3, 2024
0217227
fix: fix the atm feature related bugs (#220)
zhiying-lin Nov 20, 2024
e73a06d
docs: add application migration tutorials (#222)
zhiying-lin Nov 22, 2024
b6652ae
fix: requeue the request when the dns is not assigned (#225)
zhiying-lin Nov 27, 2024
e9e8a85
chore: bump thehanimo/pr-title-checker from 1.4.2 to 1.4.3 (#224)
dependabot[bot] Dec 2, 2024
5b4bb9f
rebase
jamyct Dec 3, 2024
e560016
fix conflict
jamyct Dec 3, 2024
96b120d
edit role.yaml
jamyct Dec 3, 2024
2232450
Merge remote-tracking branch 'origin/main' into add-resource-validation
jamyct Dec 3, 2024
5d27f30
delete e2e resource validation test
jamyct Dec 3, 2024
cd95d76
add namespace in suit_test.go
jamyct Dec 11, 2024
d08d860
add namespace in suit_test.go
jamyct Dec 11, 2024
391e833
fix directory for integration test
jamyct Dec 11, 2024
5a05046
update integration tests to use names longer than 63
jamyct Dec 11, 2024
638c5c6
make names valid
jamyct Dec 11, 2024
9a0c3a9
fix error message substring check for invalid RFC 1123 names
jamyct Dec 11, 2024
96d7da9
fix naming to multiClusterServiceName
jamyct Dec 11, 2024
cf66ebe
remove example test files
jamyct Dec 11, 2024
46fc413
copyright banner
jamyct Dec 11, 2024
1f27453
remove integration coverage xml file
jamyct Dec 11, 2024
577a447
fix import format in suite_test.go
jamyct Dec 11, 2024
c008933
edit format
jamyct Dec 11, 2024
ed2feec
Merge remote-tracking branch 'origin/main' into add-resource-validation
jamyct Dec 11, 2024
c384093
undo edit
jamyct Dec 11, 2024
4ee9956
delete print error and add error message if namespace not created
jamyct Dec 12, 2024
bfd40ec
rename fleetnetv1alpha1 for better readability
jamyct Dec 12, 2024
2f7e32a
use global variable for namespace string
jamyct Dec 12, 2024
4d29d65
delete namespace in aftersuite
jamyct Dec 12, 2024
1308cd3
use ginkgo to run integration test
jamyct Dec 12, 2024
e0211da
fix context
jamyct Dec 12, 2024
bc21a2f
fix names of strings to test
jamyct Dec 12, 2024
2c83da8
create global variable for nameWithInvalidSize
jamyct Dec 12, 2024
c0acd83
install ginkgo
jamyct Dec 12, 2024
fda9b28
Merge branch 'main' of github.com:jamyct/fleet-networking into add-re…
jamyct Jan 2, 2025
26533af
create global name variables within integration test file
jamyct Jan 2, 2025
5349a50
create global name variables for all remaining name types
jamyct Jan 2, 2025
c4a8a81
fix hubclient creation failure message and add deletiong failure message
jamyct Jan 2, 2025
6ea313b
add hub client creation and deletion messages in integration test file
jamyct Jan 2, 2025
867e851
install ginkgoin .github/workflows/unit-integration-tests.yml
jamyct Jan 2, 2025
7eb4c60
fix import styling in integration test file
jamyct Jan 3, 2025
e24440e
undo cluster to name change
jamyct Jan 3, 2025
fc9602c
fix cluster access issue
jamyct Jan 3, 2025
89b646c
fix member variable issue in traffic manager test
jamyct Jan 3, 2025
6fd0c47
install ginkgo before running tests
jamyct Jan 3, 2025
62f0c0d
remove unnecessary extra lines
jamyct Jan 3, 2025
162de81
declare var statusErr once and remove duplicate declarations
jamyct Jan 3, 2025
3311650
declare reused specs once and remove duplication
jamyct Jan 3, 2025
5f6e7a3
declare reused objectmeta once and remove duplications + correct alph…
jamyct Jan 3, 2025
57efd4c
resolve conflict with lates commit
jamyct Jan 3, 2025
8078722
resolve conflict with latest commit
jamyct Jan 3, 2025
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
4 changes: 4 additions & 0 deletions .github/workflows/unit-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Set up Ginkgo CLI
run: |
go install github.com/onsi/ginkgo/v2/[email protected]

- name: Run unit + integration tests & Generate coverage
run: make test

Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,17 @@ vet: ## Run go vet against code.
## --------------------------------------

.PHONY: test
test: manifests generate fmt vet local-unit-test
test: manifests generate fmt vet local-unit-test integration-test

.PHONY: local-unit-test
local-unit-test: $(ENVTEST) ## Run tests.
CGO_ENABLED=1 KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./pkg/... -race -coverprofile=coverage.xml -covermode=atomic -v

.PHONY: integration-test
integration-test: $(ENVTEST) ## Run integration tests.
jamyct marked this conversation as resolved.
Show resolved Hide resolved
CGO_ENABLED=1 KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" \
ginkgo -v -p --race --cover --coverpkg=./... ./test/apis/...

.PHONY: e2e-setup
e2e-setup:
bash test/scripts/bootstrap.sh
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/multiclusterservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date

// MultiClusterService is the Schema for creating north-south L4 load balancer to consume services across clusters.
// +kubebuilder:validation:XValidation:rule="size(self.metadata.name) < 64",message="metadata.name max length is 63"
type MultiClusterService struct {
metav1.TypeMeta `json:",inline"`
// +optional
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/serviceexport_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type ServiceExportStatus struct {
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date

// ServiceExport declares that the associated service should be exported to other clusters.
// +kubebuilder:validation:XValidation:rule="size(self.metadata.name) < 64",message="metadata.name max length is 63"
type ServiceExport struct {
metav1.TypeMeta `json:",inline"`
// +optional
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/serviceimport_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
// +kubebuilder:subresource:status

// ServiceImport describes a service imported from clusters in a ClusterSet.
// +kubebuilder:validation:XValidation:rule="size(self.metadata.name) < 64",message="metadata.name max length is 63"
type ServiceImport struct {
metav1.TypeMeta `json:",inline"`
// +optional
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/trafficmanagerbackend_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
// A backend contains one or more endpoints. Therefore, the controller may create multiple endpoints under the Traffic
// Manager Profile.
// https://learn.microsoft.com/en-us/azure/traffic-manager/traffic-manager-endpoint-types
// +kubebuilder:validation:XValidation:rule="size(self.metadata.name) < 64",message="metadata.name max length is 63"
type TrafficManagerBackend struct {
metav1.TypeMeta `json:",inline"`
// +optional
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/trafficmanagerprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (

// TrafficManagerProfile is used to manage a simple Azure Traffic Manager Profile using cloud native way.
// https://learn.microsoft.com/en-us/azure/traffic-manager/traffic-manager-overview
// +kubebuilder:validation:XValidation:rule="size(self.metadata.name) < 64",message="metadata.name max length is 63"
type TrafficManagerProfile struct {
metav1.TypeMeta `json:",inline"`
// +optional
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ spec:
required:
- spec
type: object
x-kubernetes-validations:
- message: metadata.name max length is 63
rule: size(self.metadata.name) < 64
served: true
storage: true
subresources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ spec:
x-kubernetes-list-type: map
type: object
type: object
x-kubernetes-validations:
- message: metadata.name max length is 63
rule: size(self.metadata.name) < 64
served: true
storage: true
subresources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ spec:
type: string
type: object
type: object
x-kubernetes-validations:
- message: metadata.name max length is 63
rule: size(self.metadata.name) < 64
served: true
storage: true
subresources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ spec:
required:
- spec
type: object
x-kubernetes-validations:
- message: metadata.name max length is 63
rule: size(self.metadata.name) < 64
served: true
storage: true
subresources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ spec:
required:
- spec
type: object
x-kubernetes-validations:
- message: metadata.name max length is 63
rule: size(self.metadata.name) < 64
served: true
storage: true
subresources:
Expand Down
Loading
Loading