Documentation
¶
Index ¶
Constants ¶
const ( // ConfigMapAPIVersion represents the API version for the ConfigMap resource. ConfigMapAPIVersion = "v1" // ConfigMapKind represents the kind of resource for the ConfigMap resource. ConfigMapKind = "ConfigMap" // DefaultProgramName is the default name for the KCL function program. DefaultProgramName = "kcl-function-run" // AnnotationAllowInSecureSource represents the annotation key for allowing insecure sources in KCLRun. AnnotationAllowInSecureSource = "krm.kcl.dev/allow-insecure-source" )
const ( SrcUrlEnvVar = "KCL_SRC_URL" SrcUrlUsernameEnvVar = "KCL_SRC_USERNAME" SrcUrlPasswordEnvVar = "KCL_SRC_PASSWORD" )
Variables ¶
This section is empty.
Functions ¶
func MatchResourceRules ¶ added in v0.9.1
func MatchResourceRules(obj *kube.KubeObject, MatchConstraints *api.MatchConstraintsSpec) bool
MatchResourceRules checks if the given Kubernetes object matches the resource rules specified in KCLRun.
Types ¶
type KCLRun ¶
type KCLRun struct { yaml.ResourceMeta `json:",inline" yaml:",inline"` // Spec is the KCLRun spec. Spec struct { // Source is a required field for providing a KCL script inline. Source string `json:"source" yaml:"source"` // Config is the compile config. Config api.ConfigSpec `json:"config,omitempty" yaml:"config,omitempty"` // Credentials for remote locations Credentials api.CredSpec `json:"credentials,omitempty" yaml:"credentials,omitempty"` // Params are the parameters in key-value pairs format. Params map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"` // MatchConstraints defines the resource matching rules. MatchConstraints api.MatchConstraintsSpec `json:"matchConstraints,omitempty" yaml:"matchConstraints,omitempty"` // Dependencies are the external dependencies for the KCL code. // The format of the `dependencies` field is same as the `[dependencies]` in the `kcl.mod` file Dependencies string `json:"dependencies,omitempty" yaml:"dependencies,omitempty"` } `json:"spec" yaml:"spec"` }
KCLRun is a custom resource to provider KPT `functionConfig`, KCL source and params.
func NewV1Alpha1 ¶ added in v0.9.1
func NewV1Alpha1() *KCLRun
NewV1Alpha1 returns a default a KCLRun resource with the v1alpha1 version.
func (*KCLRun) Config ¶
func (r *KCLRun) Config(o *kube.KubeObject) error
Config is used to configure the KCLRun instance based on the given FunctionConfig. It converts ConfigMap to KCLRun or assigns values directly from KCLRun. If an error occurs during the configuration process, an error message will be returned.
func (*KCLRun) InsecureFlag ¶ added in v0.10.0
InsecureFlag returns the insecure flag `"krm.kcl.dev/allow-insecure-source"`
func (*KCLRun) Transform ¶
Transform is used to transform the input nodes with the KCLRun instance and function config.
func (*KCLRun) TransformResourceList ¶ added in v0.9.1
func (r *KCLRun) TransformResourceList(rl *kube.ResourceList) error
TransformResourceList is used to transform the ResourceList with the KCLRun instance. It parses the FunctionConfig and each object in the ResourceList, transforms them according to the KCLRun configuration, and updates the ResourceList with the transformed objects. If an error occurs during the transformation process, an error message will be returned.