skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

skaffold 2 with multiple deployers kubectl and helm in one time config values in skaffold.yaml

Open 1Const1 opened this issue 1 year ago • 2 comments

Expected behavior

Apply kubectl manifests raw yaml and than helm install command

Actual behavior

only helm install command is running

Information

  • Skaffold version: 2.13.0
  • Operating system: MacOS
  • Installed via: Homebrew
  • Contents of skaffold.yaml:
apiVersion: skaffold/v4beta11
kind: Config
metadata:
  name: microservice
build:
  tagPolicy:
    gitCommit:
      variant: CommitSha
  artifacts:
    - image: nexus.corp.us:8081/microservice
      jib:
        args: [
          "-D", "jib.container.mainClass=org.sample.Application",
        ]
manifests:
  rawYaml:
    - kubernetes/configmap.yml
deploy:
  helm:
    releases:
      - name: microservice
        remoteChart: http://someurl.corp.com/chart/archive.tar.gz
        namespace: appnamespace
        valuesFiles:
          - kubernetes/values.yaml
        setValues:
          image: nexus.corp.us:8081/microservice
          imageConfig.pullPolicy: Always
          debug: true
        wait: true
        recreatePods: true

Steps to reproduce the behavior

  1. skaffold dev --port-forward --cleanup=true -n appnamespace --filename=skaffold.yaml

i have been tryed also set manifests yaml to apply first like this:

manifests:
  rawYaml:
    - kubernetes/configmap.yml
deploy:
  kubectl: {}
  helm:
    releases:

not helps

tryed like this

manifests:
  rawYaml:
    - kubernetes/configmap.yml
deploy:
  kubectl: 
      manifests:
           - kubernetes/configmap.yml
  helm:
    releases:

gives error yaml skaffold validation that manifests not fould - "field manifests not found in type latest.KubectlDeploy"

So could someone help please what is correct yaml config value for multiple deployers in skaffold.yaml for running first kubectl apply file command and after that helm install command?

found this issue for old version - https://github.com/GoogleContainerTools/skaffold/pull/3392 this code was not in current repo skaffold

and this request - https://github.com/GoogleContainerTools/skaffold/issues/4231

1Const1 avatar Jul 11 '24 11:07 1Const1

Legacy Helm deployer is handled before kubectl deployer. https://github.com/GoogleContainerTools/skaffold/blob/4ef420a8a5670824f0c1bf054a876eeed30a028e/pkg/skaffold/runner/deployer.go#L168-L188

As I understand it is legacy because Helm is used to deploy/update (executing helm deploy .../helm upgrade ...), instead of rendering the Helm templatest to kubectl ready manifests with Helm and then applying these with kubectl.

Swapping kubectl and helm deployments may break some existing deployments that require Helm to be executed before kubectl. A possibility to manually order the deployments in a single Skaffold Config file would be the only solution here.

vellotis avatar Jul 31 '25 09:07 vellotis

I solved the ordering problem by having requires, as requires are always handled before handling current skaffold config.

skaffold.yaml

apiVersion: skaffold/v4beta11
kind: Config
metadata:
  name: deployment

requires:
  - configs: ['configmap']
    path: skaffold.configmap.yaml

deploy:
  helm:
    releases: /*...*/

skaffold.cofigmap.yaml

apiVersion: skaffold/v4beta11
kind: Config
metadata:
  name: configmap

manifests:
  rawYaml:
    - kubernetes/configmap.yaml
deploy:
  kubectl: {}

vellotis avatar Aug 05 '25 11:08 vellotis