Skip to content

fix: resolve issue where kubectl Flags.Apply namespace flag usage would fail#8351

Merged
aaron-prindle merged 1 commit intoGoogleContainerTools:mainfrom
aaron-prindle:fix-8336
Jan 24, 2023
Merged

fix: resolve issue where kubectl Flags.Apply namespace flag usage would fail#8351
aaron-prindle merged 1 commit intoGoogleContainerTools:mainfrom
aaron-prindle:fix-8336

Conversation

@aaron-prindle
Copy link
Copy Markdown
Contributor

@aaron-prindle aaron-prindle commented Jan 23, 2023

fixes #8336

Adding that issue text inline below:

There is currently an issue where skaffold apply uses incorrect namespace if kubectl -n or --namespace flag is provided in deploy.kubectl.flags.apply field

Repro:

skaffold.yaml

apiVersion: skaffold/v4beta1
kind: Config
build:
  tagPolicy:
    gitCommit: {}
  local: {}
manifests:
  rawYaml:
  - /workspace/source/deployment.yaml
  - /workspace/source/service.yaml
  - /workspace/source/httproute.yaml
deploy:
  kubectl:
    flags:
      apply:
      - --namespace=service-mesh
  logs:
    prefix: container

manifests.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: service-mesh
  name: service-mesh-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: service-mesh
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: service-mesh
    spec:
      containers:
      - image: gcr.io/google-containers/nginx:latest
        imagePullPolicy: Always
        name: hello-app

Unexpected/Bug-indicating Error message (should work):

- the namespace from the provided object "default" does not match the namespace "service-mesh". You must pass '--namespace=default' to perform this operation.

Works with:

    flags:
      global:
      - --namespace=service-mesh

But not:

    flags:
      apply:
      - --namespace=service-mesh

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 23, 2023

Codecov Report

Merging #8351 (7a6ab5d) into main (290280e) will decrease coverage by 4.61%.
The diff coverage is 54.85%.

@@            Coverage Diff             @@
##             main    #8351      +/-   ##
==========================================
- Coverage   70.48%   65.88%   -4.61%     
==========================================
  Files         515      605      +90     
  Lines       23150    29786    +6636     
==========================================
+ Hits        16317    19624    +3307     
- Misses       5776     8686    +2910     
- Partials     1057     1476     +419     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/completion.go 13.04% <0.00%> (-1.25%) ⬇️
cmd/skaffold/app/cmd/config/list.go 65.21% <ø> (ø)
cmd/skaffold/app/cmd/config/set.go 88.72% <ø> (ø)
cmd/skaffold/app/cmd/config/util.go 54.28% <ø> (ø)
cmd/skaffold/app/cmd/credits.go 100.00% <ø> (ø)
cmd/skaffold/app/cmd/credits/export.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/deploy.go 40.90% <0.00%> (-12.94%) ⬇️
cmd/skaffold/app/cmd/generate_pipeline.go 60.00% <ø> (ø)
cmd/skaffold/app/cmd/inspect_modules.go 65.00% <ø> (ø)
cmd/skaffold/app/cmd/inspect_profiles.go 66.66% <ø> (ø)
... and 415 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@aaron-prindle aaron-prindle merged commit 954bcf1 into GoogleContainerTools:main Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skaffold apply uses incorrect namespace if kubectl -n or --namespace flag is provided in deploy.kubectl.flags.apply field

2 participants