Skip to content

Cannot use downward API in PackageBuild #1523

Open
@mamachanko

Description

@mamachanko

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a defect or unexpected behaviorcarvel-acceptedThis issue should be considered for future work and that the triage process has been completedpriority/important-soonMust be staffed and worked on currently or soon.

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions