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

"knctl build create" fails with "Error: assigned building pod: pods "..." not found" #57

Closed
jochenehret opened this issue Mar 6, 2019 · 3 comments
Labels
bug Something isn't working in-progress

Comments

@jochenehret
Copy link

When we call

knctl build create -b test-build \
--service-account dockerhub-service-account \
--image index.docker.io/bndlhub/test-build \
--template buildpack \
--template-env "PACK_APP_ZIP=archive.war" \
-d=$(pwd)

we immediately get the error:

Name  test-build

[2019-03-06T14:23:22+01:00] Uploading source code...

[2019-03-06T14:23:22+01:00] Finished uploading source code...

Error: Getting assigned building pod: pods "test-build-pod-8b35f1" not found

We've inserted a 10 seconds sleep in pkg/knctl/build/cluster_builder_source.go here:

func (s ClusterBuilderSource) Upload(ui ui.UI, cancelCh chan struct{}) error { // TODO cancel
        ui.PrintLinef("[%s] Uploading source code...", time.Now().Format(time.RFC3339))

        defer func() {
                ui.PrintLinef("[%s] Finished uploading source code...", time.Now().Format(time.RFC3339))
        }()

        build, err := s.waiter.WaitForClusterBuilderPodAssignment(cancelCh)
        if err != nil {
                return fmt.Errorf("Waiting for build to be assigned a pod: %s", err)
        }
        ui.PrintLinef("waiting 10 seconds ...")
        time.Sleep(10 * time.Second)
        if build.Status.Cluster == nil {
                return fmt.Errorf("Expected build to have cluster configuration assigned")
        }
        ....

This fixed the issue. With the patched version there is no error and the java-buildpack started working as expected.
It seems that one of the K8s API calls is asynchronous and must be waited for before continuing. Can you check if there are other such occurrences?

@cppforlife
Copy link
Owner

quite interesting as my assumption was that once pod name is populated, pod will exist. ill dig in deeper...

@cppforlife cppforlife added the bug Something isn't working label Mar 8, 2019
@cppforlife
Copy link
Owner

@jochenehret im guessing pod resource was not yet initialized in kubernetes api so was not being returned. i've added some waiting logic in d592f45 that should fix this. it's going thru ci.

@cppforlife
Copy link
Owner

fix is available in v0.3.0

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

No branches or pull requests

2 participants