v1beta1

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package v1beta1 contains API Schema definitions for the appstudio v1beta1 API group +kubebuilder:object:generate=true +groupName=appstudio.redhat.com

Index

Constants

View Source
const (
	ServiceProviderTypeLabel = "spi.appstudio.redhat.com/service-provider-type"
	ServiceProviderHostLabel = "spi.appstudio.redhat.com/service-provider-host"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "appstudio.redhat.com", Version: "v1beta1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type Permission

type Permission struct {
	// Type is the type of the permission required
	Type PermissionType `json:"type"`

	// Area express the "area" in the service provider scopes to which the permission is required.
	Area PermissionArea `json:"area"`
}

Permission is an element of Permissions and express a requirement on the service provider scopes in an agnostic manner.

func (*Permission) DeepCopy

func (in *Permission) DeepCopy() *Permission

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Permission.

func (*Permission) DeepCopyInto

func (in *Permission) DeepCopyInto(out *Permission)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PermissionArea

type PermissionArea string

PermissionArea defines a set of the supported permission areas. A service provider implementation might not support all of them depending on the capabilities of the service provider (e.g. if a service provider doesn't support webhooks, it doesn't make sense to specify permissions in the webhook area).

const (
	PermissionAreaRepository PermissionArea = "repository"
	PermissionAreaWebhooks   PermissionArea = "webhooks"
	PermissionAreaUser       PermissionArea = "user"
)

type PermissionType

type PermissionType string

PermissionType expresses whether we need a permission to read or write data in a specific PermissionArea of the service provider

const (
	PermissionTypeRead      PermissionType = "r"
	PermissionTypeWrite     PermissionType = "w"
	PermissionTypeReadWrite PermissionType = "rw"
)

func (PermissionType) IsRead

func (pt PermissionType) IsRead() bool

IsRead returns true if the permission type requires read access to the service provider.

func (PermissionType) IsWrite

func (pt PermissionType) IsWrite() bool

IsWrite returns true if the permission type requires write access to the service provider.

type Permissions

type Permissions struct {
	Required         []Permission `json:"required,omitempty"`
	AdditionalScopes []string     `json:"additionalScopes,omitempty"`
}

Permissions is a collection of operator-defined permissions (which are translated to service-provider-specific scopes) and potentially additional service-provider-specific scopes that are not covered by the operator defined abstraction. The permissions are used in SPIAccessTokenBinding objects to express the requirements on the tokens as well as in the SPIAccessToken objects to express the "capabilities" of the token.

func (*Permissions) DeepCopy

func (in *Permissions) DeepCopy() *Permissions

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Permissions.

func (*Permissions) DeepCopyInto

func (in *Permissions) DeepCopyInto(out *Permissions)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SPIAccessToken

type SPIAccessToken struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SPIAccessTokenSpec   `json:"spec,omitempty"`
	Status SPIAccessTokenStatus `json:"status,omitempty"`
}

SPIAccessToken is the Schema for the spiaccesstokens API

func (*SPIAccessToken) DeepCopy

func (in *SPIAccessToken) DeepCopy() *SPIAccessToken

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessToken.

func (*SPIAccessToken) DeepCopyInto

func (in *SPIAccessToken) DeepCopyInto(out *SPIAccessToken)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SPIAccessToken) DeepCopyObject

func (in *SPIAccessToken) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*SPIAccessToken) EnsureLabels added in v0.3.0

func (t *SPIAccessToken) EnsureLabels(detectedType ServiceProviderType) (changed bool)

EnsureLabels makes sure that the object has labels set according to its spec. The labels are used for faster lookup during token matching with bindings. Returns `true` if the labels were changed, `false` otherwise.

type SPIAccessTokenBinding

type SPIAccessTokenBinding struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SPIAccessTokenBindingSpec   `json:"spec,omitempty"`
	Status SPIAccessTokenBindingStatus `json:"status,omitempty"`
}

SPIAccessTokenBinding is the Schema for the spiaccesstokenbindings API

func (*SPIAccessTokenBinding) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenBinding.

func (*SPIAccessTokenBinding) DeepCopyInto

func (in *SPIAccessTokenBinding) DeepCopyInto(out *SPIAccessTokenBinding)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SPIAccessTokenBinding) DeepCopyObject

func (in *SPIAccessTokenBinding) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SPIAccessTokenBindingErrorReason

