jenkinsci / kubernetes-cd-plugin

A Jenkins plugin to deploy to Kubernetes cluster
MIT License
140 stars 72 forks source link

Next step improve #79

Closed runzexia closed 1 year ago

runzexia commented 5 years ago
  1. There are more and more projects using CRD in k8s, such as istios, knavie, etc. I think we should get the api version and other information from the yaml file and create and update it. We can implement a function similar to kubectl apply
  2. Switch client to kubernetes-client java
  3. add a context to pipline run to see what resources are deployed ……

@gavinfish @MyronFanQiu I hope to get feedback from you on my thoughts. @soulseen and I can provide some help.

gavinfish commented 5 years ago

Hi @runzexia ,

  1. For the fabric8io sdk, it will parse the yaml file into its definition classes with api version. I do not know much details about kubectl apply. It will be great if the plugin can deploy general CRD.

  2. Indeed I created a PR #69 to switch the sdk, but the Jenkins classloader issue kubernetes-client/java#474 prevents it to load all the api models. Hope you can give some advice to fix this problem.

  3. This feature makes sense to me.

Any contribution here is welcome!

mmyyrroonn commented 5 years ago

Hi @runzexia Thanks for opening this issue. It's great. From my side, I just think we should be careful about switching client to java kubernetes-client. It should not affect the user experience.

Any contribution here is welcome! Actually, K8S is a new area for me. We can make this plugin better together! 😄

gavinfish commented 5 years ago

@runzexia any updates here? I need to do a release with #68 which will force users to update their api version for some kubernetes resources.

runzexia commented 5 years ago

@gavinfish There is no progress yet, I am still looking for something wrong with the classloader. If you need release, there is no problem. But I think we should mark this inconsistency in a relatively eye-catching place.

gavinfish commented 5 years ago

Great @runzexia! Indeed if you can fix the classloader issue and switch to kubernetes-client library, there may not be any inconsistency for the next release. The library seems to be compatible with different api versions.

gavinfish commented 5 years ago

Some details about the classloader issue in my opinion, the Yaml class will use these codes to load support models of kubernetes. In Jenkins, Yaml.class.getClassLoader() represents Jenkins plugins related classloader which is not compatible with the ClassPath. We can extend the classloader to make them compatible. But I think it may be easier here to find a place to invoke addModelMap and manually load the initial models.

runzexia commented 5 years ago

@gavinfish The PR I opened is blocked from the core using the hpi plugin, and the method can now be called. https://github.com/jenkinsci/kubernetes-cd-plugin/pull/81