airshipctl/krm-functions/replacement-transformer/main.go
Dmitry Ukov d783d71f05 Introduce Replacement Transformer plugin container
Relates-To: #341
Change-Id: I65a5b8cf3bcf94321fc02f240b1d8075bca45c0c
2020-10-16 16:00:56 +04:00

33 lines
767 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"
"opendev.org/airship/airshipctl/pkg/document/plugin/replacement"
)
func main() {
cfg := make(map[string]interface{})
resourceList := &framework.ResourceList{FunctionConfig: &cfg}
cmd := framework.Command(resourceList, func() error {
plugin, err := replacement.New(cfg)
if err != nil {
return err
}
resourceList.Items, err = plugin.Filter(resourceList.Items)
return err
})
if err := cmd.Execute(); err != nil {
fmt.Fprint(os.Stderr, err)
os.Exit(1)
}
}