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

kubectl deployer doesn't offer a way to skip validation #3222

Closed
zmb3 opened this issue Nov 12, 2019 · 3 comments · Fixed by #3512
Closed

kubectl deployer doesn't offer a way to skip validation #3222

zmb3 opened this issue Nov 12, 2019 · 3 comments · Fixed by #3512
Labels
area/deploy deploy/kubectl good first issue Good for newcomers kind/bug Something isn't working priority/p2 May take a couple of releases

Comments

@zmb3
Copy link
Contributor

zmb3 commented Nov 12, 2019

Expected behavior

I am trying to get out of a weird state which I believe is related to #1737. I expect skaffold delete to clean up my deployment.

Actual behavior

When I attempt to run skaffold delete I get an error:

error validating data: ValidationError(CustomResourceDefinition.spec.validation.openAPIV3Schema.properties.spec.properties.solver.properties.dns01.properties.webhook.properties.config): unknown field "x-kubernetes-preserve-unknown-fields" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps; if you choose to ignore these errors, turn validation off with --validate=false

I am using cert manager, which requires me to use --validate=false since I am not yet on kubernetes 1.15. Unfortunately, skaffold does not allow me an option to do this.

If I add --validate=false to deploy.kubectl.flags.global I get past this validation error, but the kubectl delete fails because --validate is not a valid flag:

DEBU[0000] Running command: [kubectl --context mycontext delete --validate=false --ignore-not-found=true -f -]

  • Error: unknown flag: --validate

If I move the --validate flag from the global flags to the apply: section the validation error comes back because skaffold is running a kubectl create --dry-run without the --validate=false flag.

Should skaffold use the deploy.kubectl.flags.applyfor kubectl create as well?

Information

  • Skaffold version: v1.0.0
  • Operating system: macOS Catalina
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1
kind: Config
metadata:
  name: foo
build:
  local: {}
  artifacts:
    - image: gcr.io/myproject/foo
  tagPolicy:
    gitCommit: {}
deploy:
  kubectl:
    flags:
      global:
        - "--validate=false"
      # apply:
      #   - "--validate=false"
    manifests:
      - deploy/*.yml
@tejal29 tejal29 added area/deploy deploy/kubectl kind/feature-request kind/bug Something isn't working priority/p2 May take a couple of releases good first issue Good for newcomers and removed kind/feature-request labels Nov 12, 2019
@dgageot
Copy link
Contributor

dgageot commented Nov 13, 2019

I see et least three options:

  • Use the apply flags for kubectl create: It might break for users who use flags that are supported by kubctl apply but not kubectl create.
  • Add a create section to the flags configuration. It might become really complicated, though.
  • Add a validate bool flag to the kubectl config. This is my favourite option so far.

@zmb3 wdy?

@dgageot dgageot self-assigned this Nov 13, 2019
@zmb3
Copy link
Contributor Author

zmb3 commented Nov 13, 2019

I’m not experienced enough with the tool/ecosystem yet to have an opinion. Happy to help with an implementation when we decide on a solution though.

@dgageot dgageot removed their assignment Nov 27, 2019
@tejal29
Copy link
Contributor

tejal29 commented Jan 15, 2020

Thanks @zmb3, i think we could proceed with option 3 like @dgageot mentioned.
Would like to submit a PR ?
Adding a config is instructions are documented here
Thanks
Tejal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy deploy/kubectl good first issue Good for newcomers kind/bug Something isn't working priority/p2 May take a couple of releases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants