An open API service indexing awesome lists of open source software.

https://github.com/operator-framework/combo


https://github.com/operator-framework/combo

Last synced: 8 months ago
JSON representation

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 <