View Source mix kubegen (kubegen v0.1.2)
(Re-)Generates clients for Kubernetes resources according to the config.
Configuration
Prior to running this Mix task, you need to create a configuration in your
config.exs
under config :kubegen, :default
or config :kubegen, :mycluster
.
where a custom :mycluster
identifier is passed as argument
(mix kubegen -c mycluster
)
:module_prefix
- The prefix of the generated modules (e.g.MyApp.K8sClient
):kubeconfig_pipeline
- ThePluggable
pipeline responsible for loading the Kubernetes config. (e.g.Kubereq.Kubeconfig.Default
):resources
- List of resources for which clients are generated.
The entries of :resources
can be in the form of
- Group-Version-Kind in the case of Kubernetes core resources.
- Path to a local CRD YAML (multiple CRDs in one file are supported)
- URL to a public remote CRD Yaml (multiple CRDs in one file are supported)
Example
config :kubegen, :default,
module_prefix: MyApp.K8sClient,
kubeconfig_pipeline: Kubereq.Kubeconfig.Default,
resources: [
"v1/ConfigMap",
"rbac.authorization.k8s.io/v1/ClusterRole",
"test/support/foos.example.com.yaml", # local CRD
"https://raw.githubusercontent.com/mruoss/kompost/main/priv/manifest/postgresdatabase.crd.yaml" # public remote CRD
]
How to find the correct Group-Version-Kind identifier
Use mix kubegen.search
to search for GVKs (e.g. mix.kubegen.search Pod
)