Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support Input validation for Kubevela Application manifests #6505

Open
bugbounce opened this issue Apr 15, 2024 · 0 comments
Open

Support Input validation for Kubevela Application manifests #6505

bugbounce opened this issue Apr 15, 2024 · 0 comments

Comments

@bugbounce
Copy link

Describe the bug

Currently Kubevela doesn't seem to have a mechanism to validate input fields in an Application before applying the manifest. Currently, the Application manifest deployment fails with an error with the workload output. This makes it difficult to debug, especially for end users.

To Reproduce

Steps to reproduce the behavior:

  1. Install Kubevela and Crossplane with Upbound AWS DynamoDB provider enabled.
  2. Install the following Component Definition
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
  name: dynamodb-v0
  namespace: vela-system
spec:
  schematic:
    cue:
      template:
        "output: {\n\tapiVersion: \"dynamodb.aws.upbound.io/v1beta1\"\n\tkind:       \"Table\"\n\tmetadata:
        name: \"tenant-\" + parameter.governance.tenantName + \"-\" + parameter.name\n\tspec:
        {\n\t\tname:   \"tenant-\" + parameter.governance.tenantName + \"-\" + parameter.name\n\t\tregion:
        parameter.region\n\t}\n}\n\nparameter: {\n\t// +usage=Name of the DynamoDB
        Table. Tenant prefix will be added automatically.\n\tname: string\n\t// +usage=AWS
        region where the DynamoDB Table will be created.\n\tregion: string\n\t// +usage=Attribute
        definitions, only required for hashKey and rangeKey attributes.\n\t// +usage=Governance
        metadata used for attribution of resources in Kubernetes and AWS.\n\tgovernance:
        {\n\t\t// +usage=Tenant name. Will be prefixed to the requested name of the
        Table.\n\t\ttenantName: string\n\t}\n}\n"
  workload:
    definition:
      apiVersion: dynamodb.aws.upbound.io/v1beta1
      kind: Table
  1. Install the following Kubevela Application with properties.name missing.
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: test-kubevela-dynamodb-required
spec:
  components:
    - name: myapptable
      type: dynamodb-v0
      properties:
        region: us-west-2
        governance:
          tenantName: test
  1. Error:
    run step(provider=oam,do=component-apply): GenerateComponentManifest: evaluate base template component=myapptable app=test-kubevela-dynamodb-required: failed to have the workload/trait unstructured: output.metadata.name: non-concrete value string in operand to + (and 1 more errors)

Expected behavior
We expect a relevant error from the point of view of the end user defining the Application. The current form of the error cannot be interpreted by the end user. Kubevela should validate the Application manifest before applying and return any errors.

KubeVela Version

Vela Core : 1.9.10

Cluster information

  • Kubernetes Version v1.28.8+k3s1

Additional context

bugbounce pushed a commit to bugbounce/kubevela that referenced this issue May 28, 2024
This also upgrades the version of cuelang to v0.6.0, which adds support
for fields with "RequiredConstraint". The target for this commit is to
validate if a required fields is missing from the input parameters and
return a meaningful error useful w.r.t to the Kubevela Application.
kubevela#6505
bugbounce pushed a commit to bugbounce/kubevela that referenced this issue May 29, 2024
This also upgrades the version of cuelang to v0.6.0, which adds support
for fields with "RequiredConstraint". The target for this commit is to
validate if a required fields is missing from the input parameters and
return a meaningful error useful w.r.t to the Kubevela Application.
kubevela#6505

Signed-off-by: Rahul Kumar <rahukumar@guidewire.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant