porch

package
v1.6.0-pre1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2022 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.

Index

Constants

View Source
const (
	APIVersionV1Alpha1 = "v1alpha1"
	APIVersionV1Alpha2 = "v1alpha2"
	EnvAPIVersion      = "PORCHCTL_API_VERSION"
	FlagAPIVersion     = "api-version"
)
View Source
const ApproveErrorOut = "cannot change approval from %s to %s"
View Source
const HidePorchCommands = false

Controls whether the Package Orchestration CLI commands are hidden.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, api client.Client, obj client.Object) error

func CreateClient

func CreateClient(config *rest.Config) (client.Client, error)

func CreateClientWithFlags

func CreateClientWithFlags(flags *genericclioptions.ConfigFlags) (client.Client, error)

func CreateDynamicClient

func CreateDynamicClient(flags *genericclioptions.ConfigFlags) (client.WithWatch, error)

func CreateRESTClient

func CreateRESTClient(flags *genericclioptions.ConfigFlags) (rest.Interface, error)

controller-runtime does not support subresources so we use REST client directly. TODO: Separate Porch clientset into its own module (similar to k8s clientsets) to use it without causing circular reference.

func CreateV1Alpha2Client added in v1.6.0

func CreateV1Alpha2Client(config *rest.Config) (client.Client, error)

CreateV1Alpha2Client creates a controller-runtime client for v1alpha2.

func CreateV1Alpha2ClientWithFlags added in v1.6.0

func CreateV1Alpha2ClientWithFlags(flags *genericclioptions.ConfigFlags) (client.Client, error)

CreateV1Alpha2ClientWithFlags creates a controller-runtime client that maps PackageRevision to porch.kpt.dev/v1alpha2 (CRD) while keeping PackageRevisionResources at porch.kpt.dev/v1alpha1 (APIService).

func GetAPIVersion added in v1.6.0

func GetAPIVersion(cmd *cobra.Command) string

GetAPIVersion returns the API version from the command's persistent flag or the PORCHCTL_API_VERSION environment variable. Defaults to v1alpha1.

func IsV1Alpha2 added in v1.6.0

func IsV1Alpha2(cmd *cobra.Command) bool

IsV1Alpha2 is a convenience check.

func LastSegment

func LastSegment(path string) string

func UpdatePackageRevisionApprovalV1Alpha2 added in v1.6.0

func UpdatePackageRevisionApprovalV1Alpha2(ctx context.Context, c client.Client, pr *porchv1alpha2.PackageRevision, new porchv1alpha2.PackageRevisionLifecycle) error

UpdatePackageRevisionApprovalV1Alpha2 approves or rejects a v1alpha2 PackageRevision. CRDs don't support custom subresources, so this uses a regular Update.

func WrapVersionDispatch added in v1.6.0

func WrapVersionDispatch(cmd *cobra.Command, v2PreRunE, v2RunE RunFunc)

WrapVersionDispatch wraps a cobra.Command so that PreRunE and RunE dispatch to v1alpha2 implementations when --api-version=v1alpha2. The original (v1alpha1) PreRunE/RunE are preserved as the default path.

Types

type RunFunc added in v1.6.0

type RunFunc func(cmd *cobra.Command, args []string) error

RunFunc is the signature for cobra PreRunE/RunE.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL