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

Cannot use downward API in PackageBuild #1523

Open
mamachanko opened this issue Apr 9, 2024 · 2 comments · Fixed by #1580
Open

Cannot use downward API in PackageBuild #1523

mamachanko opened this issue Apr 9, 2024 · 2 comments · Fixed by #1580
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed priority/important-soon Must be staffed and worked on currently or soon.

Comments

@mamachanko
Copy link
Contributor

What steps did you take:

  1. kctrl package init

  2. Update PackageBuild to read values from the downward API

    apiVersion: kctrl.carvel.dev/v1alpha1
    kind: PackageBuild
    metadata:
      creationTimestamp: null
      name: downward.example.com
    spec:
      release:
      - resource: {}
      template:
        spec:
          app:
            spec:
              deploy:
              - kapp: {}
              template:
              - ytt:
                  paths:
                  - carvel
                  valuesFrom:
                  - downwardAPI:
                      items:
                      - kubernetesAPIs: {}
                        name: k8s_gvs
              - kbld: {}
          export:
          - imgpkgBundle:
              useKbldImagesLock: true
            includePaths:
            - carvel
  3. Release/build the package

    kctrl package release --version 0.0.0-mamachanko --tag 0.0.0-mamachanko --copy-to build --yes

What happened:

Prerequisites
1. Host is authorized to push images to a registry (can be set up by running
`docker login`)
2. `package init` ran successfully.

The bundle created needs to be pushed to an OCI registry. (format:
<REGISTRY_URL/REPOSITORY_NAME>) e.g. index.docker.io/k8slt/sample-bundlekbld builds images when necessary and ensures that all image references are
resolved to an immutable reference
Building images and resolving references
panic: Not implemented

goroutine 1 [running]:
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local.(*MinCoreClient).Discovery(0xc000865ee0)
        github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local/min_core_client.go:94 +0x25
github.com/vmware-tanzu/carvel-kapp-controller/pkg/componentinfo.(*ComponentInfo).KubernetesAPIs(0x21a48c8?)
        github.com/vmware-tanzu/[email protected]/pkg/componentinfo/component_info.go:80 +0x2d
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*App).template.(*App).buildDownwardAPIAdditionalValues.func3()
        github.com/vmware-tanzu/[email protected]/pkg/app/app_template.go:96 +0x3f
github.com/vmware-tanzu/carvel-kapp-controller/pkg/template.DownwardAPIValues.AsYAMLs({{0xc000022480, 0x1, 0x1}, {{{0x0, 0x0}, {0x0, 0x0}}, {{0x271800b, 0xd}, {0x2713bbf, ...}, ...}}, ...})
        github.com/vmware-tanzu/[email protected]/pkg/template/downward_api_values.go:74 +0x519
github.com/vmware-tanzu/carvel-kapp-controller/pkg/template.Values.writeFromDownwardAPI({{0xc00032e540, 0x1, 0x1}, {0xc0003788d0, 0xc0003788c0, 0xc0003788e0}, {{0x271800b, 0xd}, {0x2713bbf, 0x9}, ...}, ...}, ...)
        github.com/vmware-tanzu/[email protected]/pkg/template/values.go:117 +0x58
github.com/vmware-tanzu/carvel-kapp-controller/pkg/template.Values.AsPaths({{0xc00032e540, 0x1, 0x1}, {0xc0003788d0, 0xc0003788c0, 0xc0003788e0}, {{0x271800b, 0xd}, {0x2713bbf, 0x9}, ...}, ...}, ...)
        github.com/vmware-tanzu/[email protected]/pkg/template/values.go:74 +0x51b
github.com/vmware-tanzu/carvel-kapp-controller/pkg/template.(*Ytt).template(0xc000395080, {0xc00030e070, 0x62}, {0x0?, 0x0})
        github.com/vmware-tanzu/[email protected]/pkg/template/ytt.go:66 +0x588
github.com/vmware-tanzu/carvel-kapp-controller/pkg/template.(*Ytt).TemplateDir(0xc000866a60?, {0xc00030e070?, 0xc0000061a0?})
        github.com/vmware-tanzu/[email protected]/pkg/template/ytt.go:38 +0x45
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*App).template(0xc00017e000, {0xc00030e070, 0x62})
        github.com/vmware-tanzu/[email protected]/pkg/app/app_template.go:53 +0x139b
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*App).reconcileFetchTemplateDeploy(0xc00017e000)
        github.com/vmware-tanzu/[email protected]/pkg/app/app_reconcile.go:142 +0x452
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*App).reconcileDeploy(0xc00017e000)
        github.com/vmware-tanzu/[email protected]/pkg/app/app_reconcile.go:93 +0x65
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*App).Reconcile(0xc00017e000, 0x0)
        github.com/vmware-tanzu/[email protected]/pkg/app/app_reconcile.go:50 +0x2ea
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*CRDApp).Reconcile(...)
        github.com/vmware-tanzu/[email protected]/pkg/app/crd_app.go:121
