Top 1.0% dependent packages on proxy.golang.org
Top 1.2% dependent repos on proxy.golang.org
Top 3.9% forks on proxy.golang.org
Top 1.6% docker downloads on proxy.golang.org
proxy.golang.org : github.com/GoogleContainerTools/kpt-functions-sdk/go/fn
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
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/%21google%21container%21tools/kpt-functions-sdk/go/fn
License: Apache-2.0
Latest release: about 2 years ago
First release: about 3 years ago
Namespace: github.com/GoogleContainerTools/kpt-functions-sdk/go
Dependent packages: 91
Dependent repositories: 22
Stars: 51 on GitHub
Forks: 36 on GitHub
Docker dependents: 27
Docker downloads: 345,979,140
See more repository details: repos.ecosyste.ms
Last synced: 30 days ago