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

Workload create/apply using a workload yaml file lacks validation to prevent inclusion of multiple source types #573

Closed
1 of 2 tasks
shaheerkootteeri opened this issue May 18, 2023 · 1 comment
Labels
bug Something isn't working needs-triage

Comments

@shaheerkootteeri
Copy link
Contributor

shaheerkootteeri commented May 18, 2023

Please fill out the issue checklist below and provide ALL the requested information.

  • I reviewed open and closed Github issues that may be related to my problem.
  • I am reporting a bug that others will be able to reproduce.

Describe the bug

A clear and concise description of what the bug is.
We are able to create a workload using workload yaml with multiple sources. For example the below workload yaml file will successfully create but with source as source.image as subpath

apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
  name: tanzu-java-web-app
  labels:
    apps.tanzu.vmware.com/workload-type: web
    app.kubernetes.io/part-of: tanzu-java-web-app
    apps.tanzu.vmware.com/has-tests: "true"
spec:
  params:
    - name: annotations
      value:
        autoscaling.knative.dev/minScale: "2"
  image: my-image
  source:
    subpath: my-path
    git:
      url: https://github.com/sample-accelerators/tanzu-java-web-app
      ref:
        branch: main
    image: my-source-image
🔎 Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    app.kubernetes.io/part-of: tanzu-java-web-app
      7 + |    apps.tanzu.vmware.com/has-tests: "true"
      8 + |    apps.tanzu.vmware.com/workload-type: web
      9 + |  name: tanzu-java-web-app
     10 + |  namespace: default
     11 + |spec:
     12 + |  params:
     13 + |  - name: annotations
     14 + |    value:
     15 + |      autoscaling.knative.dev/minScale: "2"
     16 + |  source:
     17 + |    image: my-source-image
     18 + |    subPath: my-path
👍 Created workload "tanzu-java-web-app"

Upon updating the workload with same yaml file with --update-strategy=replace the apps cli errors with message as Error: [--git-*, --source-image]: Required value: expected exactly one, got both

tanzu apps workload apply -f workload.yaml  -y --update-strategy=replace

I was also able to create/ update a workload with both maven in spec.Params as well as spec.image on workload yaml

Expected behavior

A clear and concise description of what you expected to happen.
Should't it behave the same way for creation as well as update? Also should we error usage of multiple sources while creating a workload using yaml file?

Steps to Reproduce

Steps to reproduce the behavior:

  1. create a workload yaml using above
  2. apply workload yaml using command
tanzu apps workload apply -f PATH_TO_workload.yaml  -y 
  1. see the output
  2. run the below command and see the error output.
tanzu apps workload apply -f PATH_TO_workload.yaml -y --update-strategy=replace 

Screenshots

If applicable, add screenshots to help explain your problem.

Version (Apps plugin version, Version of K8s running on cluster)

Put the output of the following commad

tanzu version && tanzu apps version
version: v0.28.1
buildDate: 2023-03-07
sha: 0e6704777-dirty
v0.12.0-build.2-dev-9344335a

### Environment where the bug was observed (cloud, OS, etc)

### Additional context & Relevant Debug Output (Logs, etc)
Add any other context about the problem here.
@shaheerkootteeri shaheerkootteeri added bug Something isn't working needs-triage labels May 18, 2023
@heyjcollins
Copy link
Contributor

We will not be executing this because update has been removed from the plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants