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.
So far I have found 2 major options for this communication:
- k8s/go-client library with dynamic client and RESTmapper
- 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
- 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)
- use k8s/kubectl as a library:
- encompasses both kustomize, via FilenameOptions.Kustomize, and default kubectl functionality.
- Has limited input capabilities (I think), read from stdin, or directly from filesystem
- With this approach we would not care, what resources we are dealing with.
- And in the light of development of airship document command, we would have to keep those limitations in mind.
- airshipctl document subcommands would have to filter, for example based on annotations required resources, and simply provide root directory, where kustomize starts working, the rest would be done for example by KubeApply.Run() function with correct FilenameOptions.Kustomize flag.
- 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)
If someone has any ideas, relevant experience or advice, it would be greatly appreciated, thank you in advance.
_______________________________________________