github.com/vmware-tanzu/carvel-kapp-controller/pkg/app.(*Reconciler).Reconcile(0xc0002e80f0, {0x2996e28, 0x3757680}, {{{0x2713bbf, 0x9}, {0x271800b, 0xd}}})
        github.com/vmware-tanzu/[email protected]/pkg/app/reconciler.go:99 +0x3f4
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local.(*Reconciler).Reconcile(0xc000868fd0, {{0xc000818200, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...)
        github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/local/reconciler.go:144 +0x7e5
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/app/release.(*AppSpecBuilder).Build(0xc000869908)
        github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/app/release/app_spec_builder.go:102 +0x879
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release.(*ReleaseOptions).Run(0xc0001a5400)
        github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release/release.go:127 +0x505
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release.NewReleaseCmd.func1(0xc000593230?, {0x27141d1?, 0xa?, 0x24cd920?})
        github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/package/release/release.go:54 +0x17
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd.configureGlobalFlags.func1.1(0xc000213be8?, {0xc0001ea150, 0x0, 0x7})
        github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd/kctrl.go:141 +0xc3
github.com/cppforlife/cobrautil.DisallowExtraArgs.WrapRunEForCmd.func2.1(0xc000213c90?, {0xc0001ea150, 0x0, 0x7})
        github.com/cppforlife/[email protected]/misc.go:45 +0x62
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd.configureGlobalFlags.WrapRunEForCmd.func3.1(0x11c4d3b?, {0xc0001ea150, 0x0, 0x7})
        github.com/cppforlife/[email protected]/misc.go:45 +0x62
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd.configureGlobalFlags.WrapRunEForCmd.func6.1(0x7?, {0xc0001ea150, 0x0, 0x7})
        github.com/cppforlife/[email protected]/misc.go:45 +0x62
github.com/vmware-tanzu/carvel-kapp-controller/cli/pkg/kctrl/cmd.configureTTY.func1.WrapRunEForCmd.func2.1(0xc0000c9c00?, {0xc0001ea150, 0x0, 0x7})
        github.com/cppforlife/[email protected]/misc.go:45 +0x62
github.com/spf13/cobra.(*Command).execute(0xc00083adc0, {0xc0001ea0e0, 0x7, 0x7})
        github.com/spf13/[email protected]/command.go:850 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc000232b00)
        github.com/spf13/[email protected]/command.go:958 +0x389
github.com/spf13/cobra.(*Command).Execute(0xc0000fea40?)
        github.com/spf13/[email protected]/command.go:895 +0x13
main.nonExitingMain()
        github.com/vmware-tanzu/carvel-kapp-controller/cli/cmd/kctrl/kctrl.go:39 +0x145
main.main()
        github.com/vmware-tanzu/carvel-kapp-controller/cli/cmd/kctrl/kctrl.go:21 +0x13

It appears as if it wants to read the downward API values from an actual cluster using the discovery client.

What did you expect:

That it just builds the package.

Anything else you would like to add:

no

Environment:

❯ kctrl --version
kctrl version 0.50.2

Succeeded

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@mamachanko mamachanko added bug This issue describes a defect or unexpected behavior carvel-triage This issue has not yet been reviewed for validity labels Apr 9, 2024
@carvel-bot carvel-bot added this to Carvel Apr 9, 2024
@mamachanko
Copy link
Contributor Author

@100mik
Copy link
Contributor

100mik commented Apr 10, 2024

We have like a "mocked" client for pieces that require talking to a cluster. I imagine a quick fix would be to supply some values for the time being.
And then eventually allow folks to supply these values as well (this is definitely the more useful one), however, we can get rid of the panic for the time being 🤔

@100mik 100mik added carvel-accepted This issue should be considered for future work and that the triage process has been completed and removed carvel-triage This issue has not yet been reviewed for validity labels Apr 10, 2024
@renuy renuy moved this to Prioritized Backlog in Carvel Apr 19, 2024
@renuy renuy added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Apr 19, 2024
@renuy renuy added priority/important-soon Must be staffed and worked on currently or soon. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels May 17, 2024
@github-project-automation github-project-automation bot moved this from Prioritized Backlog to Closed in Carvel Jul 3, 2024
@praveenrewar praveenrewar reopened this Jul 4, 2024
@github-project-automation github-project-automation bot moved this from Closed to In Progress in Carvel Jul 4, 2024
@github-actions github-actions bot added the carvel-triage This issue has not yet been reviewed for validity label Jul 4, 2024
@renuy renuy removed the carvel-triage This issue has not yet been reviewed for validity label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed priority/important-soon Must be staffed and worked on currently or soon.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants