2021-04-15 18:25:46 +08:00
/ *
Copyright 2021. The KubeVela Authors .
Licensed under the Apache License , Version 2.0 ( the "License" ) ;
you may not use this file except in compliance with the License .
You may obtain a copy of the License at
http : //www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing , software
distributed under the License is distributed on an "AS IS" BASIS ,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
See the License for the specific language governing permissions and
limitations under the License .
* /
package plugin
import (
"fmt"
2021-09-06 18:33:42 +08:00
"os"
2021-04-15 18:25:46 +08:00
"time"
2023-05-15 16:07:51 +08:00
. "github.com/onsi/ginkgo/v2"
2021-04-15 18:25:46 +08:00
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/e2e"
)
var _ = Describe ( "Test Kubectl Plugin" , func ( ) {
namespace := "default"
componentDefName := "test-webservice"
traitDefName := "test-ingress"
2021-09-13 14:17:12 +08:00
Context ( "Test kubectl vela dry-run" , func ( ) {
2021-04-15 18:25:46 +08:00
It ( "Test dry-run application use definitions which applied to the cluster" , func ( ) {
By ( "check definitions which application used whether applied to the cluster" )
var cd v1beta1 . ComponentDefinition
Eventually ( func ( ) error {
err := k8sClient . Get ( ctx , client . ObjectKey { Namespace : namespace , Name : componentDefName } , & cd )
return err
2022-07-25 10:34:26 +08:00
} , 5 * time . Second , time . Second ) . Should ( BeNil ( ) )
2021-04-15 18:25:46 +08:00
var td v1beta1 . TraitDefinition
Eventually ( func ( ) error {
err := k8sClient . Get ( ctx , client . ObjectKey { Namespace : namespace , Name : traitDefName } , & td )
return err
2022-07-25 10:34:26 +08:00
} , 5 * time . Second , time . Second ) . Should ( BeNil ( ) )
2021-04-15 18:25:46 +08:00
By ( "dry-run application" )
2021-09-06 18:33:42 +08:00
err := os . WriteFile ( "dry-run-app.yaml" , [ ] byte ( application ) , 0644 )
2021-04-15 18:25:46 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
2022-07-25 10:34:26 +08:00
Eventually ( func ( ) string {
2023-06-27 23:08:23 +08:00
output , _ := e2e . Exec ( "kubectl-vela dry-run -f dry-run-app.yaml -n default -x default" )
2022-07-25 10:34:26 +08:00
return output
} , 10 * time . Second , time . Second ) . Should ( ContainSubstring ( dryRunResult ) )
2021-04-15 18:25:46 +08:00
} )
It ( "Test dry-run application use definitions in local" , func ( ) {
2022-07-25 10:34:26 +08:00
Eventually ( func ( ) string {
2023-06-27 23:08:23 +08:00
output , _ := e2e . Exec ( "kubectl-vela dry-run -f dry-run-app.yaml -n default -d definitions" )
2022-07-25 10:34:26 +08:00
return output
} , 10 * time . Second , time . Second ) . Should ( ContainSubstring ( dryRunResult ) )
2021-04-15 18:25:46 +08:00
} )
} )
2021-09-13 14:17:12 +08:00
Context ( "Test kubectl vela live-diff" , func ( ) {
2021-04-15 18:25:46 +08:00
applicationName := "test-vela-app"
It ( "Test live-diff application use definition which applied to the cluster" , func ( ) {
By ( "check definitions which application used whether applied to the cluster" )
var cd v1beta1 . ComponentDefinition
Eventually ( func ( ) error {
err := k8sClient . Get ( ctx , client . ObjectKey { Namespace : namespace , Name : componentDefName } , & cd )
return err
} , 5 * time . Second ) . Should ( BeNil ( ) )
var td v1beta1 . TraitDefinition
Eventually ( func ( ) error {
err := k8sClient . Get ( ctx , client . ObjectKey { Namespace : namespace , Name : traitDefName } , & td )
return err
} , 5 * time . Second ) . Should ( BeNil ( ) )
By ( "get appRevision" )
var appRev v1beta1 . ApplicationRevision
var appRevName = fmt . Sprintf ( "%s-v1" , applicationName )
Eventually ( func ( ) error {
err := k8sClient . Get ( ctx , client . ObjectKey { Namespace : "default" , Name : appRevName } , & appRev )
return err
} , 5 * time . Second ) . Should ( BeNil ( ) )
2021-09-13 14:17:12 +08:00
Eventually ( func ( ) bool {
var tempApp v1beta1 . Application
_ = k8sClient . Get ( ctx , client . ObjectKey { Namespace : "default" , Name : app . Name } , & tempApp )
return tempApp . Status . LatestRevision != nil
2022-07-18 19:22:55 +08:00
} , 20 * time . Second , time . Second ) . Should ( BeTrue ( ) )
2021-09-13 14:17:12 +08:00
2021-04-15 18:25:46 +08:00
By ( "live-diff application" )
2021-09-06 18:33:42 +08:00
err := os . WriteFile ( "live-diff-app.yaml" , [ ] byte ( newApplication ) , 0644 )
2021-04-15 18:25:46 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
output , err := e2e . Exec ( "kubectl-vela live-diff -f live-diff-app.yaml" )
Expect ( err ) . NotTo ( HaveOccurred ( ) )
2021-07-30 10:02:51 +08:00
Expect ( output ) . Should ( ContainSubstring ( livediffResult ) )
2021-04-15 18:25:46 +08:00
} )
It ( "Test dry-run application use definitions in local" , func ( ) {
2021-09-13 14:17:12 +08:00
Eventually ( func ( ) bool {
var tempApp v1beta1 . Application
_ = k8sClient . Get ( ctx , client . ObjectKey { Namespace : "default" , Name : app . Name } , & tempApp )
return tempApp . Status . LatestRevision != nil
2022-07-18 19:22:55 +08:00
} , 20 * time . Second , time . Second ) . Should ( BeTrue ( ) )
2021-09-13 14:17:12 +08:00
2021-04-15 18:25:46 +08:00
output , err := e2e . Exec ( "kubectl-vela live-diff -f live-diff-app.yaml -d definitions" )
Expect ( err ) . NotTo ( HaveOccurred ( ) )
2021-07-30 10:02:51 +08:00
Expect ( output ) . Should ( ContainSubstring ( livediffResult ) )
2021-04-15 18:25:46 +08:00
} )
} )
2021-09-13 14:17:12 +08:00
Context ( "Test kubectl vela show" , func ( ) {
2021-04-15 18:25:46 +08:00
It ( "Test show componentDefinition reference" , func ( ) {
cdName := "test-show-task"
2022-01-06 13:29:02 +08:00
output , err := e2e . Exec ( fmt . Sprintf ( "kubectl-vela show %s -n default" , cdName ) )
2021-04-15 18:25:46 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
2021-07-30 10:02:51 +08:00
Expect ( output ) . Should ( ContainSubstring ( showCdResult ) )
2021-04-15 18:25:46 +08:00
} )
It ( "Test show traitDefinition reference" , func ( ) {
tdName := "test-sidecar"
2022-01-06 13:29:02 +08:00
output , err := e2e . Exec ( fmt . Sprintf ( "kubectl-vela show %s -n default" , tdName ) )
2021-04-15 18:25:46 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
2021-07-30 10:02:51 +08:00
Expect ( output ) . Should ( ContainSubstring ( showTdResult ) )
2021-04-15 18:25:46 +08:00
} )
2021-06-02 17:27:28 +08:00
It ( "Test show traitDefinition def with cue single map parameter" , func ( ) {
tdName := "annotations"
2022-01-06 13:29:02 +08:00
output , err := e2e . Exec ( fmt . Sprintf ( "kubectl-vela show %s -n default" , tdName ) )
2021-06-02 17:27:28 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
2022-07-25 10:34:26 +08:00
Expect ( output ) . Should ( ContainSubstring ( "map[string]:(null|string)" ) )
2021-06-02 17:27:28 +08:00
} )
2021-06-10 10:29:35 +08:00
It ( "Test show webservice def with cue ignore annotation " , func ( ) {
tdName := "webservice"
2022-01-06 13:29:02 +08:00
output , err := e2e . Exec ( fmt . Sprintf ( "kubectl-vela show %s -n default" , tdName ) )
2021-06-10 10:29:35 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
Expect ( output ) . ShouldNot ( ContainSubstring ( "addRevisionLabel" ) )
} )
2024-07-27 17:44:20 +08:00
It ( "Test show webservice def with cue ignore annotation2 " , func ( ) {
2021-06-10 10:29:35 +08:00
tdName := "mywebservice"
2022-01-06 13:29:02 +08:00
output , err := e2e . Exec ( fmt . Sprintf ( "kubectl-vela show %s -n default" , tdName ) )
2021-06-10 10:29:35 +08:00
Expect ( err ) . NotTo ( HaveOccurred ( ) )
Expect ( output ) . ShouldNot ( ContainSubstring ( "addRevisionLabel" ) )
Expect ( output ) . ShouldNot ( ContainSubstring ( "mySecretKey" ) )
} )
2021-04-15 18:25:46 +08:00
} )
} )
var application = `
apiVersion : core . oam . dev / v1beta1
kind : Application
metadata :
name : test - vela - app
namespace : default
spec :
components :
- name : express - server
type : test - webservice
properties :
image : crccheck / hello - world
port : 80
traits :
- type : test - ingress
properties :
domain : testsvc . example . com
http :
"/" : 80
`
var newApplication = `
apiVersion : core . oam . dev / v1beta1
kind : Application
metadata :
name : test - vela - app
namespace : default
spec :
components :
- name : new - express - server
type : test - webservice
properties :
image : crccheck / hello - world
port : 5000
2021-05-13 21:44:08 +08:00
cpu : "0.5"
2021-04-15 18:25:46 +08:00
traits :
- type : test - ingress
properties :
domain : new - testsvc . example . com
http :
"/" : 8080
`
var componentDef = `
apiVersion : core . oam . dev / v1beta1
kind : ComponentDefinition
metadata :
name : test - webservice
namespace : default
annotations :
definition . oam . dev / description : "Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers."
spec :
workload :
definition :
apiVersion : apps / v1
kind : Deployment
schematic :
cue :
template : |
output : {
apiVersion : "apps/v1"
kind : "Deployment"
spec : {
selector : matchLabels : {
"app.oam.dev/component" : context . name
}
template : {
metadata : labels : {
"app.oam.dev/component" : context . name
if parameter . addRevisionLabel {
"app.oam.dev/appRevision" : context . appRevision
}
}
spec : {
containers : [ {
name : context . name
image : parameter . image
if parameter [ "cmd" ] != _ | _ {
command : parameter . cmd
}
if parameter [ "env" ] != _ | _ {
env : parameter . env
}
if context [ "config" ] != _ | _ {
env : context . config
}
ports : [ {
containerPort : parameter . port
} ]
if parameter [ "cpu" ] != _ | _ {
resources : {
limits :
cpu : parameter . cpu
requests :
cpu : parameter . cpu
}
}
if parameter [ "volumes" ] != _ | _ {
volumeMounts : [ for v in parameter . volumes {
{
mountPath : v . mountPath
name : v . name
} } ]
}
} ]
if parameter [ "volumes" ] != _ | _ {
volumes : [ for v in parameter . volumes {
{
name : v . name
if v . type == "pvc" {
persistentVolumeClaim : {
claimName : v . claimName
}
}
if v . type == "configMap" {
configMap : {
defaultMode : v . defaultMode
name : v . cmName
if v . items != _ | _ {
items : v . items
}
}
}
if v . type == "secret" {
secret : {
defaultMode : v . defaultMode
secretName : v . secretName
if v . items != _ | _ {
items : v . items
}
}
}
if v . type == "emptyDir" {
emptyDir : {
medium : v . medium
}
}
} } ]
}
}
}
}
}
parameter : {
// +usage=Which image would you like to use for your service
// +short=i
image : string
// +usage=Commands to run in the container
cmd ? : [ ... string ]
// +usage=Which port do you want customer traffic sent to
// +short=p
port : * 80 | int
// +usage=Define arguments by using environment variables
env ? : [ ... {
// +usage=Environment variable name
name : string
// +usage=The value of the environment variable
value ? : string
// +usage=Specifies a source the value of this var should come from
valueFrom ? : {
// +usage=Selects a key of a secret in the pod's namespace
secretKeyRef : {
// +usage=The name of the secret in the pod's namespace to select from
name : string
// +usage=The key of the secret to select from. Must be a valid secret key
key : string
}
}
} ]
cpu ? : string
// If addRevisionLabel is true, the appRevision label will be added to the underlying pods
addRevisionLabel : * false | bool
// +usage=Declare volumes and volumeMounts
volumes ? : [ ... {
name : string
mountPath : string
// +usage=Specify volume type, options: "pvc","configMap","secret","emptyDir"
type : "pvc" | "configMap" | "secret" | "emptyDir"
if type == "pvc" {
claimName : string
}
if type == "configMap" {
defaultMode : * 420 | int
cmName : string
items ? : [ ... {
key : string
path : string
mode : * 511 | int
} ]
}
if type == "secret" {
defaultMode : * 420 | int
secretName : string
items ? : [ ... {
key : string
path : string
mode : * 511 | int
} ]
}
if type == "emptyDir" {
medium : * "" | "Memory"
}
} ]
}
`
var traitDef = `
apiVersion : core . oam . dev / v1beta1
kind : TraitDefinition
metadata :
annotations :
definition . oam . dev / description : " Configures K8s ingress and service to enable web traffic for your service .
Please use route trait in cap center for advanced usage . "
name : test - ingress
namespace : default
spec :
status :
customStatus : | -
if len ( context . outputs . ingress . status . loadBalancer . ingress ) > 0 {
message : "Visiting URL: " + context . outputs . ingress . spec . rules [ 0 ] . host + ", IP: " + context . outputs . ingress . status . loadBalancer . ingress [ 0 ] . ip
}
if len ( context . outputs . ingress . status . loadBalancer . ingress ) == 0 {
message : "No loadBalancer found, visiting by using 'vela port-forward " + context . appName + " --route'\n"
}
healthPolicy : |
isHealth : len ( context . outputs . service . spec . clusterIP ) > 0
appliesToWorkloads :
2021-05-20 19:06:38 +08:00
- deployments . apps
2021-04-15 18:25:46 +08:00
podDisruptive : false
schematic :
cue :
template : |
parameter : {
domain : string
http : [ string ] : int
}
// trait template can have multiple outputs in one trait
outputs : service : {
apiVersion : "v1"
kind : "Service"
metadata :
name : context . name
spec : {
selector : {
"app.oam.dev/component" : context . name
}
ports : [
for k , v in parameter . http {
port : v
targetPort : v
} ,
]
}
}
outputs : ingress : {
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
apiVersion : "networking.k8s.io/v1"
2021-04-15 18:25:46 +08:00
kind : "Ingress"
metadata :
name : context . name
spec : {
rules : [ {
host : parameter . domain
http : {
paths : [
for k , v in parameter . http {
path : k
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
pathType : "Prefix"
2021-04-15 18:25:46 +08:00
backend : {
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
service : {
name : context . name
port : {
number : v
}
}
2021-04-15 18:25:46 +08:00
}
} ,
]
}
} ]
}
}
`
2021-05-26 21:16:40 +08:00
var traitDefWithKube = `
apiVersion : core . oam . dev / v1beta1
kind : TraitDefinition
metadata :
name : service - kube
namespace : default
spec :
appliesToWorkloads :
- webservice
- worker
- backend
podDisruptive : true
schematic :
2025-02-03 11:09:28 +08:00
cue :
template : |
output : {
apiVersion : "v1"
kind : "Service"
metadata : {
name : "my-service"
}
spec : {
ports : [ {
protocol : "TCP"
2021-05-26 21:16:40 +08:00
port : 80
2025-02-03 11:09:28 +08:00
targetPort : parameters . targetPort
} ]
}
parameters : {
//+usage=target port num for service provider
targetPort : * 9376 | int
}
}
2021-05-26 21:16:40 +08:00
`
2021-06-10 10:29:35 +08:00
var componentWithDeepCue = `
# Test for deeper parameter in cue Template
apiVersion : core . oam . dev / v1beta1
kind : ComponentDefinition
metadata :
name : mywebservice
namespace : default
annotations :
definition . oam . dev / description : "Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers."
spec :
workload :
definition :
apiVersion : apps / v1
kind : Deployment
schematic :
cue :
template : |
output : {
apiVersion : "apps/v1"
kind : "Deployment"
spec : {
selector : matchLabels : {
"app.oam.dev/component" : context . name
}
template : {
metadata : labels : {
"app.oam.dev/component" : context . name
if parameter . addRevisionLabel {
"app.oam.dev/appRevision" : context . appRevision
}
}
spec : {
containers : [ {
name : context . name
image : parameter . image
if parameter [ "env" ] != _ | _ {
env : parameter . env
}
} ]
}
}
}
}
parameter : {
// +usage=Which image would you like to use for your service
// +short=i
image : string
// +ignore
// +usage=If addRevisionLabel is true, the appRevision label will be added to the underlying pods
addRevisionLabel : * false | bool
// +usage=Define arguments by using environment variables
env ? : [ ... {
// +usage=Environment variable name
name : string
// +usage=The value of the environment variable
value ? : string
// +usage=Specifies a source the value of this var should come from
valueFrom ? : {
// +usage=Selects a key of a secret in the pod's namespace
secretKeyRef : {
// +usage=The name of the secret in the pod's namespace to select from
name : string
// +ignore
// +usage=The key of the secret to select from. Must be a valid secret key
mySecretKey : string
}
}
} ]
}
`
2021-04-15 18:25:46 +08:00
var dryRunResult = ` -- -
2021-08-24 17:54:55 +08:00
# Application ( test - vela - app ) -- Component ( express - server )
2021-04-15 18:25:46 +08:00
-- -
apiVersion : apps / v1
kind : Deployment
metadata :
2021-09-13 14:17:12 +08:00
annotations : { }
2021-04-15 18:25:46 +08:00
labels :
app . oam . dev / appRevision : ""
app . oam . dev / component : express - server
app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
app . oam . dev / resourceType : WORKLOAD
2021-04-15 18:25:46 +08:00
workload . oam . dev / type : test - webservice
2021-08-24 17:54:55 +08:00
name : express - server
namespace : default
2021-04-15 18:25:46 +08:00
spec :
selector :
matchLabels :
app . oam . dev / component : express - server
template :
metadata :
labels :
app . oam . dev / component : express - server
spec :
containers :
- image : crccheck / hello - world
name : express - server
ports :
- containerPort : 80
-- -
2022-07-18 14:01:11 +08:00
# # From the trait test - ingress
2021-04-15 18:25:46 +08:00
apiVersion : v1
kind : Service
metadata :
2021-09-13 14:17:12 +08:00
annotations : { }
2021-04-15 18:25:46 +08:00
labels :
app . oam . dev / appRevision : ""
app . oam . dev / component : express - server
app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
app . oam . dev / resourceType : TRAIT
2021-04-15 18:25:46 +08:00
trait . oam . dev / resource : service
trait . oam . dev / type : test - ingress
name : express - server
2021-08-24 17:54:55 +08:00
namespace : default
2021-04-15 18:25:46 +08:00
spec :
ports :
- port : 80
targetPort : 80
selector :
app . oam . dev / component : express - server
-- -
2022-07-18 14:01:11 +08:00
# # From the trait test - ingress
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
apiVersion : networking . k8s . io / v1
2021-04-15 18:25:46 +08:00
kind : Ingress
metadata :
2021-09-13 14:17:12 +08:00
annotations : { }
2021-04-15 18:25:46 +08:00
labels :
app . oam . dev / appRevision : ""
app . oam . dev / component : express - server
app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
app . oam . dev / resourceType : TRAIT
2021-04-15 18:25:46 +08:00
trait . oam . dev / resource : ingress
trait . oam . dev / type : test - ingress
name : express - server
2021-08-24 17:54:55 +08:00
namespace : default
2021-04-15 18:25:46 +08:00
spec :
rules :
- host : testsvc . example . com
http :
paths :
- backend :
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
service :
name : express - server
port :
number : 80
2021-04-15 18:25:46 +08:00
path : /
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
pathType : Prefix
2021-04-15 18:25:46 +08:00
-- -
`
2022-03-28 14:47:47 +08:00
var livediffResult = ` Application ( test - vela - app ) has been modified ( * )
2021-04-15 18:25:46 +08:00
apiVersion : core . oam . dev / v1beta1
kind : Application
metadata :
creationTimestamp : null
2021-09-01 15:08:24 +08:00
- finalizers :
- - app . oam . dev / resource - tracker - finalizer
2021-04-15 18:25:46 +08:00
name : test - vela - app
namespace : default
spec :
components :
- - name : express - server
+ - name : new - express - server
properties :
2021-05-13 21:44:08 +08:00
+ cpu : "0.5"
2021-04-15 18:25:46 +08:00
image : crccheck / hello - world
- port : 80
+ port : 5000
traits :
- properties :
- domain : testsvc . example . com
+ domain : new - testsvc . example . com
http :
- / : 80
+ / : 8080
type : test - ingress
type : test - webservice
2021-10-02 10:19:41 +08:00
status : { }
2021-04-15 18:25:46 +08:00
2022-03-28 14:47:47 +08:00
* Component ( express - server ) has been removed ( - )
2021-06-24 15:06:58 +08:00
- apiVersion : apps / v1
- kind : Deployment
2021-04-15 18:25:46 +08:00
- metadata :
- labels :
2021-06-24 15:06:58 +08:00
- app . oam . dev / component : express - server
2021-04-15 18:25:46 +08:00
- app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
- app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
- app . oam . dev / resourceType : WORKLOAD
2021-06-24 15:06:58 +08:00
- workload . oam . dev / type : test - webservice
2021-09-13 14:17:12 +08:00
- name : express - server
- namespace : default
2021-04-15 18:25:46 +08:00
- spec :
2021-06-24 15:06:58 +08:00
- selector :
- matchLabels :
- app . oam . dev / component : express - server
- template :
2021-04-15 18:25:46 +08:00
- metadata :
- labels :
- app . oam . dev / component : express - server
- spec :
2021-06-24 15:06:58 +08:00
- containers :
- - image : crccheck / hello - world
- name : express - server
- ports :
- - containerPort : 80
2021-04-15 18:25:46 +08:00
2022-03-28 14:47:47 +08:00
* Component ( express - server ) / Trait ( test - ingress / service ) has been removed ( - )
2021-04-15 18:25:46 +08:00
- apiVersion : v1
- kind : Service
- metadata :
- labels :
- app . oam . dev / component : express - server
- app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
- app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
- app . oam . dev / resourceType : TRAIT
2021-04-15 18:25:46 +08:00
- trait . oam . dev / resource : service
- trait . oam . dev / type : test - ingress
- name : express - server
2021-09-13 14:17:12 +08:00
- namespace : default
2021-04-15 18:25:46 +08:00
- spec :
- ports :
- - port : 80
- targetPort : 80
- selector :
- app . oam . dev / component : express - server
2022-03-28 14:47:47 +08:00
* Component ( express - server ) / Trait ( test - ingress / ingress ) has been removed ( - )
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
- apiVersion : networking . k8s . io / v1
2021-04-15 18:25:46 +08:00
- kind : Ingress
- metadata :
- labels :
- app . oam . dev / component : express - server
- app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
- app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
- app . oam . dev / resourceType : TRAIT
2021-04-15 18:25:46 +08:00
- trait . oam . dev / resource : ingress
- trait . oam . dev / type : test - ingress
- name : express - server
2021-09-13 14:17:12 +08:00
- namespace : default
2021-04-15 18:25:46 +08:00
- spec :
- rules :
- - host : testsvc . example . com
- http :
- paths :
- - backend :
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
- service :
- name : express - server
- port :
- number : 80
2021-04-15 18:25:46 +08:00
- path : /
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
- pathType : Prefix
2021-04-15 18:25:46 +08:00
2022-03-28 14:47:47 +08:00
* Component ( new - express - server ) has been added ( + )
2021-06-24 15:06:58 +08:00
+ apiVersion : apps / v1
+ kind : Deployment
2021-04-15 18:25:46 +08:00
+ metadata :
+ labels :
2021-06-24 15:06:58 +08:00
+ app . oam . dev / component : new - express - server
2021-04-15 18:25:46 +08:00
+ app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
+ app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
+ app . oam . dev / resourceType : WORKLOAD
2021-06-24 15:06:58 +08:00
+ workload . oam . dev / type : test - webservice
2021-08-24 17:54:55 +08:00
+ name : new - express - server
+ namespace : default
2021-04-15 18:25:46 +08:00
+ spec :
2021-06-24 15:06:58 +08:00
+ selector :
+ matchLabels :
+ app . oam . dev / component : new - express - server
+ template :
2021-04-15 18:25:46 +08:00
+ metadata :
+ labels :
+ app . oam . dev / component : new - express - server
+ spec :
2021-06-24 15:06:58 +08:00
+ containers :
+ - image : crccheck / hello - world
+ name : new - express - server
+ ports :
+ - containerPort : 5000
+ resources :
+ limits :
+ cpu : "0.5"
+ requests :
+ cpu : "0.5"
2021-04-15 18:25:46 +08:00
2022-03-28 14:47:47 +08:00
* Component ( new - express - server ) / Trait ( test - ingress / service ) has been added ( + )
2021-04-15 18:25:46 +08:00
+ apiVersion : v1
+ kind : Service
+ metadata :
+ labels :
+ app . oam . dev / component : new - express - server
+ app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
+ app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
+ app . oam . dev / resourceType : TRAIT
2021-04-15 18:25:46 +08:00
+ trait . oam . dev / resource : service
+ trait . oam . dev / type : test - ingress
+ name : new - express - server
2021-08-24 17:54:55 +08:00
+ namespace : default
2021-04-15 18:25:46 +08:00
+ spec :
+ ports :
+ - port : 8080
+ targetPort : 8080
+ selector :
+ app . oam . dev / component : new - express - server
2022-03-28 14:47:47 +08:00
* Component ( new - express - server ) / Trait ( test - ingress / ingress ) has been added ( + )
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
+ apiVersion : networking . k8s . io / v1
2021-04-15 18:25:46 +08:00
+ kind : Ingress
+ metadata :
+ labels :
+ app . oam . dev / component : new - express - server
+ app . oam . dev / name : test - vela - app
2021-12-10 15:00:03 +08:00
+ app . oam . dev / namespace : default
2021-09-13 14:17:12 +08:00
+ app . oam . dev / resourceType : TRAIT
2021-04-15 18:25:46 +08:00
+ trait . oam . dev / resource : ingress
+ trait . oam . dev / type : test - ingress
+ name : new - express - server
2021-08-24 17:54:55 +08:00
+ namespace : default
2021-04-15 18:25:46 +08:00
+ spec :
+ rules :
+ - host : new - testsvc . example . com
+ http :
+ paths :
+ - backend :
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
+ service :
+ name : new - express - server
+ port :
+ number : 8080
2021-04-15 18:25:46 +08:00
+ path : /
Feat: webhook reject unknown cr outputs (#6932)
* 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>
2025-10-01 00:30:53 +08:00
+ pathType : Prefix
2021-04-15 18:25:46 +08:00
`
var testShowComponentDef = `
apiVersion : core . oam . dev / v1beta1
kind : ComponentDefinition
metadata :
name : test - show - task
namespace : vela - system
spec :
workload :
definition :
apiVersion : batch / v1
kind : Job
schematic :
cue :
template : |
output : {
apiVersion : "batch/v1"
kind : "Job"
spec : {
parallelism : parameter . count
completions : parameter . count
template : spec : {
restartPolicy : parameter . restart
containers : [ {
name : context . name
image : parameter . image
if parameter [ "cmd" ] != _ | _ {
command : parameter . cmd
}
} ]
}
}
}
parameter : {
// +usage=specify number of tasks to run in parallel
// +short=c
count : * 1 | int
// +usage=Which image would you like to use for your service
// +short=i
image : string
// +usage=Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never.
restart : * "Never" | string
// +usage=Commands to run in the container
cmd ? : [ ... string ]
}
`
var testShowTraitDef = `
apiVersion : core . oam . dev / v1beta1
kind : TraitDefinition
metadata :
name : test - sidecar
namespace : vela - system
spec :
appliesToWorkloads :
2021-05-20 19:06:38 +08:00
- deployments . apps
2021-04-15 18:25:46 +08:00
schematic :
cue :
template : | -
patch : {
// +patchKey=name
spec : template : spec : containers : [ parameter ]
}
parameter : {
name : string
image : string
command ? : [ ... string ]
}
`
2022-07-18 19:22:55 +08:00
var showCdResult = ` # Specification
2021-04-15 18:25:46 +08:00
+ -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- - +
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
+ -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- - +
2022-07-25 10:34:26 +08:00
| count | specify number of tasks to run in parallel . | int | false | 1 |
2022-07-18 19:22:55 +08:00
| image | Which image would you like to use for your service . | string | true | |
2022-08-08 17:57:48 +08:00
| restart | Define the job restart policy , the value can only be Never or OnFailure . By default , it ' s Never . | string | false | Never |
| cmd | Commands to run in the container . | [ ] string | false | |
2021-04-15 18:25:46 +08:00
+ -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- - +
`
2022-07-18 19:22:55 +08:00
var showTdResult = ` # Specification
2021-04-15 18:25:46 +08:00
+ -- -- -- -- - + -- -- -- -- -- -- - + -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- - +
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
+ -- -- -- -- - + -- -- -- -- -- -- - + -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- - +
| name | | string | true | |
| image | | string | true | |
| command | | [ ] string | false | |
+ -- -- -- -- - + -- -- -- -- -- -- - + -- -- -- -- -- + -- -- -- -- -- + -- -- -- -- - +
`