Add values to flux (untested yet)
This commit is contained in:
parent
beef71b128
commit
c02e61d676
@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"git.badhouseplants.net/allanger/shoebill/internal/utils/githelper"
|
"git.badhouseplants.net/allanger/shoebill/internal/utils/githelper"
|
||||||
kustomize_types "sigs.k8s.io/kustomize/api/types"
|
kustomize_types "sigs.k8s.io/kustomize/api/types"
|
||||||
@ -39,18 +38,22 @@ func (k *Kusmtomize) PopulateResources(path string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *Kusmtomize) CmGeneratorFromFiles() ([]kustomize_types.ConfigMapArgs, error) {
|
func (k *Kusmtomize) CmGeneratorFromFiles() []kustomize_types.ConfigMapArgs {
|
||||||
cmGens := []kustomize_types.ConfigMapArgs{}
|
cmGens := []kustomize_types.ConfigMapArgs{}
|
||||||
for _, cm := range k.ConfigMaps {
|
for _, cm := range k.ConfigMaps {
|
||||||
cmName :=
|
cmName := filepath.Base(cm)
|
||||||
cmGen := &kustomize_types.ConfigMapArgs{
|
cmGen := &kustomize_types.ConfigMapArgs{
|
||||||
GeneratorArgs: kustomize_types.GeneratorArgs{
|
GeneratorArgs: kustomize_types.GeneratorArgs{
|
||||||
Namespace: "flux-system",
|
Namespace: "flux-system",
|
||||||
Name: "",
|
Name: cmName,
|
||||||
|
KvPairSources: kustomize_types.KvPairSources{
|
||||||
|
FileSources: []string{cm},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
cmGens = append(cmGens, *cmGen)
|
||||||
}
|
}
|
||||||
|
return cmGens
|
||||||
}
|
}
|
||||||
|
|
||||||
func Generate(path string, gh githelper.Githelper) error {
|
func Generate(path string, gh githelper.Githelper) error {
|
||||||
@ -62,7 +65,7 @@ func Generate(path string, gh githelper.Githelper) error {
|
|||||||
kustomization := kustomize_types.Kustomization{
|
kustomization := kustomize_types.Kustomization{
|
||||||
TypeMeta: kustomize_types.TypeMeta{
|
TypeMeta: kustomize_types.TypeMeta{
|
||||||
Kind: kustomize_types.KustomizationKind,
|
Kind: kustomize_types.KustomizationKind,
|
||||||
APIVersion: kustomize_types.ComponentVersion,
|
APIVersion: kustomize_types.KustomizationVersion,
|
||||||
},
|
},
|
||||||
MetaData: &kustomize_types.ObjectMeta{
|
MetaData: &kustomize_types.ObjectMeta{
|
||||||
Name: "helm-root",
|
Name: "helm-root",
|
||||||
@ -72,7 +75,7 @@ func Generate(path string, gh githelper.Githelper) error {
|
|||||||
GeneratorOptions: &kustomize_types.GeneratorOptions{
|
GeneratorOptions: &kustomize_types.GeneratorOptions{
|
||||||
DisableNameSuffixHash: true,
|
DisableNameSuffixHash: true,
|
||||||
},
|
},
|
||||||
ConfigMapGenerator: []kustomize_types.ConfigMapArgs{},
|
ConfigMapGenerator: kustomize.CmGeneratorFromFiles(),
|
||||||
}
|
}
|
||||||
manifest, err := yaml.Marshal(kustomization)
|
manifest, err := yaml.Marshal(kustomization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user