Skaffold: Support for custom push, e.g. for use with kind load

Created on 13 Jun 2019  路  7Comments  路  Source: GoogleContainerTools/skaffold

Would be nice if you could support local testing with kind.

Currently, you can skip pushing to a registry when detecting kind, I use

apiVersion: skaffold/v1beta11
kind: Config
profiles:
- name: dev
  build:
    local:
      push: false
  activation:
  - kubeContext: "kubernetes-admin@kind"

but now you still need to be able to call a custom cmd to "push" the image, in particular with kind load docker-image $IMAGE.

aredeploy good first issue help wanted kinfeature-request platforkind prioritp1

Most helpful comment

I need to verify, but I believe the check could be update to also check for kube context prefixed with kind- as that seems to be the new naming convention. As in the release notes:

Automatic KUBECONFIG export and merge to simplify using kind.
kind clusters will always have a kind- prefix in kubeconfig file entries and now can be identified by this.

Source: https://github.com/kubernetes-sigs/kind/releases/tag/v0.6.0

So this seems to be an pretty easy fix.

All 7 comments

@vasu1124 have you tried master branch? It should automatically run 'kind load' when you use kind. It still needs improvements though

@dgageot: I think your talking about this change (of yours) specifically? https://github.com/GoogleContainerTools/skaffold/blob/master/cmd/skaffold/app/cmd/config/util.go#L236-L238

That should only improve the current feature, so no need for skaffold from master.

I was surprised this feature was already built in. It took me a while to figure out how to use this, cause it wasn't working as expected. But then I saw the way it "detects" it's current context is a kind cluster:

func IsKindCluster(kubeContext string) bool {
    return strings.HasSuffix(kubeContext, "@kind")
}

Source: https://github.com/GoogleContainerTools/skaffold/blob/master/cmd/skaffold/app/cmd/config/util.go#L236-L238

What!? I was using a kind cluster with a different name (ie kind create cluster --name dev).

So I would like to at least see a better way of "detecting" a kind cluster. Maybe by setting a config value like kindCluster: true.

@vasu1124 have you tried master branch? It should automatically run 'kind load' when you use kind. It still needs improvements though

Nice. I had not tested with master (or now with v0.32) yet. That's what I was looking for.

(Although your fix is for kind specifically, a way to patch a "push" with a custom cmd and connect it with a profile, might be the more generic path. For every distro still out there, like microk8s and whatnot).

@Ilyes512 also points to more direct customisability in a profile.

I like kindCluster: true - @dgageot?

I've recently been experimenting with skaffold v1.0.1 along with kind 0.6.0 and have found that the following won't quite work:

func IsKindCluster(kubeContext string) bool {
    return strings.HasSuffix(kubeContext, "@kind")
}

due to the fact that newer versions of kind don't appear to append a @kind suffix to the kube context name. If I manually insert the @kind suffix in my kube config file skaffold is much happier.

The other wrinkle I'm still tinkering with (like https://github.com/GoogleContainerTools/skaffold/issues/2264#issuecomment-507054824) is the case where the kind cluster does not have a default name - ie:

kind create cluster --name feature_dev

In the case of a kind cluster that has a non-default name it looks like skaffold cannot emit a kind load docker-image --name feature_dev <image name> incantation.

I need to verify, but I believe the check could be update to also check for kube context prefixed with kind- as that seems to be the new naming convention. As in the release notes:

Automatic KUBECONFIG export and merge to simplify using kind.
kind clusters will always have a kind- prefix in kubeconfig file entries and now can be identified by this.

Source: https://github.com/kubernetes-sigs/kind/releases/tag/v0.6.0

So this seems to be an pretty easy fix.

I think this should be fixed through https://github.com/GoogleContainerTools/skaffold/pull/3298, so I'll close this.

Was this page helpful?
0 / 5 - 0 ratings