<div dir="ltr">Hi,<div><br></div><div>We have worked with other options also. Although they are built on top of k8s/go-client, they don't fulfill completely all use-cases which we require. Anyway using these libraries is better than using raw go-client directly. What we might need is a minimal shim on top of these libraries to use relevant functionality when required.</div><div><ul><li><a href="https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client">https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client</a><br></li><ul><li>this client is used by all k8s controllers for reconciling and performing other actions.</li><li>it can handle structured and unstructured data. see example (<a href="https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client#example-Client--Create">https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client#example-Client--Create</a>)</li><li>It has high-level functions and also gives access to raw rest mappers for low-level functionality.</li></ul><li><a href="https://github.com/kubernetes-sigs/cluster-api/tree/master/cmd/clusterctl/clusterdeployer/clusterclient">https://github.com/kubernetes-sigs/cluster-api/tree/master/cmd/clusterctl/clusterdeployer/clusterclient</a><br></li><ul><li>there were several helper functions created for cluster API operations in clusterctl.</li><li>Much of this functionality we might need but it is not production-ready.</li><li>clusterctl is deprecated and clusteradm is introduced instead of this. We don't know how much of this functionality will evolve.</li><li>We can reuse some stuff from here while creating our own shim.</li></ul></ul><div><br></div></div><div>Br,</div><div>Kanwar</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2019 at 2:53 AM Kostiantyn Kalynovskyi <<a href="mailto:kkalynovskyi@mirantis.com">kkalynovskyi@mirantis.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello Airship team, in the light of development of Airship v2.0 , we are now coming to the point where we need to interact with deployed kubernetes clusters, ephemeral or target. <div><br>So far I have found 2 major options for this communication:</div><div><ul><li>k8s/go-client library with dynamic client and RESTmapper</li><ul><li>we would have to build our own wrapper over it, that would implement some of the kubectl functionality as well as some of kustomize functionality</li><li>with this approach, we can develop any input driver of our own, like golang structs, runtime.Object, []bytes, filesystem etc... (i think it is quite a lot of effort)</li></ul><li>use k8s/kubectl as a library:</li><ul><li>encompasses both <b>kustomize</b>, via <i>FilenameOptions.Kustomize, </i>and default <b>kubectl </b>functionality.</li><li>Has limited input capabilities (I think), read from stdin, or directly from filesystem</li><li>With this approach we would not care, what resources we are dealing with.</li><li>And in the light of development of <b>airship document </b>command, we would have to keep those limitations in mind.</li><li><b>airshipctl document</b> subcommands would have to filter, for example based on annotations required resources, and simply provide <i style="font-weight:bold">root directory</i>, where kustomize starts working, the rest would be done for example by KubeApply.Run() function with correct FilenameOptions.Kustomize flag.<br></li><li>There is a con, kubectl is a cmd tool itself, and sometimes using it as a library maybe be complicated, (not sure about that though)</li></ul></ul><div><br></div>If someone has any ideas, relevant experience or advice, it would be greatly appreciated, thank you in advance.</div></div>
_______________________________________________<br>
Airship-discuss mailing list<br>
<a href="mailto:Airship-discuss@lists.airshipit.org" target="_blank">Airship-discuss@lists.airshipit.org</a><br>
<a href="http://lists.airshipit.org/cgi-bin/mailman/listinfo/airship-discuss" rel="noreferrer" target="_blank">http://lists.airshipit.org/cgi-bin/mailman/listinfo/airship-discuss</a></blockquote></div>