1 // Copyright 2019 The Kubernetes Authors. 2 // SPDX-License-Identifier: Apache-2.0 3 4 // Package starlark contains a kio.Filter which can be applied to resources to transform 5 // them through starlark program. 6 // 7 // Starlark has become a popular runtime embedding in go programs, especially for Kubernetes 8 // and data processing. 9 // Examples: https://github.com/cruise-automation/isopod, https://qri.io/docs/starlark/starlib, 10 // https://github.com/stripe/skycfg, https://github.com/k14s/ytt 11 // 12 // The resources are provided to the starlark program through the global variable "resourceList". 13 // "resourceList" is a dictionary containing an "items" field with a list of resources. 14 // The starlark modified "resourceList" is the Filter output. 15 // 16 // After being run through the starlark program, the filter will copy the comments from the input 17 // resources to restore them -- due to them being dropped as a result of serializing the resources 18 // as starlark values. 19 // 20 // "resourceList" may also contain a "functionConfig" entry to configure the starlark script itself. 21 // Changes made by the starlark program to the "functionConfig" will be reflected in the 22 // Filter.FunctionConfig value. 23 // 24 // The Filter will also format the output so that output has the preferred field ordering 25 // rather than an alphabetical field ordering. 26 // 27 // The resourceList variable adheres to the kustomize function spec as specified by: 28 // https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md 29 // 30 // All items in the resourceList are resources represented as starlark dictionaries/ 31 // The items in the resourceList respect the io spec specified by: 32 // https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/config-io.md 33 // 34 // The starlark language spec can be found here: 35 // https://github.com/google/starlark-go/blob/master/doc/spec.md 36 package starlark 37