airshipctl/krm-functions/replacement-transformer/main.go
Alexey Odinokov 37c2854cce Switching airshipctl and krm-functions to kustomize 4.2.0
Reworked build process of dependent krm functions
to use the latest airshipctl

Change-Id: If4c7f992123b86442980f381ae69fb003f4851e3
2021-07-22 17:06:32 +00:00

37 lines
852 B
Go

// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// Package main implements an injection function for resource reservations and
// is run with `kustomize config run -- DIR/`.
package main
import (
"fmt"
"os"
"sigs.k8s.io/kustomize/kyaml/fn/framework"
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
"opendev.org/airship/airshipctl/pkg/document/plugin/replacement"
)
func main() {
fn := func(rl *framework.ResourceList) error {
cfg, err := rl.FunctionConfig.Map()
if err != nil {
return err
}
plugin, err := replacement.New(cfg)
if err != nil {
return err
}
rl.Items, err = plugin.Filter(rl.Items)
return err
}
cmd := command.Build(framework.ResourceListProcessorFunc(fn), command.StandaloneEnabled, false)
if err := cmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}