Skip to content

DIPSAS/operator-helm-gen

Repository files navigation

operator-helm-gen

Very simple app for making resources created by operator-sdk ready for inclusion in Helm templates.

"Very simple" means:

  • RoleBinding, Role and other namespaced K8s RBAC resources generated by operator-sdk get their hard-coded namespace element(s) templatable.
  • The resulting files are named following the pattern resource_type-resource_name.yaml.

Using

The program uses stdin for delivering the payload (example below). The input must be in YAML format, with the separator --- between each resource.

In addition, the program accepts the following command line arguments:

  • keep: The resource types to inspect and generate for if found in the payload.
  • dir: The directory to place the generated YAML files. If empty, stdout is used. The program does NOT check if the directory exists.
  • version: Prints the version (if used with go install) and exits.

Example usage:

GOBIN=$(pwd)/bin
go install github.com/DIPSAS/operator-helm-gen/cmd/operator-helm-gen@v0.1.2

mkdir -p /some-dir/generated
./bin/kustomize build config/default | ./bin/operator-helm-gen --dir /some-dir/generated --keep ClusterRoleBinding,RoleBinding,CustomResourceDefinition,Role,ClusterRole
cp -a /some-dir/generated/. /path/to/helm-templates
rm -rf /some-dir/generated