diff --git a/api/doc.go b/api/doc.go new file mode 100644 index 0000000000..2e130028f1 --- /dev/null +++ b/api/doc.go @@ -0,0 +1,20 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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 apis contains the kpt API type definitions. +package apis + +//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.21.0 object:headerFile="../hack/boilerplate.go.txt",year=$YEAR_GEN applyconfiguration:headerFile="../hack/boilerplate.go.txt" paths=./... +// Drop generated helpers that pull in k8s.io/apimachinery; typed ACs are enough. +//go:generate rm -rf generated/applyconfigurations/utils.go generated/applyconfigurations/internal diff --git a/api/fnresult/v1/types.go b/api/fnresult/v1/types.go index 9d118f6f57..01d7ac1c57 100644 --- a/api/fnresult/v1/types.go +++ b/api/fnresult/v1/types.go @@ -13,6 +13,9 @@ // limitations under the License. // +kubebuilder:object:generate=true +// +kubebuilder:ac:generate=true +// +kubebuilder:ac:output:package=../../generated/applyconfigurations +// +groupName=kpt.dev package v1 import ( @@ -25,8 +28,6 @@ import ( "sigs.k8s.io/kustomize/kyaml/yaml" ) -//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.21.0 object:headerFile="../../../hack/boilerplate.go.txt",year=$YEAR_GEN - // Result contains the structured result from an individual function type Result struct { // Image is the full name of the image that generates this result @@ -69,6 +70,7 @@ func ResultListGVK() schema.GroupVersionKind { } // ResultList contains aggregated results from multiple functions +// +kubebuilder:ac:generate=true type ResultList struct { yaml.ResourceMeta `yaml:",inline"` // ExitCode is the exit code of kpt command diff --git a/api/generated/applyconfigurations/fnresult/v1/field.go b/api/generated/applyconfigurations/fnresult/v1/field.go new file mode 100644 index 0000000000..cc911950f5 --- /dev/null +++ b/api/generated/applyconfigurations/fnresult/v1/field.go @@ -0,0 +1,58 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// FieldApplyConfiguration represents a declarative configuration of the Field type for use +// with apply. +// +// Field is a modified version of sigs.k8s.io/kustomize/kyaml/fn/framework.Field +// where CurrentValue and ProposedValue are strings instead of the original any type. +type FieldApplyConfiguration struct { + Path *string `json:"path,omitempty"` + CurrentValue *string `json:"currentValue,omitempty"` + ProposedValue *string `json:"proposedValue,omitempty"` +} + +// FieldApplyConfiguration constructs a declarative configuration of the Field type for use with +// apply. +func Field() *FieldApplyConfiguration { + return &FieldApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *FieldApplyConfiguration) WithPath(value string) *FieldApplyConfiguration { + b.Path = &value + return b +} + +// WithCurrentValue sets the CurrentValue field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentValue field is set to the value of the last call. +func (b *FieldApplyConfiguration) WithCurrentValue(value string) *FieldApplyConfiguration { + b.CurrentValue = &value + return b +} + +// WithProposedValue sets the ProposedValue field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProposedValue field is set to the value of the last call. +func (b *FieldApplyConfiguration) WithProposedValue(value string) *FieldApplyConfiguration { + b.ProposedValue = &value + return b +} diff --git a/api/generated/applyconfigurations/fnresult/v1/resultitem.go b/api/generated/applyconfigurations/fnresult/v1/resultitem.go new file mode 100644 index 0000000000..4cbd887c49 --- /dev/null +++ b/api/generated/applyconfigurations/fnresult/v1/resultitem.go @@ -0,0 +1,96 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + framework "sigs.k8s.io/kustomize/kyaml/fn/framework" + yaml "sigs.k8s.io/kustomize/kyaml/yaml" +) + +// ResultItemApplyConfiguration represents a declarative configuration of the ResultItem type for use +// with apply. +// +// ResultItem is a modified version of sigs.k8s.io/kustomize/kyaml/fn/framework.Result +// with a simplified Field field. +type ResultItemApplyConfiguration struct { + Message *string `json:"message,omitempty"` + Severity *framework.Severity `json:"severity,omitempty"` + ResourceRef *yaml.ResourceIdentifier `json:"resourceRef,omitempty"` + Field *FieldApplyConfiguration `json:"field,omitempty"` + File *framework.File `json:"file,omitempty"` + Tags map[string]string `json:"tags,omitempty"` +} + +// ResultItemApplyConfiguration constructs a declarative configuration of the ResultItem type for use with +// apply. +func ResultItem() *ResultItemApplyConfiguration { + return &ResultItemApplyConfiguration{} +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ResultItemApplyConfiguration) WithMessage(value string) *ResultItemApplyConfiguration { + b.Message = &value + return b +} + +// WithSeverity sets the Severity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Severity field is set to the value of the last call. +func (b *ResultItemApplyConfiguration) WithSeverity(value framework.Severity) *ResultItemApplyConfiguration { + b.Severity = &value + return b +} + +// WithResourceRef sets the ResourceRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceRef field is set to the value of the last call. +func (b *ResultItemApplyConfiguration) WithResourceRef(value yaml.ResourceIdentifier) *ResultItemApplyConfiguration { + b.ResourceRef = &value + return b +} + +// WithField sets the Field field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Field field is set to the value of the last call. +func (b *ResultItemApplyConfiguration) WithField(value *FieldApplyConfiguration) *ResultItemApplyConfiguration { + b.Field = value + return b +} + +// WithFile sets the File field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the File field is set to the value of the last call. +func (b *ResultItemApplyConfiguration) WithFile(value framework.File) *ResultItemApplyConfiguration { + b.File = &value + return b +} + +// WithTags puts the entries into the Tags field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Tags field, +// overwriting an existing map entries in Tags field with the same key. +func (b *ResultItemApplyConfiguration) WithTags(entries map[string]string) *ResultItemApplyConfiguration { + if b.Tags == nil && len(entries) > 0 { + b.Tags = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Tags[k] = v + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/condition.go b/api/generated/applyconfigurations/kptfile/v1/condition.go new file mode 100644 index 0000000000..fc357e137f --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/condition.go @@ -0,0 +1,68 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + kptfilev1 "github.com/kptdev/kpt/api/kptfile/v1" +) + +// ConditionApplyConfiguration represents a declarative configuration of the Condition type for use +// with apply. +type ConditionApplyConfiguration struct { + Type *string `json:"type,omitempty"` + Status *kptfilev1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ConditionApplyConfiguration constructs a declarative configuration of the Condition type for use with +// apply. +func Condition() *ConditionApplyConfiguration { + return &ConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithType(value string) *ConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithStatus(value kptfilev1.ConditionStatus) *ConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithReason(value string) *ConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ConditionApplyConfiguration) WithMessage(value string) *ConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/function.go b/api/generated/applyconfigurations/kptfile/v1/function.go new file mode 100644 index 0000000000..8fca78ed05 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/function.go @@ -0,0 +1,159 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// FunctionApplyConfiguration represents a declarative configuration of the Function type for use +// with apply. +// +// Function specifies a KRM function. +type FunctionApplyConfiguration struct { + // `Image` specifies the function container image. + // It can either be fully qualified, e.g.: + // + // image: ghcr.io/kptdev/krm-functions-catalog/set-labels + // + // Optionally, kpt can be configured to use a image + // registry host-path that will be used to resolve the image path in case + // the image path is missing (Defaults to ghcr.io/kptdev/krm-functions-catalog). + // e.g. The following resolves to ghcr.io/kptdev/krm-functions-catalog/set-labels + // + // image: set-labels + Image *string `json:"image,omitempty"` + // Exec specifies the function binary executable. + // The executable can be fully qualified or it must exists in the $PATH e.g: + // + // exec: set-namespace + // exec: /usr/local/bin/my-custom-fn + Exec *string `json:"exec,omitempty"` + // `ConfigPath` specifies a slash-delimited relative path to a file in the current directory + // containing a KRM resource used as the function config. The function will + // not see this resource in its input items — it is passed as configuration + // only. Other functions in the pipeline can still see and modify the file. + ConfigPath *string `json:"configPath,omitempty"` + // `ConfigMap` is a convenient way to specify a function config of kind ConfigMap. + ConfigMap map[string]string `json:"configMap,omitempty"` + // `ConfigRef` references an existing resource in the package as the function config. + // The resource is identified by apiVersion, kind, and name. This is mutually exclusive + // with `configPath` and `configMap`. + ConfigRef *ResourceReferenceApplyConfiguration `json:"configRef,omitempty"` + // `Name` is used to uniquely identify the function declaration + // this is primarily used for merging function declaration with upstream counterparts + Name *string `json:"name,omitempty"` + // `Tag` is an optional field for specifying/overriding the tag of the function image. + // Can be a semver constraint satisfying this spec: https://github.com/Masterminds/semver?tab=readme-ov-file#checking-version-constraints + Tag *string `json:"tag,omitempty"` + // `Selectors` are used to specify resources on which the function should be executed + // if not specified, all resources are selected + Selectors []SelectorApplyConfiguration `json:"selectors,omitempty"` + // `Exclude` are used to specify resources on which the function should NOT be executed. + // If not specified, all resources selected by `Selectors` are selected. + Exclusions []SelectorApplyConfiguration `json:"exclude,omitempty"` +} + +// FunctionApplyConfiguration constructs a declarative configuration of the Function type for use with +// apply. +func Function() *FunctionApplyConfiguration { + return &FunctionApplyConfiguration{} +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *FunctionApplyConfiguration) WithImage(value string) *FunctionApplyConfiguration { + b.Image = &value + return b +} + +// WithExec sets the Exec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Exec field is set to the value of the last call. +func (b *FunctionApplyConfiguration) WithExec(value string) *FunctionApplyConfiguration { + b.Exec = &value + return b +} + +// WithConfigPath sets the ConfigPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigPath field is set to the value of the last call. +func (b *FunctionApplyConfiguration) WithConfigPath(value string) *FunctionApplyConfiguration { + b.ConfigPath = &value + return b +} + +// WithConfigMap puts the entries into the ConfigMap field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the ConfigMap field, +// overwriting an existing map entries in ConfigMap field with the same key. +func (b *FunctionApplyConfiguration) WithConfigMap(entries map[string]string) *FunctionApplyConfiguration { + if b.ConfigMap == nil && len(entries) > 0 { + b.ConfigMap = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ConfigMap[k] = v + } + return b +} + +// WithConfigRef sets the ConfigRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigRef field is set to the value of the last call. +func (b *FunctionApplyConfiguration) WithConfigRef(value *ResourceReferenceApplyConfiguration) *FunctionApplyConfiguration { + b.ConfigRef = value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *FunctionApplyConfiguration) WithName(value string) *FunctionApplyConfiguration { + b.Name = &value + return b +} + +// WithTag sets the Tag field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Tag field is set to the value of the last call. +func (b *FunctionApplyConfiguration) WithTag(value string) *FunctionApplyConfiguration { + b.Tag = &value + return b +} + +// WithSelectors adds the given value to the Selectors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Selectors field. +func (b *FunctionApplyConfiguration) WithSelectors(values ...*SelectorApplyConfiguration) *FunctionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSelectors") + } + b.Selectors = append(b.Selectors, *values[i]) + } + return b +} + +// WithExclusions adds the given value to the Exclusions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Exclusions field. +func (b *FunctionApplyConfiguration) WithExclusions(values ...*SelectorApplyConfiguration) *FunctionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithExclusions") + } + b.Exclusions = append(b.Exclusions, *values[i]) + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/genericlock.go b/api/generated/applyconfigurations/kptfile/v1/genericlock.go new file mode 100644 index 0000000000..93b07fdd16 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/genericlock.go @@ -0,0 +1,63 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// GenericLockApplyConfiguration represents a declarative configuration of the GenericLock type for use +// with apply. +// +// GenericLock is a minimal locator for a package stored in a generic storage backend. +type GenericLockApplyConfiguration struct { + // StoreID is a descriptor of the underlying storage type. + // e.g. 'DB' for database + StoreID *string `json:"storeID,omitempty"` + // ResourceID is a unique identifier of the resource. + // The format depends on the underlying storage. + ResourceID *string `json:"resourceID,omitempty"` + // ResourceVersion indicates the last fetched version of the resource. + // The format depends on the underlying storage. + ResourceVersion *string `json:"resourceVersion,omitempty"` +} + +// GenericLockApplyConfiguration constructs a declarative configuration of the GenericLock type for use with +// apply. +func GenericLock() *GenericLockApplyConfiguration { + return &GenericLockApplyConfiguration{} +} + +// WithStoreID sets the StoreID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoreID field is set to the value of the last call. +func (b *GenericLockApplyConfiguration) WithStoreID(value string) *GenericLockApplyConfiguration { + b.StoreID = &value + return b +} + +// WithResourceID sets the ResourceID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceID field is set to the value of the last call. +func (b *GenericLockApplyConfiguration) WithResourceID(value string) *GenericLockApplyConfiguration { + b.ResourceID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *GenericLockApplyConfiguration) WithResourceVersion(value string) *GenericLockApplyConfiguration { + b.ResourceVersion = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/git.go b/api/generated/applyconfigurations/kptfile/v1/git.go new file mode 100644 index 0000000000..2cc32ccc69 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/git.go @@ -0,0 +1,62 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// GitApplyConfiguration represents a declarative configuration of the Git type for use +// with apply. +// +// Git is the user-specified locator for a package on Git. +type GitApplyConfiguration struct { + // Repo is the git repository the package. + // e.g. 'https://github.com/kubernetes/examples.git' + Repo *string `json:"repo,omitempty"` + // Directory is the sub directory of the git repository. + // e.g. 'staging/cockroachdb' + Directory *string `json:"directory,omitempty"` + // Ref can be a Git branch, tag, or a commit SHA-1. + Ref *string `json:"ref,omitempty"` +} + +// GitApplyConfiguration constructs a declarative configuration of the Git type for use with +// apply. +func Git() *GitApplyConfiguration { + return &GitApplyConfiguration{} +} + +// WithRepo sets the Repo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Repo field is set to the value of the last call. +func (b *GitApplyConfiguration) WithRepo(value string) *GitApplyConfiguration { + b.Repo = &value + return b +} + +// WithDirectory sets the Directory field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Directory field is set to the value of the last call. +func (b *GitApplyConfiguration) WithDirectory(value string) *GitApplyConfiguration { + b.Directory = &value + return b +} + +// WithRef sets the Ref field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ref field is set to the value of the last call. +func (b *GitApplyConfiguration) WithRef(value string) *GitApplyConfiguration { + b.Ref = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/gitlock.go b/api/generated/applyconfigurations/kptfile/v1/gitlock.go new file mode 100644 index 0000000000..f6ddb65d3c --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/gitlock.go @@ -0,0 +1,74 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// GitLockApplyConfiguration represents a declarative configuration of the GitLock type for use +// with apply. +// +// GitLock is the resolved locator for a package on Git. +type GitLockApplyConfiguration struct { + // Repo is the git repository that was fetched. + // e.g. 'https://github.com/kubernetes/examples.git' + Repo *string `json:"repo,omitempty"` + // Directory is the sub directory of the git repository that was fetched. + // e.g. 'staging/cockroachdb' + Directory *string `json:"directory,omitempty"` + // Ref can be a Git branch, tag, or a commit SHA-1 that was fetched. + // e.g. 'master' + Ref *string `json:"ref,omitempty"` + // Commit is the SHA-1 for the last fetch of the package. + // This is set by kpt for bookkeeping purposes. + Commit *string `json:"commit,omitempty"` +} + +// GitLockApplyConfiguration constructs a declarative configuration of the GitLock type for use with +// apply. +func GitLock() *GitLockApplyConfiguration { + return &GitLockApplyConfiguration{} +} + +// WithRepo sets the Repo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Repo field is set to the value of the last call. +func (b *GitLockApplyConfiguration) WithRepo(value string) *GitLockApplyConfiguration { + b.Repo = &value + return b +} + +// WithDirectory sets the Directory field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Directory field is set to the value of the last call. +func (b *GitLockApplyConfiguration) WithDirectory(value string) *GitLockApplyConfiguration { + b.Directory = &value + return b +} + +// WithRef sets the Ref field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ref field is set to the value of the last call. +func (b *GitLockApplyConfiguration) WithRef(value string) *GitLockApplyConfiguration { + b.Ref = &value + return b +} + +// WithCommit sets the Commit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Commit field is set to the value of the last call. +func (b *GitLockApplyConfiguration) WithCommit(value string) *GitLockApplyConfiguration { + b.Commit = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/inventory.go b/api/generated/applyconfigurations/kptfile/v1/inventory.go new file mode 100644 index 0000000000..573b1bcb5d --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/inventory.go @@ -0,0 +1,91 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// InventoryApplyConfiguration represents a declarative configuration of the Inventory type for use +// with apply. +// +// Inventory encapsulates the parameters for the inventory resource applied to a cluster. +// All of the the parameters are required if any are set. +type InventoryApplyConfiguration struct { + // Namespace for the inventory resource. + Namespace *string `json:"namespace,omitempty"` + // Name of the inventory resource. + Name *string `json:"name,omitempty"` + // Unique label to identify inventory resource in cluster. + InventoryID *string `json:"inventoryID,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` +} + +// InventoryApplyConfiguration constructs a declarative configuration of the Inventory type for use with +// apply. +func Inventory() *InventoryApplyConfiguration { + return &InventoryApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *InventoryApplyConfiguration) WithNamespace(value string) *InventoryApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *InventoryApplyConfiguration) WithName(value string) *InventoryApplyConfiguration { + b.Name = &value + return b +} + +// WithInventoryID sets the InventoryID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InventoryID field is set to the value of the last call. +func (b *InventoryApplyConfiguration) WithInventoryID(value string) *InventoryApplyConfiguration { + b.InventoryID = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *InventoryApplyConfiguration) WithLabels(entries map[string]string) *InventoryApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *InventoryApplyConfiguration) WithAnnotations(entries map[string]string) *InventoryApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/locator.go b/api/generated/applyconfigurations/kptfile/v1/locator.go new file mode 100644 index 0000000000..0fc4acc64f --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/locator.go @@ -0,0 +1,64 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + kptfilev1 "github.com/kptdev/kpt/api/kptfile/v1" +) + +// LocatorApplyConfiguration represents a declarative configuration of the Locator type for use +// with apply. +// +// Locator is a resolved locator for the last fetch of the package. +type LocatorApplyConfiguration struct { + // Type is the type of origin. + Type *kptfilev1.OriginType `json:"type,omitempty"` + // Git is the resolved locator for a package on Git. + Git *GitLockApplyConfiguration `json:"git,omitempty"` + // Generic is a minimal locator for a package stored in some generic storage type (e.g.: a database) + Generic *GenericLockApplyConfiguration `json:"generic,omitempty"` +} + +// LocatorApplyConfiguration constructs a declarative configuration of the Locator type for use with +// apply. +func Locator() *LocatorApplyConfiguration { + return &LocatorApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *LocatorApplyConfiguration) WithType(value kptfilev1.OriginType) *LocatorApplyConfiguration { + b.Type = &value + return b +} + +// WithGit sets the Git field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Git field is set to the value of the last call. +func (b *LocatorApplyConfiguration) WithGit(value *GitLockApplyConfiguration) *LocatorApplyConfiguration { + b.Git = value + return b +} + +// WithGeneric sets the Generic field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generic field is set to the value of the last call. +func (b *LocatorApplyConfiguration) WithGeneric(value *GenericLockApplyConfiguration) *LocatorApplyConfiguration { + b.Generic = value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/packageinfo.go b/api/generated/applyconfigurations/kptfile/v1/packageinfo.go new file mode 100644 index 0000000000..1d791d4cc7 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/packageinfo.go @@ -0,0 +1,121 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// PackageInfoApplyConfiguration represents a declarative configuration of the PackageInfo type for use +// with apply. +// +// PackageInfo contains optional information about the package such as license, documentation, etc. +// These fields are not consumed by any functionality in kpt and are simply passed through. +// Note that like any other KRM resource, humans and automation can also use `metadata.labels` and +// `metadata.annotations` as the extension mechanism. +type PackageInfoApplyConfiguration struct { + // Site is the URL for package web page. + Site *string `json:"site,omitempty"` + // Email is the list of emails for the package authors. + Emails []string `json:"emails,omitempty"` + // SPDX license identifier (e.g. "Apache-2.0"). See: https://spdx.org/licenses/ + License *string `json:"license,omitempty"` + // Relative slash-delimited path to the license file (e.g. LICENSE.txt) + LicenseFile *string `json:"licenseFile,omitempty"` + // Description contains a short description of the package. + Description *string `json:"description,omitempty"` + // Keywords is a list of keywords for this package. + Keywords []string `json:"keywords,omitempty"` + // Man is the path to documentation about the package + Man *string `json:"man,omitempty"` + ReadinessGates []ReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` +} + +// PackageInfoApplyConfiguration constructs a declarative configuration of the PackageInfo type for use with +// apply. +func PackageInfo() *PackageInfoApplyConfiguration { + return &PackageInfoApplyConfiguration{} +} + +// WithSite sets the Site field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Site field is set to the value of the last call. +func (b *PackageInfoApplyConfiguration) WithSite(value string) *PackageInfoApplyConfiguration { + b.Site = &value + return b +} + +// WithEmails adds the given value to the Emails field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Emails field. +func (b *PackageInfoApplyConfiguration) WithEmails(values ...string) *PackageInfoApplyConfiguration { + for i := range values { + b.Emails = append(b.Emails, values[i]) + } + return b +} + +// WithLicense sets the License field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the License field is set to the value of the last call. +func (b *PackageInfoApplyConfiguration) WithLicense(value string) *PackageInfoApplyConfiguration { + b.License = &value + return b +} + +// WithLicenseFile sets the LicenseFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LicenseFile field is set to the value of the last call. +func (b *PackageInfoApplyConfiguration) WithLicenseFile(value string) *PackageInfoApplyConfiguration { + b.LicenseFile = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *PackageInfoApplyConfiguration) WithDescription(value string) *PackageInfoApplyConfiguration { + b.Description = &value + return b +} + +// WithKeywords adds the given value to the Keywords field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Keywords field. +func (b *PackageInfoApplyConfiguration) WithKeywords(values ...string) *PackageInfoApplyConfiguration { + for i := range values { + b.Keywords = append(b.Keywords, values[i]) + } + return b +} + +// WithMan sets the Man field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Man field is set to the value of the last call. +func (b *PackageInfoApplyConfiguration) WithMan(value string) *PackageInfoApplyConfiguration { + b.Man = &value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *PackageInfoApplyConfiguration) WithReadinessGates(values ...*ReadinessGateApplyConfiguration) *PackageInfoApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/pipeline.go b/api/generated/applyconfigurations/kptfile/v1/pipeline.go new file mode 100644 index 0000000000..4fe038fda0 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/pipeline.go @@ -0,0 +1,61 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// PipelineApplyConfiguration represents a declarative configuration of the Pipeline type for use +// with apply. +// +// Pipeline declares a pipeline of functions used to mutate or validate resources. +type PipelineApplyConfiguration struct { + // Mutators defines a list of of KRM functions that mutate resources. + Mutators []FunctionApplyConfiguration `json:"mutators,omitempty"` + // Validators defines a list of KRM functions that validate resources. + // Validators are not permitted to mutate resources. + Validators []FunctionApplyConfiguration `json:"validators,omitempty"` +} + +// PipelineApplyConfiguration constructs a declarative configuration of the Pipeline type for use with +// apply. +func Pipeline() *PipelineApplyConfiguration { + return &PipelineApplyConfiguration{} +} + +// WithMutators adds the given value to the Mutators field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Mutators field. +func (b *PipelineApplyConfiguration) WithMutators(values ...*FunctionApplyConfiguration) *PipelineApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMutators") + } + b.Mutators = append(b.Mutators, *values[i]) + } + return b +} + +// WithValidators adds the given value to the Validators field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Validators field. +func (b *PipelineApplyConfiguration) WithValidators(values ...*FunctionApplyConfiguration) *PipelineApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithValidators") + } + b.Validators = append(b.Validators, *values[i]) + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/pipelinestepresult.go b/api/generated/applyconfigurations/kptfile/v1/pipelinestepresult.go new file mode 100644 index 0000000000..5cd26d865c --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/pipelinestepresult.go @@ -0,0 +1,111 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + fnresultv1 "github.com/kptdev/kpt/api/fnresult/v1" +) + +// PipelineStepResultApplyConfiguration represents a declarative configuration of the PipelineStepResult type for use +// with apply. +// +// PipelineStepResult contains the structured result from an individual function +// call in the pipeline. +type PipelineStepResultApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Image *string `json:"image,omitempty"` + ExecPath *string `json:"exec,omitempty"` + ExecutionError *string `json:"executionError,omitempty"` + Stderr *string `json:"stderr,omitempty"` + ExitCode *int `json:"exitCode,omitempty"` + Results []fnresultv1.ResultItem `json:"results,omitempty"` + ErrorResults []fnresultv1.ResultItem `json:"errorResults,omitempty"` +} + +// PipelineStepResultApplyConfiguration constructs a declarative configuration of the PipelineStepResult type for use with +// apply. +func PipelineStepResult() *PipelineStepResultApplyConfiguration { + return &PipelineStepResultApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PipelineStepResultApplyConfiguration) WithName(value string) *PipelineStepResultApplyConfiguration { + b.Name = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *PipelineStepResultApplyConfiguration) WithImage(value string) *PipelineStepResultApplyConfiguration { + b.Image = &value + return b +} + +// WithExecPath sets the ExecPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExecPath field is set to the value of the last call. +func (b *PipelineStepResultApplyConfiguration) WithExecPath(value string) *PipelineStepResultApplyConfiguration { + b.ExecPath = &value + return b +} + +// WithExecutionError sets the ExecutionError field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExecutionError field is set to the value of the last call. +func (b *PipelineStepResultApplyConfiguration) WithExecutionError(value string) *PipelineStepResultApplyConfiguration { + b.ExecutionError = &value + return b +} + +// WithStderr sets the Stderr field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Stderr field is set to the value of the last call. +func (b *PipelineStepResultApplyConfiguration) WithStderr(value string) *PipelineStepResultApplyConfiguration { + b.Stderr = &value + return b +} + +// WithExitCode sets the ExitCode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExitCode field is set to the value of the last call. +func (b *PipelineStepResultApplyConfiguration) WithExitCode(value int) *PipelineStepResultApplyConfiguration { + b.ExitCode = &value + return b +} + +// WithResults adds the given value to the Results field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Results field. +func (b *PipelineStepResultApplyConfiguration) WithResults(values ...fnresultv1.ResultItem) *PipelineStepResultApplyConfiguration { + for i := range values { + b.Results = append(b.Results, values[i]) + } + return b +} + +// WithErrorResults adds the given value to the ErrorResults field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ErrorResults field. +func (b *PipelineStepResultApplyConfiguration) WithErrorResults(values ...fnresultv1.ResultItem) *PipelineStepResultApplyConfiguration { + for i := range values { + b.ErrorResults = append(b.ErrorResults, values[i]) + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/readinessgate.go b/api/generated/applyconfigurations/kptfile/v1/readinessgate.go new file mode 100644 index 0000000000..ffcfeabf94 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/readinessgate.go @@ -0,0 +1,37 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// ReadinessGateApplyConfiguration represents a declarative configuration of the ReadinessGate type for use +// with apply. +type ReadinessGateApplyConfiguration struct { + ConditionType *string `json:"conditionType,omitempty"` +} + +// ReadinessGateApplyConfiguration constructs a declarative configuration of the ReadinessGate type for use with +// apply. +func ReadinessGate() *ReadinessGateApplyConfiguration { + return &ReadinessGateApplyConfiguration{} +} + +// WithConditionType sets the ConditionType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConditionType field is set to the value of the last call. +func (b *ReadinessGateApplyConfiguration) WithConditionType(value string) *ReadinessGateApplyConfiguration { + b.ConditionType = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/renderstatus.go b/api/generated/applyconfigurations/kptfile/v1/renderstatus.go new file mode 100644 index 0000000000..11c2baaff8 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/renderstatus.go @@ -0,0 +1,68 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// RenderStatusApplyConfiguration represents a declarative configuration of the RenderStatus type for use +// with apply. +// +// RenderStatus represents the result of performing render operation +// on a package's resources. +type RenderStatusApplyConfiguration struct { + MutationSteps []PipelineStepResultApplyConfiguration `json:"mutationSteps,omitempty"` + ValidationSteps []PipelineStepResultApplyConfiguration `json:"validationSteps,omitempty"` + ErrorSummary *string `json:"errorSummary,omitempty"` +} + +// RenderStatusApplyConfiguration constructs a declarative configuration of the RenderStatus type for use with +// apply. +func RenderStatus() *RenderStatusApplyConfiguration { + return &RenderStatusApplyConfiguration{} +} + +// WithMutationSteps adds the given value to the MutationSteps field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MutationSteps field. +func (b *RenderStatusApplyConfiguration) WithMutationSteps(values ...*PipelineStepResultApplyConfiguration) *RenderStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMutationSteps") + } + b.MutationSteps = append(b.MutationSteps, *values[i]) + } + return b +} + +// WithValidationSteps adds the given value to the ValidationSteps field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ValidationSteps field. +func (b *RenderStatusApplyConfiguration) WithValidationSteps(values ...*PipelineStepResultApplyConfiguration) *RenderStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithValidationSteps") + } + b.ValidationSteps = append(b.ValidationSteps, *values[i]) + } + return b +} + +// WithErrorSummary sets the ErrorSummary field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ErrorSummary field is set to the value of the last call. +func (b *RenderStatusApplyConfiguration) WithErrorSummary(value string) *RenderStatusApplyConfiguration { + b.ErrorSummary = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/resourcereference.go b/api/generated/applyconfigurations/kptfile/v1/resourcereference.go new file mode 100644 index 0000000000..146bdcedc0 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/resourcereference.go @@ -0,0 +1,72 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// ResourceReferenceApplyConfiguration represents a declarative configuration of the ResourceReference type for use +// with apply. +// +// ResourceReference identifies a resource within the package by its API identity. +type ResourceReferenceApplyConfiguration struct { + // APIVersion of the referenced resource (e.g. "v1"). Optional; when omitted, + // matches resources regardless of apiVersion. + APIVersion *string `json:"apiVersion,omitempty"` + // Kind of the referenced resource (e.g. "ConfigMap"). Required. + Kind *string `json:"kind,omitempty"` + // Name of the referenced resource. Required. + Name *string `json:"name,omitempty"` + // Namespace of the referenced resource. Optional; when omitted, matches + // resources regardless of namespace. + Namespace *string `json:"namespace,omitempty"` +} + +// ResourceReferenceApplyConfiguration constructs a declarative configuration of the ResourceReference type for use with +// apply. +func ResourceReference() *ResourceReferenceApplyConfiguration { + return &ResourceReferenceApplyConfiguration{} +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceReferenceApplyConfiguration) WithAPIVersion(value string) *ResourceReferenceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceReferenceApplyConfiguration) WithKind(value string) *ResourceReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceReferenceApplyConfiguration) WithName(value string) *ResourceReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceReferenceApplyConfiguration) WithNamespace(value string) *ResourceReferenceApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/selector.go b/api/generated/applyconfigurations/kptfile/v1/selector.go new file mode 100644 index 0000000000..2136f81afa --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/selector.go @@ -0,0 +1,103 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// SelectorApplyConfiguration represents a declarative configuration of the Selector type for use +// with apply. +// +// Selector specifies the selection criteria +// please update IsEmpty method if more properties are added +type SelectorApplyConfiguration struct { + // APIVersion of the target resources + APIVersion *string `json:"apiVersion,omitempty"` + // Kind of the target resources + Kind *string `json:"kind,omitempty"` + // Name of the target resources + Name *string `json:"name,omitempty"` + // Namespace of the target resources + Namespace *string `json:"namespace,omitempty"` + // Labels on the target resources + Labels map[string]string `json:"labels,omitempty"` + // Annotations on the target resources + Annotations map[string]string `json:"annotations,omitempty"` +} + +// SelectorApplyConfiguration constructs a declarative configuration of the Selector type for use with +// apply. +func Selector() *SelectorApplyConfiguration { + return &SelectorApplyConfiguration{} +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *SelectorApplyConfiguration) WithAPIVersion(value string) *SelectorApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *SelectorApplyConfiguration) WithKind(value string) *SelectorApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SelectorApplyConfiguration) WithName(value string) *SelectorApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *SelectorApplyConfiguration) WithNamespace(value string) *SelectorApplyConfiguration { + b.Namespace = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *SelectorApplyConfiguration) WithLabels(entries map[string]string) *SelectorApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *SelectorApplyConfiguration) WithAnnotations(entries map[string]string) *SelectorApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/status.go b/api/generated/applyconfigurations/kptfile/v1/status.go new file mode 100644 index 0000000000..069ebbc3c8 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/status.go @@ -0,0 +1,51 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// StatusApplyConfiguration represents a declarative configuration of the Status type for use +// with apply. +type StatusApplyConfiguration struct { + Conditions []ConditionApplyConfiguration `json:"conditions,omitempty"` + RenderStatus *RenderStatusApplyConfiguration `json:"renderStatus,omitempty"` +} + +// StatusApplyConfiguration constructs a declarative configuration of the Status type for use with +// apply. +func Status() *StatusApplyConfiguration { + return &StatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *StatusApplyConfiguration) WithConditions(values ...*ConditionApplyConfiguration) *StatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithRenderStatus sets the RenderStatus field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RenderStatus field is set to the value of the last call. +func (b *StatusApplyConfiguration) WithRenderStatus(value *RenderStatusApplyConfiguration) *StatusApplyConfiguration { + b.RenderStatus = value + return b +} diff --git a/api/generated/applyconfigurations/kptfile/v1/upstream.go b/api/generated/applyconfigurations/kptfile/v1/upstream.go new file mode 100644 index 0000000000..9a839fb7b6 --- /dev/null +++ b/api/generated/applyconfigurations/kptfile/v1/upstream.go @@ -0,0 +1,64 @@ +// Copyright 2026 The kpt Authors +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + kptfilev1 "github.com/kptdev/kpt/api/kptfile/v1" +) + +// UpstreamApplyConfiguration represents a declarative configuration of the Upstream type for use +// with apply. +// +// Upstream is a user-specified upstream locator for a package. +type UpstreamApplyConfiguration struct { + // Type is the type of origin. + Type *kptfilev1.OriginType `json:"type,omitempty"` + // Git is the locator for a package stored on Git. + Git *GitApplyConfiguration `json:"git,omitempty"` + // UpdateStrategy declares how a package will be updated from upstream. + UpdateStrategy *kptfilev1.UpdateStrategyType `json:"updateStrategy,omitempty"` +} + +// UpstreamApplyConfiguration constructs a declarative configuration of the Upstream type for use with +// apply. +func Upstream() *UpstreamApplyConfiguration { + return &UpstreamApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *UpstreamApplyConfiguration) WithType(value kptfilev1.OriginType) *UpstreamApplyConfiguration { + b.Type = &value + return b +} + +// WithGit sets the Git field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Git field is set to the value of the last call. +func (b *UpstreamApplyConfiguration) WithGit(value *GitApplyConfiguration) *UpstreamApplyConfiguration { + b.Git = value + return b +} + +// WithUpdateStrategy sets the UpdateStrategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdateStrategy field is set to the value of the last call. +func (b *UpstreamApplyConfiguration) WithUpdateStrategy(value kptfilev1.UpdateStrategyType) *UpstreamApplyConfiguration { + b.UpdateStrategy = &value + return b +} diff --git a/api/go.mod b/api/go.mod index 282a2327ef..387f166a19 100644 --- a/api/go.mod +++ b/api/go.mod @@ -20,6 +20,7 @@ require ( github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/spf13/pflag v1.0.9 // indirect github.com/xlab/treeprint v1.2.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect @@ -28,6 +29,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect - sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) diff --git a/api/go.sum b/api/go.sum index 84f50d971d..ce03967a33 100644 --- a/api/go.sum +++ b/api/go.sum @@ -47,8 +47,8 @@ github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -80,8 +80,8 @@ k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hk k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/kustomize/kyaml v0.21.1 h1:IVlbmhC076nf6foyL6Taw4BkrLuEsXUXNpsE+ScX7fI= sigs.k8s.io/kustomize/kyaml v0.21.1/go.mod h1:hmxADesM3yUN2vbA5z1/YTBnzLJ1dajdqpQonwBL1FQ= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= diff --git a/api/kptfile/v1/types.go b/api/kptfile/v1/types.go index 6d19810f34..f3719cea21 100644 --- a/api/kptfile/v1/types.go +++ b/api/kptfile/v1/types.go @@ -16,6 +16,9 @@ // Version: v1 // swagger:meta // +kubebuilder:object:generate=true +// +kubebuilder:ac:generate=true +// +kubebuilder:ac:output:package=../../generated/applyconfigurations +// +groupName=kpt.dev package v1 import ( @@ -27,8 +30,6 @@ import ( "sigs.k8s.io/kustomize/kyaml/yaml" ) -//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.21.0 object:headerFile="../../../hack/boilerplate.go.txt",year=$YEAR_GEN - const ( KptFileName = "Kptfile" @@ -68,6 +69,7 @@ var TypeMeta = yaml.ResourceMeta{ // KptFile contains information about a package managed with kpt. // swagger:model kptfile +// +kubebuilder:ac:generate=true type KptFile struct { yaml.ResourceMeta `yaml:",inline" json:",inline"` diff --git a/api/schema/v1/group_version.go b/api/schema/v1/group_version.go index d40915deb9..c6283b2e53 100644 --- a/api/schema/v1/group_version.go +++ b/api/schema/v1/group_version.go @@ -25,8 +25,6 @@ import ( "strings" ) -//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.21.0 object:headerFile="../../../hack/boilerplate.go.txt",year=$YEAR_GEN - // ParseResourceArg takes the common style of string which may be either `resource.group.com` or `resource.version.group.com` // and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended // but with a knowledge of all GroupVersions, calling code can take a very good guess. If there are only two segments, then