yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

Remove built in kubernetes support

Open JPinkney opened this issue 4 years ago • 4 comments

It's probably time that we start to deprecate the built-in Kubernetes support from the language server. Although it is useful, it really shouldn't be bundled with the extension and it creates issues that have to be specifically solved inside of the language server that don't really make sense in the context of a pure YAML language server.

E.g. https://github.com/redhat-developer/yaml-language-server/issues/220, https://github.com/redhat-developer/yaml-language-server/issues/211, https://github.com/redhat-developer/yaml-language-server/issues/132, https://github.com/redhat-developer/vscode-yaml/issues/153, https://github.com/redhat-developer/vscode-yaml/issues/246.

These are the things that should be done:

  • [ ] Remove kubernetes references from README
  • [ ] Remove kubernetes schema automapping (kubernetes -> https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.17.0-standalone-strict/all.json)
  • [ ] Remove kubernetes references in server.ts
  • [ ] Rename all references of isKubernetes in https://github.com/redhat-developer/yaml-language-server/blob/master/src/languageservice/parser/jsonParser07.ts. These need to be renamed and not removed because that part of the code is still useful. It allows you to use an alternative schema matching mechanism that may work better. This issue shows heavily in cases like the kubernetes schema where there are a lot of "oneOf" present in the json schema
  • [ ] Update Changelog with breaking change

JPinkney avatar Aug 20 '20 14:08 JPinkney

It would be great to document how to migrate to a post-kubernetes yaml-language-server without losing kubernetes integration.

ibotty avatar Nov 18 '20 13:11 ibotty

I hate to be negative, but Kubernetes integration is the reason why I'm using this language server.

EDIT: nevermind, I just found out I can provide the kubernetes schema url instead of Kubernetes on the configuration file. It was not clear to me before, since this fact is not made clear on the README.md or on this ticket. Sorry for creating noise.

FranciscoKurpiel avatar Dec 28 '20 14:12 FranciscoKurpiel

@FranciscoKurpiel, can you share the kubernetes schema url? I cannot seem to find it

trallnag avatar Jun 13 '21 09:06 trallnag

That's a snippet of my coc-settings.json. It is probably awful in a thousand ways, but it works. Kinda. I mean, who am I to know how to configure neovim?

Note that the URL is for k8s 1.18, but it should work with newer versions after making obvious changes to the url.

{
  "languageserver": {
    "yaml": {
      "filetypes": ["yaml", "yml"],
      "module": "/home/xyko/.config/nvim/plugged/coc-yaml/node_modules/yaml-language-server/out/server/src/server.js"
    }
  },

  "yaml.schemas": {
    "https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.18.0-standalone-strict/all.json": [ "/*.k8s.yaml" ],
    "http://json.schemastore.org/kustomization": [ "kustomization.yaml" ],
    "https://raw.githubusercontent.com/GoogleContainerTools/skaffold/master/docs/content/en/schemas/v2beta8.json": [ "skaffold.yaml" ]
  },

  "yaml.format.enable": true,
  "yaml.validate": true,
  "json.schemaDownload.enable": true,
  "coc.preferences.colorSupport": true
}

FranciscoKurpiel avatar Jun 14 '21 08:06 FranciscoKurpiel