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
- func CreateClient(config *rest.Config) (client.Client, error)
- func CreateClientWithFlags(flags *genericclioptions.ConfigFlags) (client.Client, error)
- func CreateV1Alpha2Client(config *rest.Config) (client.Client, error)
- func CreateV1Alpha2ClientWithFlags(flags *genericclioptions.ConfigFlags) (client.Client, error)
- func GetAPIVersion(cmd *cobra.Command) string
- func IsV1Alpha2(cmd *cobra.Command) bool
- func LastSegment(path string) string
- func UpdatePackageRevisionApproval(ctx context.Context, client client.Client, pr *porchapi.PackageRevision, ...) error
- func UpdatePackageRevisionApprovalV1Alpha2(ctx context.Context, c client.Client, pr *porchv1alpha2.PackageRevision, ...) error
- func WrapVersionDispatch(cmd *cobra.Command, v2PreRunE, v2RunE RunFunc)
- type RunFunc
Constants ¶
const ( APIVersionV1Alpha1 = "v1alpha1" APIVersionV1Alpha2 = "v1alpha2" EnvAPIVersion = "PORCHCTL_API_VERSION" FlagAPIVersion = "api-version" )
const ApproveErrorOut = "cannot change approval from %s to %s"
const HidePorchCommands = false
Controls whether the Package Orchestration CLI commands are hidden.
Variables ¶
This section is empty.
Functions ¶
func CreateClientWithFlags ¶
func CreateClientWithFlags(flags *genericclioptions.ConfigFlags) (client.Client, error)
func CreateV1Alpha2Client ¶ added in v1.6.0
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
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
IsV1Alpha2 is a convenience check.
func LastSegment ¶
func UpdatePackageRevisionApproval ¶
func UpdatePackageRevisionApproval(ctx context.Context, client client.Client, pr *porchapi.PackageRevision, new porchapi.PackageRevisionLifecycle) error
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
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.