mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
* feat: implement output resource existence validation in component, trait, and policy definitions Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add validation tests for ComponentDefinition and TraitDefinition outputs - Implement tests for ComponentDefinition with non-existent CRDs in outputs, ensuring they are rejected. - Add tests for valid outputs in ComponentDefinition, confirming acceptance. - Include tests for mixed valid and non-K8s outputs in ComponentDefinition, verifying they pass validation. - Test handling of empty outputs in ComponentDefinition, ensuring they are accepted. - Introduce tests for invalid apiVersion formats in ComponentDefinition, confirming rejection. - Add tests for TraitDefinition with mixed valid and invalid outputs, ensuring proper rejection. - Create YAML manifests for valid and invalid ComponentDefinitions and TraitDefinitions to support e2e tests. - Ensure comprehensive coverage of edge cases in output validation logic. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> fix: handle errors in resource validation for component, trait, and policy definitions Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> fix: improve error handling in Go module tidy and resource validation Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add webhook debugging setup and validation tests for ComponentDefinition and TraitDefinition Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add VS Code launch configuration for debugging webhook validation Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> refactor: streamline error handling in Go module tidy and remove obsolete test manifests Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add mock context support for CUE template compilation Signed-off-by: Reetika Malhotra <malhotra.reetika25@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: enhance validation for WorkflowStepDefinition resources and improve output resource checks Signed-off-by: viskumar <viskumar@guidewire.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: implement resource validation for CUE templates and add unit tests Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: enhance logging and validation for component, policy, and trait definitions Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: improve error handling and logging in validation handlers for component, policy, trait, and workflow step definitions Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Remove testUnknownResource folder from repository Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: implement structured logging for validation handlers and remove deprecated request_logger Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: enhance structured logging and error handling in admission validation handlers Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: improve logging messages in validating handlers for better clarity Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: refactor logging field definitions for consistency and improve error handling in resource validation Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> chore: add license header to invalid_resource_check.go and invalid_resource_check_test.go Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: enhance validation tests for WorkflowStepDefinition and improve error messages Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add e2e-test-local target for k3d cluster setup and webhook validation Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add webhook configuration for workflow step definitions with validation rules Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: update e2e-test-local configuration and improve Ingress API version compatibility Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add installation of FluxCD CRDs in pre-hook to prevent webhook validation errors Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add ValidateResourcesExist feature gate and enhance resource validation in webhook handlers Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: enhance resource validation in e2e tests and improve addon definition checks Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: enhance addon definition detection by using owner references for validation Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: add ValidateResourcesExist feature gate and implement webhook validation for resource existence Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: update Ingress API version to v1 and adjust service references in tests Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> chore: remove webhook test commands and related YAML files from makefiles and tests Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> chore: remove architecture section from webhook debugging guide Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> feat: update webhook setup script with k3d host gateway IP note and improve cluster creation logic Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Fix: Correct path in Ingress resource definition in template tests Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Chore: add empty line to re-trigger failing workflow Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Chore: remove space to re-trigger workflow Signed-off-by: Chaitanya Reddy Onteddu <co@guidewire.com> --------- Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Signed-off-by: Chaitanya Reddy Onteddu <co@guidewire.com> Co-authored-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com> Co-authored-by: Amit Singh <amisingh@guidewire.com>
143 lines
5.8 KiB
Makefile
143 lines
5.8 KiB
Makefile
.PHONY: e2e-setup-core-pre-hook
|
|
e2e-setup-core-pre-hook:
|
|
sh ./hack/e2e/modify_charts.sh
|
|
|
|
.PHONY: e2e-setup-core-post-hook
|
|
e2e-setup-core-post-hook:
|
|
kubectl wait --for=condition=Available deployment/kubevela-vela-core -n vela-system --timeout=180s
|
|
helm install kruise https://github.com/openkruise/charts/releases/download/kruise-1.1.0/kruise-1.1.0.tgz --set featureGates="PreDownloadImageForInPlaceUpdate=true" --set daemon.socketLocation=/run/k3s/containerd/
|
|
kill -9 $(lsof -it:9098) || true
|
|
go run ./e2e/addon/mock &
|
|
bin/vela addon enable ./e2e/addon/mock/testdata/fluxcd
|
|
bin/vela addon enable ./e2e/addon/mock/testdata/terraform
|
|
bin/vela addon enable ./e2e/addon/mock/testdata/terraform-alibaba ALICLOUD_ACCESS_KEY=xxx ALICLOUD_SECRET_KEY=yyy ALICLOUD_REGION=cn-beijing
|
|
|
|
timeout 600s bash -c -- 'while true; do kubectl get ns flux-system; if [ $$? -eq 0 ] ; then break; else sleep 5; fi;done'
|
|
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=vela-core,app.kubernetes.io/instance=kubevela -n vela-system --timeout=600s
|
|
kubectl wait --for=condition=Ready pod -l app=source-controller -n flux-system --timeout=600s
|
|
kubectl wait --for=condition=Ready pod -l app=helm-controller -n flux-system --timeout=600s
|
|
|
|
.PHONY: e2e-setup-core-wo-auth
|
|
e2e-setup-core-wo-auth:
|
|
helm upgrade --install \
|
|
--create-namespace \
|
|
--namespace vela-system \
|
|
--set image.pullPolicy=IfNotPresent \
|
|
--set image.repository=vela-core-test \
|
|
--set applicationRevisionLimit=5 \
|
|
--set controllerArgs.reSyncPeriod=1m \
|
|
--set optimize.disableComponentRevision=false \
|
|
--set image.tag=$(GIT_COMMIT) \
|
|
--set multicluster.clusterGateway.image.repository=ghcr.io/oam-dev/cluster-gateway \
|
|
--set admissionWebhooks.patch.image.repository=ghcr.io/oam-dev/kube-webhook-certgen/kube-webhook-certgen \
|
|
--set featureGates.enableCueValidation=true \
|
|
--set featureGates.validateResourcesExist=true \
|
|
--wait kubevela ./charts/vela-core \
|
|
--debug
|
|
|
|
.PHONY: e2e-setup-core-w-auth
|
|
e2e-setup-core-w-auth:
|
|
helm upgrade --install \
|
|
--create-namespace \
|
|
--namespace vela-system \
|
|
--set image.pullPolicy=IfNotPresent \
|
|
--set image.repository=vela-core-test \
|
|
--set applicationRevisionLimit=5 \
|
|
--set optimize.disableComponentRevision=false \
|
|
--set image.tag=$(GIT_COMMIT) \
|
|
--wait kubevela \
|
|
./charts/vela-core \
|
|
--set authentication.enabled=true \
|
|
--set authentication.withUser=true \
|
|
--set authentication.groupPattern='*' \
|
|
--set featureGates.zstdResourceTracker=true \
|
|
--set featureGates.zstdApplicationRevision=true \
|
|
--set featureGates.validateComponentWhenSharding=true \
|
|
--set featureGates.validateResourcesExist=true \
|
|
--set multicluster.clusterGateway.enabled=true \
|
|
--set multicluster.clusterGateway.image.repository=ghcr.io/oam-dev/cluster-gateway \
|
|
--set admissionWebhooks.patch.image.repository=ghcr.io/oam-dev/kube-webhook-certgen/kube-webhook-certgen \
|
|
--set sharding.enabled=true \
|
|
--debug
|
|
kubectl get deploy kubevela-vela-core -oyaml -n vela-system | \
|
|
sed 's/schedulable-shards=/shard-id=shard-0/g' | \
|
|
sed 's/instance: kubevela/instance: kubevela-shard/g' | \
|
|
sed 's/shard-id: master/shard-id: shard-0/g' | \
|
|
sed 's/name: kubevela/name: kubevela-shard/g' | \
|
|
kubectl apply -f -
|
|
kubectl wait deployment -n vela-system kubevela-shard-vela-core --for condition=Available=True --timeout=90s
|
|
|
|
|
|
.PHONY: e2e-setup-core
|
|
e2e-setup-core: e2e-setup-core-pre-hook e2e-setup-core-wo-auth e2e-setup-core-post-hook
|
|
|
|
.PHONY: e2e-setup-core-auth
|
|
e2e-setup-core-auth: e2e-setup-core-pre-hook e2e-setup-core-w-auth e2e-setup-core-post-hook
|
|
|
|
.PHONY: e2e-api-test
|
|
e2e-api-test:
|
|
# Run e2e test
|
|
ginkgo -v -skipPackage capability,setup,application -r e2e
|
|
ginkgo -v -r e2e/application
|
|
|
|
|
|
.PHONY: e2e-test
|
|
e2e-test:
|
|
# Run e2e test
|
|
ginkgo -v ./test/e2e-test
|
|
@$(OK) tests pass
|
|
|
|
# Run e2e tests with k3d and webhook validation
|
|
.PHONY: e2e-test-local
|
|
e2e-test-local:
|
|
# Create k3d cluster if needed
|
|
@k3d cluster create kubevela-debug --servers 1 --agents 1 || true
|
|
# Build and load image
|
|
docker build -t vela-core:e2e-test -f Dockerfile . --build-arg=VERSION=e2e-test --build-arg=GITVERSION=test
|
|
k3d image import vela-core:e2e-test -c kubevela-debug
|
|
# Deploy with Helm
|
|
kubectl delete validatingwebhookconfiguration kubevela-vela-core-admission 2>/dev/null || true
|
|
helm upgrade --install kubevela ./charts/vela-core \
|
|
--namespace vela-system --create-namespace \
|
|
--set image.repository=vela-core \
|
|
--set image.tag=e2e-test \
|
|
--set image.pullPolicy=IfNotPresent \
|
|
--set admissionWebhooks.enabled=true \
|
|
--set featureGates.enableCueValidation=true \
|
|
--set featureGates.validateResourcesExist=true \
|
|
--set applicationRevisionLimit=5 \
|
|
--set controllerArgs.reSyncPeriod=1m \
|
|
--wait --timeout 3m
|
|
# Run tests
|
|
ginkgo -v ./test/e2e-test
|
|
@$(OK) tests pass
|
|
|
|
|
|
.PHONY: e2e-addon-test
|
|
e2e-addon-test:
|
|
cp bin/vela /tmp/
|
|
ginkgo -v ./test/e2e-addon-test
|
|
@$(OK) tests pass
|
|
|
|
.PHONY: e2e-multicluster-test
|
|
e2e-multicluster-test:
|
|
cd ./test/e2e-multicluster-test && go test -v -ginkgo.v -ginkgo.trace -coverpkg=./... -coverprofile=/tmp/e2e_multicluster_test.out
|
|
@$(OK) tests pass
|
|
|
|
.PHONY: e2e-cleanup
|
|
e2e-cleanup:
|
|
# Clean up
|
|
rm -rf ~/.vela
|
|
|
|
.PHONY: end-e2e-core
|
|
end-e2e-core:
|
|
sh ./hack/e2e/end_e2e_core.sh
|
|
|
|
.PHONY: end-e2e-core-shards
|
|
end-e2e-core-shards: end-e2e-core
|
|
CORE_NAME=kubevela-shard sh ./hack/e2e/end_e2e_core.sh
|
|
|
|
.PHONY: end-e2e
|
|
end-e2e:
|
|
sh ./hack/e2e/end_e2e.sh
|