proxy.golang.org : github.com/GoogleContainerTools/kpt-functions-sdk/go/fn : v0.0.0-20230213175341-4cb31eb17c8c
Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package fn provides the SDK to write KRM functions. This fn SDK requires some basic KRM function Specification knowledge. To make the best usage of your time, we recommend you to be familiar with "ResourceList" before moving forward. See KRM Function Specification reference in https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md A KRM function can mutate and/or validate Kubernetes resources in a ResourceList. The ResourceList type and the KubeObject type are the core parts of this package. The ResourceList type maps to the ResourceList in the function spec. Read more about how to use KRM functions in https://kpt.dev/book/04-using-functions/ Read more about how to develop a KRM function in https://kpt.dev/book/05-developing-functions/ A general workflow is: The KubeObject is the basic unit to perform operations on KRM resources. In the "AsMain", both "Items" and "FunctionConfig" are converted to the KubeObject(s). If you are familiar with unstructured.Unstructured, using KubeObject is as simple as using unstructured.Unstructured. You can call function like `NestedStringOrDie` `SetNestedStringMap`, etc. Except that KubeObject will not have pass-in interface arguments, nor will return an interface. Instead, you shall treat each KubeObject field (slice, or non-string map)as SubObject. SubObject also have most of the KubeObject methods, except the MetaType or NameType specific methods like "GetNamespace", "SetLabel". This is because SubObject is designed as a sub object of KubeObject. SubObject to KubeObject is like `spec` section to `Deployment`. You can get the Deployment name from `metadata.name`, KubeObject.GetName() or KubeObject.NestedString("metadata", "name"). But you cannot get "metadata.name" from a Deployment "spec". For "spec" SubObject, you can get the ".replicas" field by SubObject.NestedInt64("replicas") Besides unstructured style, another way to use KubeObject is to purely work on the KubeObject/SubObject by calling "GetMap", "GetSlice", "UpsertMap" which expects the return to be SubObject(s) pointer. "AsMain" is the main entrypoint. In most cases, you only need to provide the mutator or validation logic and have AsMain handles the ResourceList parsing, KRM resource field type detection, read from STDIN and write to STDOUT. "AsMain" accepts a struct that either implement the ResourceListProcessor interface or Runner interface. See github.com/GoogleContainerTools/kpt-functions-sdk/go/fn/examples for detailed usage. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Registry -
Documentation -
Download -
JSON
purl: pkg:golang/github.com/%21google%21container%21tools/kpt-functions-sdk/go/[email protected]
Published:
Indexed:
- github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20220720212527-133180134b93
- github.com/PuerkitoBio/purell v1.1.1
- github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
- github.com/davecgh/go-spew v1.1.1
- github.com/go-errors/errors v1.0.1
- github.com/go-logr/logr v1.2.0
- github.com/go-openapi/jsonpointer v0.19.5
- github.com/go-openapi/jsonreference v0.19.6
- github.com/go-openapi/swag v0.21.1
- github.com/gogo/protobuf v1.3.2
- github.com/golang/protobuf v1.5.2
- github.com/google/gnostic v0.5.7-v3refs
- github.com/google/go-cmp v0.5.9
- github.com/josharian/intern v1.0.0
- github.com/kr/pretty v0.3.0
- github.com/mailru/easyjson v0.7.7
- github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
- github.com/pkg/errors v0.9.1
- github.com/pmezard/go-difflib v1.0.0
- github.com/rogpeppe/go-internal v1.9.0
- github.com/stretchr/testify v1.8.0
- github.com/xlab/treeprint v1.1.0
- golang.org/x/net v0.0.0-20220722155237-a158d28d115b
- golang.org/x/text v0.3.7
- google.golang.org/protobuf v1.28.0
- gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
- gopkg.in/yaml.v2 v2.4.0
- gopkg.in/yaml.v3 v3.0.1
- k8s.io/apimachinery v0.24.0
- k8s.io/klog/v2 v2.60.1
- k8s.io/kube-openapi v0.0.0-20220401212409-b28bf2818661
- sigs.k8s.io/kustomize/kyaml v0.13.7-0.20220418212550-9d5491c2e20c
- sigs.k8s.io/yaml v1.3.0