type SPIAccessTokenBindingErrorReason string
const (
	SPIAccessTokenBindingErrorReasonUnknownServiceProviderType SPIAccessTokenBindingErrorReason = "UnknownServiceProviderType"
	SPIAccessTokenBindingErrorReasonTokenLookup                SPIAccessTokenBindingErrorReason = "TokenLookup"
	SPIAccessTokenBindingErrorReasonLinkedToken                SPIAccessTokenBindingErrorReason = "LinkedToken"
	SPIAccessTokenBindingErrorReasonTokenRetrieval             SPIAccessTokenBindingErrorReason = "TokenRetrieval"
	SPIAccessTokenBindingErrorReasonTokenSync                  SPIAccessTokenBindingErrorReason = "TokenSync"
)

type SPIAccessTokenBindingList

type SPIAccessTokenBindingList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []SPIAccessTokenBinding `json:"items"`
}

SPIAccessTokenBindingList contains a list of SPIAccessTokenBinding

func (*SPIAccessTokenBindingList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenBindingList.

func (*SPIAccessTokenBindingList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SPIAccessTokenBindingList) DeepCopyObject

func (in *SPIAccessTokenBindingList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SPIAccessTokenBindingPhase

type SPIAccessTokenBindingPhase string
const (
	SPIAccessTokenBindingPhaseAwaitingTokenData SPIAccessTokenBindingPhase = "AwaitingTokenData"
	SPIAccessTokenBindingPhaseInjected          SPIAccessTokenBindingPhase = "Injected"
	SPIAccessTokenBindingPhaseError             SPIAccessTokenBindingPhase = "Error"
)

type SPIAccessTokenBindingSpec

type SPIAccessTokenBindingSpec struct {
	RepoUrl     string      `json:"repoUrl"`
	Permissions Permissions `json:"permissions"`
	Secret      SecretSpec  `json:"secret"`
}

SPIAccessTokenBindingSpec defines the desired state of SPIAccessTokenBinding

func (*SPIAccessTokenBindingSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenBindingSpec.

func (*SPIAccessTokenBindingSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SPIAccessTokenBindingStatus

type SPIAccessTokenBindingStatus struct {
	Phase                 SPIAccessTokenBindingPhase       `json:"phase"`
	ErrorReason           SPIAccessTokenBindingErrorReason `json:"errorReason,omitempty"`
	ErrorMessage          string                           `json:"errorMessage,omitempty"`
	LinkedAccessTokenName string                           `json:"linkedAccessTokenName"`
	OAuthUrl              string                           `json:"oAuthUrl"`
	SyncedObjectRef       TargetObjectRef                  `json:"syncedObjectRef"`
}

SPIAccessTokenBindingStatus defines the observed state of SPIAccessTokenBinding

func (*SPIAccessTokenBindingStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenBindingStatus.

func (*SPIAccessTokenBindingStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SPIAccessTokenDataUpdate added in v0.3.0

type SPIAccessTokenDataUpdate struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              SPIAccessTokenDataUpdateSpec `json:"spec"`
}

SPIAccessTokenDataUpdate is a special CRD that advertises to the controller in the Kubernetes cluster that there has been an update of the data in the token storage. Because token storage is out-of-cluster, updates to it are not registered by the controllers. This CRD serves as a "trigger" for reconciliation of the SPIAccessToken after the data has been updated in the token storage. The caller that updates the data in the token storage is responsible for creating an object pointing to the SPIAccessToken that should have been affected.

func (*SPIAccessTokenDataUpdate) DeepCopy added in v0.3.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenDataUpdate.

func (*SPIAccessTokenDataUpdate) DeepCopyInto added in v0.3.0

func (in *SPIAccessTokenDataUpdate) DeepCopyInto(out *SPIAccessTokenDataUpdate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SPIAccessTokenDataUpdate) DeepCopyObject added in v0.3.0

func (in *SPIAccessTokenDataUpdate) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SPIAccessTokenDataUpdateList added in v0.3.0

type SPIAccessTokenDataUpdateList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []SPIAccessTokenDataUpdate `json:"items"`
}

SPIAccessTokenDataUpdateList contains a list of SPIAccessTokenDataUpdate

func (*SPIAccessTokenDataUpdateList) DeepCopy added in v0.3.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenDataUpdateList.

func (*SPIAccessTokenDataUpdateList) DeepCopyInto added in v0.3.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SPIAccessTokenDataUpdateList) DeepCopyObject added in v0.3.0

func (in *SPIAccessTokenDataUpdateList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SPIAccessTokenDataUpdateSpec added in v0.3.0

type SPIAccessTokenDataUpdateSpec struct {
	// TokenName is the name of the SPIAccessToken object in the same namespace as the update object
	//+kubebuilder:validation:Required
	TokenName string `json:"tokenName"`
}

SPIAccessTokenDataUpdateSpec defines the desired state of SPIAccessTokenDataUpdate

func (*SPIAccessTokenDataUpdateSpec) DeepCopy added in v0.3.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenDataUpdateSpec.

func (*SPIAccessTokenDataUpdateSpec) DeepCopyInto added in v0.3.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SPIAccessTokenList

type SPIAccessTokenList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []SPIAccessToken `json:"items"`
}

SPIAccessTokenList contains a list of SPIAccessToken

func (*SPIAccessTokenList) DeepCopy

func (in *SPIAccessTokenList) DeepCopy() *SPIAccessTokenList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenList.

func (*SPIAccessTokenList) DeepCopyInto

func (in *SPIAccessTokenList) DeepCopyInto(out *SPIAccessTokenList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SPIAccessTokenList) DeepCopyObject

func (in *SPIAccessTokenList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SPIAccessTokenPhase

type SPIAccessTokenPhase string

SPIAccessTokenPhase is the reconciliation phase of the SPIAccessToken object

const (
	SPIAccessTokenPhaseAwaitingTokenData SPIAccessTokenPhase = "AwaitingTokenData"
	SPIAccessTokenPhaseReady             SPIAccessTokenPhase = "Ready"
)

type SPIAccessTokenSpec

type SPIAccessTokenSpec struct {
	Permissions Permissions `json:"permissions"`
	//+kubebuilder:validation:Required
	ServiceProviderUrl string `json:"serviceProviderUrl"`
}

SPIAccessTokenSpec defines the desired state of SPIAccessToken

func (*SPIAccessTokenSpec) DeepCopy

func (in *SPIAccessTokenSpec) DeepCopy() *SPIAccessTokenSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenSpec.

func (*SPIAccessTokenSpec) DeepCopyInto

func (in *SPIAccessTokenSpec) DeepCopyInto(out *SPIAccessTokenSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SPIAccessTokenStatus

type SPIAccessTokenStatus struct {
	Phase         SPIAccessTokenPhase `json:"phase"`
	OAuthUrl      string              `json:"oAuthUrl"`
	TokenMetadata *TokenMetadata      `json:"tokenMetadata,omitempty"`
}

SPIAccessTokenStatus defines the observed state of SPIAccessToken

func (*SPIAccessTokenStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SPIAccessTokenStatus.

func (*SPIAccessTokenStatus) DeepCopyInto

func (in *SPIAccessTokenStatus) DeepCopyInto(out *SPIAccessTokenStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SecretSpec

type SecretSpec struct {
	// Name is the name of the secret to be created. If it is not defined a random name based on the name of the binding
	// is used.
	// +optional
	Name string `json:"name,omitempty"`
	// Labels contains the labels that the created secret should be labeled with.
	Labels map[string]string `json:"labels,omitempty"`
	// Annotations is the keys and values that the create secret should be annotated with.
	Annotations map[string]string `json:"annotations,omitempty"`
	// Type is the type of the secret to be created. If left empty, the default type used in the cluster is assumed (typically Opaque).
	// The type of the secret defines the automatic mapping of the token record fields to keys in the secret data
	// according to the documentation https://kubernetes.io/docs/concepts/configuration/secret/#secret-types.
	// Only kubernetes.io/service-account-token, kubernetes.io/dockercfg, kubernetes.io/dockerconfigjson and kubernetes.io/basic-auth
	// are supported. All other secret types need to have their mapping specified manually using the Fields.
	Type corev1.SecretType `json:"type,omitempty"`
	// Fields specifies the mapping from the token record fields to the keys in the secret data.
	Fields TokenFieldMapping `json:"fields,omitempty"`
}

func (*SecretSpec) DeepCopy

func (in *SecretSpec) DeepCopy() *SecretSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretSpec.

func (*SecretSpec) DeepCopyInto

func (in *SecretSpec) DeepCopyInto(out *SecretSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceProviderType

type ServiceProviderType string

ServiceProviderType defines the set of supported service providers

const (
	ServiceProviderTypeGitHub ServiceProviderType = "GitHub"
	ServiceProviderTypeQuay   ServiceProviderType = "Quay"
)

type TargetObjectRef

type TargetObjectRef struct {
	// Name is the name of the object with the injected data. This always lives in the same namespace as the AccessTokenSecret object.
	Name string `json:"name"`
	// Kind is the kind of the object with the injected data.
	Kind string `json:"kind"`
	// ApiVersion is the api version of the object with the injected data.
	ApiVersion string `json:"apiVersion"`
}

func (*TargetObjectRef) DeepCopy

func (in *TargetObjectRef) DeepCopy() *TargetObjectRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetObjectRef.

func (*TargetObjectRef) DeepCopyInto

func (in *TargetObjectRef) DeepCopyInto(out *TargetObjectRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Token

type Token struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Expiry       uint64 `json:"expiry,omitempty"`
}

Token is copied from golang.org/x/oauth2 and made easily json-serializable. It represents the data obtained from the OAuth flow. TODO move this out of this package. The token is no longer part of the CRD in any shape or form.

func (*Token) DeepCopy

func (in *Token) DeepCopy() *Token

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Token.

func (*Token) DeepCopyInto

func (in *Token) DeepCopyInto(out *Token)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TokenFieldMapping

type TokenFieldMapping struct {
	// Token specifies the data key in which the token should be stored.
	Token string `json:"token,omitempty"`
	// Name specifies the data key in which the name of the token record should be stored.
	Name string `json:"name,omitempty"`
	// ServiceProviderUrl specifies the data key in which the url of the service provider should be stored.
	ServiceProviderUrl string `json:"serviceProviderUrl,omitempty"`
	// ServiceProviderUserName specifies the data key in which the url of the user name used in the service provider should be stored.
	ServiceProviderUserName string `json:"serviceProviderUserName,omitempty"`
	// ServiceProviderUserId specifies the data key in which the url of the user id used in the service provider should be stored.
	ServiceProviderUserId string `json:"serviceProviderUserId,omitempty"`
	// UserId specifies the data key in which the user id as known to the SPI should be stored (note that this is usually different from
	// ServiceProviderUserId, because the former is usually a kubernetes user, while the latter is some arbitrary ID used by the service provider
	// which might or might not correspond to the Kubernetes user id).
	UserId string `json:"userId,omitempty"`
	// ExpiredAfter specifies the data key in which the expiry date of the token should be stored.
	ExpiredAfter string `json:"expiredAfter,omitempty"`
	// Scopes specifies the data key in which the comma-separated list of token scopes should be stored.
	Scopes string `json:"scopes,omitempty"`
}

func (*TokenFieldMapping) DeepCopy

func (in *TokenFieldMapping) DeepCopy() *TokenFieldMapping

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenFieldMapping.

func (*TokenFieldMapping) DeepCopyInto

func (in *TokenFieldMapping) DeepCopyInto(out *TokenFieldMapping)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TokenMetadata

type TokenMetadata struct {
	// Username is the username in the service provider that this token impersonates as
	Username string `json:"username"`
	// UserId is the user id in the service provider that this token impersonates as
	UserId string `json:"userId"`
	// Scopes is the list of OAuth scopes that this token possesses
	Scopes []string `json:"scopes"`
	// ServiceProviderState is an opaque state specific to the service provider. This includes data that the operator
	// uses during token matching, etc.
	ServiceProviderState []byte `json:"serviceProviderState"`
	// LastRefreshTime is the Unix-epoch timestamp of the last time the metadata has been refreshed from the service
	// provider. The operator is configured with a TTL for this information and automatically refreshes the metadata
	// when it is needed but is found stale.
	LastRefreshTime int64 `json:"lastRefreshTime"`
}

TokenMetadata is data about the token retrieved from the service provider. This data can be used for matching the tokens with the token bindings.

func (*TokenMetadata) DeepCopy

func (in *TokenMetadata) DeepCopy() *TokenMetadata

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenMetadata.

func (*TokenMetadata) DeepCopyInto

func (in *TokenMetadata) DeepCopyInto(out *TokenMetadata)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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