https://github.com/operator-framework/combo
https://github.com/operator-framework/combo
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/operator-framework/combo
- Owner: operator-framework
- License: apache-2.0
- Created: 2021-09-29T17:04:25.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T15:34:21.000Z (over 3 years ago)
- Last Synced: 2025-03-23T23:27:11.200Z (9 months ago)
- Language: Go
- Size: 170 KB
- Stars: 8
- Watchers: 15
- Forks: 15
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# combo
`combo` is a [Kubernetes controller](https://kubernetes.io/docs/concepts/architecture/controller/) that generates and applies resources for __all combinations__ of a manifest template and its arguments.
## What on earth does "all combinations" mean!?
For example, say `combo` is given a template containing 1 _parameter_ -- i.e. distinct token to replaced -- and 2 _arguments_ for that parameter (value to replace a parameter with), then `combo` will output 2 _evaluations_ (one for each argument).
e.g.
_template:_
```yaml
PARAM_1
```
_arguments:_
```
PARAM_1:
- a
- b
```
_evaluations:_
```yaml
---
a
---
b
```
Simple enough, right? What about something more advanced...
Suppose we give `combo` a template with 2 parameters and 3 arguments for each parameter.
e.g.
_template:_
```yaml
PARAM_1: PARAM_2
```
_arguments:_
```yaml
PARAM_1:
- a
- b
PARAM_2:
- c
- d
- e
```
_evaluations:_
```yaml
---
a: c
---
a: d
---
a: e
---
b: c
---
b: d
---
b: e
```
## Wait, can't Helm do this?
It could, __but__ getting this experience from Helm would require:
- the use of nested Go Template loops
- carrying along the rest of the ecosystem; e.g. I don't want to think about Helm charts for something this simple
## Can I generate combinations locally?
Yes! There is a built in CLI interaction via the binary. Let's look at the same example we used for the controller in this context.
First, create a simple YAML file that defines two arguments.
```yaml
# ./sample_input.yaml
PARAM_1: PARAM_2
```
Next, go ahead and run the `eval` subcommand.
```shell
make build-cli
./combo eval -r PARAM_1=a,b -r PARAM_2=c,d,e sample_input.yaml
```
This will run the same logic that the controller utilizes to generate combinations and output them to stdout. The above command will produce the following:
```yaml
---
a: c
---
a: d
---
a: e
---
b: c
---
b: d
---
b: e
```
## Primary use cases
To parameterize RBAC and other namespace-scoped resources so they can be stamped out as necessary later on.
```shell
$ cat <