mirror of
https://github.com/fluxcd/flux2.git
synced 2026-04-30 15:18:51 +00:00
Validates components set
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com> Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
parent
ed09dd57b6
commit
dd0b807fe4
4 changed files with 24 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -380,3 +381,15 @@ func PrintTable(writer io.Writer, header []string, rows [][]string) {
|
|||
table.AppendBulk(rows)
|
||||
table.Render()
|
||||
}
|
||||
|
||||
func ValidateComponents(components []string) error {
|
||||
defaults := install.MakeDefaultOptions()
|
||||
bootstrapAllComponents := append(defaults.Components, defaults.ComponentsExtra...)
|
||||
for _, component := range components {
|
||||
if !ContainsItemString(bootstrapAllComponents, component) {
|
||||
return fmt.Errorf("component %s is not available", component)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue