porch

package
v1.5.12 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: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Values for secret types supported by porch.
	BasicAuthType            = core.SecretTypeBasicAuth
	WorkloadIdentityAuthType = "kpt.dev/workload-identity-auth"

	// Annotation used to specify the gsa for a ksa.
	WIGCPSAAnnotation = "iam.gke.io/gcp-service-account"

	// Secret.Data key required for the caBundle
	CaBundleDataName = "ca.crt"

	// Secret.Data key required for bearer token authentication
	TokenDataName = "bearerToken"
)
View Source
const ConflictErrorMsgBase = "another request is already in progress %s"

Variables

View Source
var GenericConflictErrorMsg = fmt.Sprintf(ConflictErrorMsgBase, "on %s \"%s\"")
View Source
var (
	PrFilterFieldMappings = map[porchapi.PkgRevFieldSelector]prFilterFieldMappingFunc{
		porchapi.PkgRevSelectorName: func(f *repository.ListPackageRevisionFilter, name string) error {
			var err error
			if filterKey, err := repository.PkgRevK8sName2Key("", name); err == nil {
				f.Key = filterKey
			}
			return err
		},
		porchapi.PkgRevSelectorNamespace: func(f *repository.ListPackageRevisionFilter, namespace string) error {
			f.Key.PkgKey.RepoKey.Namespace = namespace
			return nil
		},
		porchapi.PkgRevSelectorRevision: func(f *repository.ListPackageRevisionFilter, strRevision string) error {
			f.Key.Revision = repository.Revision2Int(strRevision)
			return nil
		},
		porchapi.PkgRevSelectorPackageName: func(f *repository.ListPackageRevisionFilter, fullPkgName string) error {
			split := strings.Split(fullPkgName, "/")
			if len(split) > 1 {
				f.Key.PkgKey.Package = split[len(split)-1]
				f.Key.PkgKey.Path = strings.Join(split[0:len(split)-1], "/")
			} else {
				f.Key.PkgKey.Package = fullPkgName
			}
			return nil
		},
		porchapi.PkgRevSelectorRepository: func(f *repository.ListPackageRevisionFilter, repoName string) error {
			f.Key.PkgKey.RepoKey.Name = repoName
			return nil
		},
		porchapi.PkgRevSelectorWorkspaceName: func(f *repository.ListPackageRevisionFilter, workspaceName string) error {
			f.Key.WorkspaceName = workspaceName
			return nil
		},
		porchapi.PkgRevSelectorLifecycle: func(f *repository.ListPackageRevisionFilter, lifecycle string) error {
			var err error
			l := porchapi.PackageRevisionLifecycle(lifecycle)
			if l.IsValid() {
				f.Lifecycles = append(f.Lifecycles, l)
			} else {
				err = apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q", lifecycle, porchapi.PkgRevSelectorLifecycle))
			}
			return err
		},
	}
)

Functions

func NewCredentialResolver

func NewCredentialResolver(coreClient client.Reader, resolverChain []Resolver) repository.CredentialResolver

func NewReferenceResolver

func NewReferenceResolver(coreClient client.Reader) repository.ReferenceResolver

func ParseRepositoryName

func ParseRepositoryName(name string) (string, error)

func RunBackground

func RunBackground(ctx context.Context, coreClient client.WithWatch, cache cachetypes.Cache, options ...BackgroundOption)

Types

type ApiserverUserInfoProvider

type ApiserverUserInfoProvider struct{}

func (*ApiserverUserInfoProvider) GetUserInfo

type BackgroundOption

type BackgroundOption interface {
	// contains filtered or unexported methods
}

func WithListTimeoutPerRepo

func WithListTimeoutPerRepo(timeout time.Duration) BackgroundOption

func WithMaxConcurrentLists

func WithMaxConcurrentLists(maxList int) BackgroundOption

func WithPeriodicRepoSyncFrequency

func WithPeriodicRepoSyncFrequency(period time.Duration) BackgroundOption

func WithRepoOperationRetryAttempts

func WithRepoOperationRetryAttempts(count int) BackgroundOption

type BasicAuthCredential

type BasicAuthCredential struct {
	Username string
	Password string // #nosec G117
}

func (*BasicAuthCredential) ToAuthMethod

func (b *BasicAuthCredential) ToAuthMethod() transport.AuthMethod

func (*BasicAuthCredential) ToString

func (b *BasicAuthCredential) ToString() string

func (*BasicAuthCredential) Valid

func (b *BasicAuthCredential) Valid() bool

type BasicAuthResolver

type BasicAuthResolver struct{}

func (*BasicAuthResolver) Resolve

type BearerTokenAuthCredentials

type BearerTokenAuthCredentials struct {
	BearerToken string // #nosec G117
}

func (*BearerTokenAuthCredentials) ToAuthMethod

func (*BearerTokenAuthCredentials) ToString

func (b *BearerTokenAuthCredentials) ToString() string

func (*BearerTokenAuthCredentials) Valid

func (b *BearerTokenAuthCredentials) Valid() bool

type BearerTokenAuthResolver

type BearerTokenAuthResolver struct{}

func (*BearerTokenAuthResolver) Resolve

type CaBundleCredential

type CaBundleCredential struct {
	CaBundle string
}

func (*CaBundleCredential) ToAuthMethod

func (c *CaBundleCredential) ToAuthMethod() transport.AuthMethod

func (*CaBundleCredential) ToString

func (c *CaBundleCredential) ToString() string

func (*CaBundleCredential) Valid

func (c *CaBundleCredential) Valid() bool

type CaBundleResolver

type CaBundleResolver struct{}

func (*CaBundleResolver) Resolve

type CircuitBreakerError

type CircuitBreakerError struct {
	Err error
}

func (*CircuitBreakerError) Error

func (cbe *CircuitBreakerError) Error() string

func (*CircuitBreakerError) Unwrap

func (cbe *CircuitBreakerError) Unwrap() error

type GcloudWICredential

type GcloudWICredential struct {
	// contains filtered or unexported fields
}

func (*GcloudWICredential) ToAuthMethod

func (b *GcloudWICredential) ToAuthMethod() transport.AuthMethod

func (*GcloudWICredential) ToString

func (b *GcloudWICredential) ToString() string

func (*GcloudWICredential) Valid

func (b *GcloudWICredential) Valid() bool

type GcloudWIResolver

type GcloudWIResolver struct {
	// contains filtered or unexported fields
}

func (*GcloudWIResolver) Resolve

type NoMatchingResolverError

type NoMatchingResolverError struct {
	Type string
}

func (*NoMatchingResolverError) Error

func (e *NoMatchingResolverError) Error() string

func (*NoMatchingResolverError) Is

func (e *NoMatchingResolverError) Is(err error) bool

type NoopUpdateStrategy

type NoopUpdateStrategy struct{}

func (NoopUpdateStrategy) Canonicalize

func (s NoopUpdateStrategy) Canonicalize(obj runtime.Object)

func (NoopUpdateStrategy) PrepareForUpdate

func (s NoopUpdateStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object)

func (NoopUpdateStrategy) ValidateUpdate

func (s NoopUpdateStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList

type RESTStorageOptions

type RESTStorageOptions struct {
	Scheme     *runtime.Scheme
	Codecs     serializer.CodecFactory
	CaD        engine.CaDEngine
	CoreClient client.WithWatch
}

func (*RESTStorageOptions) NewRESTStorage

func (r *RESTStorageOptions) NewRESTStorage() (genericapiserver.APIGroupInfo, error)

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, secret core.Secret) (repository.Credential, bool, error)
}

func NewBasicAuthResolver

func NewBasicAuthResolver() Resolver

func NewBearerTokenAuthResolver

func NewBearerTokenAuthResolver() Resolver

Bearer Token Secret Verification

func NewCaBundleResolver

func NewCaBundleResolver() Resolver

func NewGcloudWIResolver

func NewGcloudWIResolver(corev1Client *corev1client.CoreV1Client, stsClient *stsv1.Service) Resolver

type SimpleRESTCreateStrategy

type SimpleRESTCreateStrategy interface {
	// Validate returns an ErrorList with validation errors or nil.  Validate
	// is invoked after default fields in the object have been filled in
	// before the object is persisted.  This method should not mutate the
	// object.
	Validate(ctx context.Context, obj runtime.Object) field.ErrorList
}

SimpleRESTCreateStrategy is similar to rest.RESTCreateStrategy, though only contains methods currently required.

type SimpleRESTUpdateStrategy

type SimpleRESTUpdateStrategy interface {
	PrepareForUpdate(ctx context.Context, obj, old runtime.Object)
	ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList
	Canonicalize(obj runtime.Object)
}

SimpleRESTUpdateStrategy is similar to rest.RESTUpdateStrategy, though only contains methods currently required.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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