Skip to content

subpath is being removed when updating lsp or source image workload from file #565

@warango4

Description

@warango4

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

  • After creating a workload using Local Source Proxy with a subpath, if the workload is to be updated from a file using --local-path again, the subpath is removed from the workload specification.
  • After creating a workload using source image with a subpath, if the workload is to be updated from a file using --local-path again, the subpath is removed from the workload specification.
  • If a workload is created from file, with a subpath specified, and then --local-path is specified from flags, the subpath is not being saved in the workload specification.

Expected behavior

A clear and concise description of what you expected to happen.

Steps to Reproduce

  • Create a workload using LSP
tanzu apps workload apply tanzu-java-web-app --local-path . --sub-path path
The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "." to "local-source-proxy.tap-local-source-system.svc.cluster.local/source:default-tanzu-java-web-app"...
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 63.15 kB p/s
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 63.14 kB p/s
📥 Published source

🔎 Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  annotations:
      6 + |    local-source-proxy.apps.tanzu.vmware.com: gcr.io/tanzu-framework-playground/source:default-tanzu-java-web-app@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
      7 + |  labels:
      8 + |    apps.tanzu.vmware.com/workload-type: web
      9 + |  name: tanzu-java-web-app
     10 + |  namespace: default
     11 + |spec:
     12 + |  source:
     13 + |    image: gcr.io/tanzu-framework-playground/source:default-tanzu-java-web-app@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
     14 + |    subPath: path
❓ Do you want to create this workload? [yN]: y
👍 Created workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
  • Update the workload to take some fields from a file
cat workload.yaml
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"
  source:
    subpath: my-path
    git:
      url: https://github.com/sample-accelerators/tanzu-java-web-app
      ref:
        branch: main
tanzu apps workload apply tanzu-java-web-app --local-path . -f ~/workload.yaml
❗ WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).

The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "." to "local-source-proxy.tap-local-source-system.svc.cluster.local/source:default-tanzu-java-web-app"...
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 65.18 kB p/s
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 65.17 kB p/s
No source code is changed

🔎 Update workload:
...
  4,  4   |metadata:
  5,  5   |  annotations:
  6,  6   |    local-source-proxy.apps.tanzu.vmware.com: gcr.io/tanzu-framework-playground/source:default-tanzu-java-web-app@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
  7,  7   |  labels:
      8 + |    app.kubernetes.io/part-of: tanzu-java-web-app
      9 + |    apps.tanzu.vmware.com/has-tests: "true"
  8, 10   |    apps.tanzu.vmware.com/workload-type: web
  9, 11   |  name: tanzu-java-web-app
 10, 12   |  namespace: default
 11, 13   |spec:
     14 + |  params:
     15 + |  - name: annotations
     16 + |    value:
     17 + |      autoscaling.knative.dev/minScale: "2"
 12, 18   |  source:
 13, 19   |    image: gcr.io/tanzu-framework-playground/source:default-tanzu-java-web-app@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
 14     - |    subPath: path
❓ Really update the workload "tanzu-java-web-app"? [yN]:
  • Create a workload using source image
tanzu apps workload apply tanzu-java-web-app --local-path . -s gcr.io/tanzu-framework-playground/java-app --sub-path path
The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "." to "gcr.io/tanzu-framework-playground/java-app"...
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 45.88 kB p/s
📥 Published source

🔎 Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    image: gcr.io/tanzu-framework-playground/java-app:latest@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
     12 + |    subPath: path
❓ Do you want to create this workload? [yN]: y
👍 Created workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"
  • Update the workload to take some fields from file
tanzu apps workload apply tanzu-java-web-app --local-path . -f ~/workload.yaml
❗ WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).

The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "." to "gcr.io/tanzu-framework-playground/java-app:latest"...
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 55.19 kB p/s
No source code is changed

🔎 Update workload:
...
  2,  2   |apiVersion: carto.run/v1alpha1
  3,  3   |kind: Workload
  4,  4   |metadata:
  5,  5   |  labels:
      6 + |    app.kubernetes.io/part-of: tanzu-java-web-app
      7 + |    apps.tanzu.vmware.com/has-tests: "true"
  6,  8   |    apps.tanzu.vmware.com/workload-type: web
  7,  9   |  name: tanzu-java-web-app
  8, 10   |  namespace: default
  9, 11   |spec:
     12 + |  params:
     13 + |  - name: annotations
     14 + |    value:
     15 + |      autoscaling.knative.dev/minScale: "2"
 10, 16   |  source:
 11, 17   |    image: gcr.io/tanzu-framework-playground/java-app:latest@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
 12     - |    subPath: path
❓ Really update the workload "tanzu-java-web-app"? [yN]:
  • Create a workload from file with a subpath defined and using --local-path
cat workload.yaml
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"
  source:
    subpath: my-path
tanzu apps workload apply -f ~/workload.yaml --local-path .
❗ WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).

The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "." to "local-source-proxy.tap-local-source-system.svc.cluster.local/source:default-tanzu-java-web-app"...
37.13 kB / 37.56 kB [-------------------------------------------------------------------------------------------------------------------------------------->_] 98.87% 76.01 kB p/s
37.56 kB / 37.56 kB [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 76.87 kB p/s
📥 Published source

🔎 Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  annotations:
      6 + |    local-source-proxy.apps.tanzu.vmware.com: gcr.io/tanzu-framework-playground/source:default-tanzu-java-web-app@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
      7 + |  labels:
      8 + |    app.kubernetes.io/part-of: tanzu-java-web-app
      9 + |    apps.tanzu.vmware.com/has-tests: "true"
     10 + |    apps.tanzu.vmware.com/workload-type: web
     11 + |  name: tanzu-java-web-app
     12 + |  namespace: default
     13 + |spec:
     14 + |  params:
     15 + |  - name: annotations
     16 + |    value:
     17 + |      autoscaling.knative.dev/minScale: "2"
     18 + |  source:
     19 + |    image: gcr.io/tanzu-framework-playground/source:default-tanzu-java-web-app@sha256:724bcd14c3a84fc7a918cd8ee7a6a987de1699617a17c5af166e8c689a2becf7
❓ Do you want to create this workload? [yN]:

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.90.0-alpha.0
buildDate: 2023-04-08
sha: 198b3730
v0.12.0-build.2-dev-9344335a

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

MacOS Ventura 13.3.1

Additional context & Relevant Debug Output (Logs, etc)

Workaround for this is to use --sub-path flag while updating the workload if using a yaml file.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions