1 // Package fn defines the function interface that GItOps functions will 2 // implement to make them easily runnable by both the Chariot web server and Kpt 3 // binary. 4 package fn 5 6 import "sigs.k8s.io/kustomize/kyaml/yaml" 7 8 // Function is the interface that our GitOps functions must implement to integrate 9 // with both Kpt (ran via command line) and Chariot (ran via HTTP). 10 // 11 // It is provided (and outputs) a *yaml.RNode slice representing all of 12 // the yaml files in the repository. 13 // 14 // Input and output of the function must contain a `kioutil.PathAnnotation` annotation set 15 // to the yaml file's relative path in the repository. Failure to provide path annotations 16 // will cause the function to return an error. 17 type Function interface { 18 Run([]*yaml.RNode) ([]*yaml.RNode, error) 19 } 20