kpt-functions-sdk icon indicating copy to clipboard operation
kpt-functions-sdk copied to clipboard

Improve functionRunner interface

Open yuwenma opened this issue 3 years ago • 1 comments

  • Update items from []*KubeObject to KubeObjects. This aligns the resourceList.items with the latest change in https://github.com/GoogleContainerTools/kpt-functions-sdk/commit/78748f08d9977e08b5cf2dd678d04ed22d209a75#diff-7b055320c11f07c233d6db3fec422e3059d52a0f295a12e02b489aa4a539a50d
  • functionRunner can parse functionConfig value for ConfigMap.Data and custom functionConfig in two formats

For example, a SetLabel struct that implements Runner interface, have its Owner and Org value automatically parsed from either 1. SetLabels type with owner and org fields or 2. ConfigMap type with Data fields having keys owner and org

type SetLabels struct {
	Owner string
	Org   string
}

FunctionConfig 1

apiVersion:  fn.kpt.dev/v1alpha1
kind: SetLabel
metadata:
   name: custom
owner: kpt
org: google

FunctionConfig 2

apiVersion: v1
kind: ConfigMap
metadata:
   name: custom
data:
  owner: kpt 
  org: google

yuwenma avatar Jun 29 '22 00:06 yuwenma

cc @zyy98

yuwenma avatar Jun 29 '22 00:06 yuwenma