Documentation ¶
Overview ¶
Package k8s gathers abstractions on top of Kubernetes Objects
Index ¶
- Constants
- type ClientFactory
- type NamespaceManager
- type PipelineRun
- type PipelineRunByKeyFetcher
- type PipelineRunByNameFetcher
- type PipelineRunFetcher
- type RoleName
- type ServiceAccountHelper
- type ServiceAccountManager
- type ServiceAccountWrap
- func (a *ServiceAccountWrap) AddRoleBinding(clusterRole RoleName, targetNamespace string) (*v1beta1.RoleBinding, error)
- func (a *ServiceAccountWrap) AttachImagePullSecrets(secretNames ...string)
- func (a *ServiceAccountWrap) AttachSecrets(secretNames ...string)
- func (a *ServiceAccountWrap) GetHelper() ServiceAccountHelper
- func (a *ServiceAccountWrap) GetServiceAccount() *v1.ServiceAccount
- func (a ServiceAccountWrap) SetDoAutomountServiceAccountToken(doAutomount bool)
- func (a *ServiceAccountWrap) Update() error
- type TenantFetcher
- type TenantNamespace
Constants ¶
const FinalizerName = "steward.sap.com"
FinalizerName name to register finalizer
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientFactory ¶
type ClientFactory interface { // CoreV1 returns the core/v1 Kubernetes client CoreV1() corev1.CoreV1Interface // NetworkingV1 returns the networking/v1 Kubernetes client NetworkingV1() networkingv1.NetworkingV1Interface // RbacV1beta1 returns the rbac/v1beta1 Kubernetes client RbacV1beta1() rbacv1beta1.RbacV1beta1Interface // Dynamic returns the dynamic Kubernetes client Dynamic() dynamic.Interface // StewardV1alpha1 returns the steward.sap.com/v1alpha1 Kubernetes client StewardV1alpha1() stewardv1alpha1.StewardV1alpha1Interface // StewardInformerFactory returns the informer factory for Steward StewardInformerFactory() stewardinformer.SharedInformerFactory // TektonV1alpha1 returns the tekton.dev/v1alpha1 Kubernetes client TektonV1alpha1() tektonclientv1alpha1.TektonV1alpha1Interface // TektonInformerFactory returns the informer factory for Tekton TektonInformerFactory() tektoninformers.SharedInformerFactory }
ClientFactory is the interface for Kubernet client factories.
func NewClientFactory ¶
func NewClientFactory(config *rest.Config, resyncPeriod time.Duration) ClientFactory
NewClientFactory creates new client factory based on rest config
type NamespaceManager ¶
type NamespaceManager interface { Create(name string, annotations map[string]string) (string, error) Delete(name string) error }
NamespaceManager manages namespaces
func NewNamespaceManager ¶
func NewNamespaceManager(factory ClientFactory, prefix string, suffixLength uint8) NamespaceManager
NewNamespaceManager creates a new NamespaceManager.
type PipelineRun ¶
type PipelineRun interface { fmt.Stringer GetStatus() *api.PipelineStatus GetSpec() *api.PipelineSpec GetName() string GetKey() string GetRunNamespace() string GetNamespace() string GetPipelineRepoServerURL() (string, error) HasDeletionTimestamp() bool AddFinalizer() error DeleteFinalizerIfExists() error UpdateState(api.State) (*api.StateItem, error) UpdateResult(api.Result) error UpdateContainer(*corev1.ContainerState) error StoreErrorAsMessage(error, string) error UpdateRunNamespace(string) error UpdateMessage(string) error }
PipelineRun is a wrapper for the K8s PipelineRun resource
func NewPipelineRun ¶
func NewPipelineRun(apiObj *api.PipelineRun, factory ClientFactory) (PipelineRun, error)
NewPipelineRun creates a managed pipeline run object. If a factory is provided a new version of the pipelinerun is fetched. All changes are done on the fetched object. If no pipeline run can be found matching the apiObj, nil,nil is returned. An error is only returned if a Get for the pipelinerun returns an error other than a NotFound error. If you call with factory nil you can only use the Get* functions If you use functions changing the pipeline run without factroy set you will get an error. The provided PipelineRun object is never modified and copied as late as possible.
type PipelineRunByKeyFetcher ¶
type PipelineRunByKeyFetcher interface { // ByKey fetches PipelineRun resource from Kubernetes // Return nil,nil if pipeline with key does not exist ByKey(key string) (*api.PipelineRun, error) }
PipelineRunByKeyFetcher provides a function to fetch PipelineRuns by their key
type PipelineRunByNameFetcher ¶
type PipelineRunByNameFetcher interface { // ByName fetches PipelineRun resource from Kubernetes by name and namespace // Return nil,nil if specified pipeline does not exist ByName(namespace, name string) (*api.PipelineRun, error) }
PipelineRunByNameFetcher provides a function to fetch PipelineRuns by their name
type PipelineRunFetcher ¶
type PipelineRunFetcher interface { PipelineRunByKeyFetcher PipelineRunByNameFetcher }
PipelineRunFetcher combines PipelineRunByKeyFetcher and PipelineRunByNameFetcher
func NewClientBasedPipelineRunFetcher ¶
func NewClientBasedPipelineRunFetcher(client stewardv1alpha1.StewardV1alpha1Interface) PipelineRunFetcher
NewClientBasedPipelineRunFetcher returns a PipelineRunFetcher that retrieves the objects from the given API client.
func NewListerBasedPipelineRunFetcher ¶
func NewListerBasedPipelineRunFetcher(lister stewardLister.PipelineRunLister) PipelineRunFetcher
NewListerBasedPipelineRunFetcher returns a PipelineRunFetcher that retrieves the objects from the given `PipelineRunLister`. The returned fetcher provides the original pointers from the lister. Typically the lister is backed by a shared cache which must not be modified. Consumers should not mutate the original objects, but create deep copies when modification is required.
type ServiceAccountHelper ¶ added in v0.3.10
type ServiceAccountHelper interface { GetServiceAccountSecretNameRepeat() string GetServiceAccountSecretName() string }
ServiceAccountHelper implements functions to get service account secret
type ServiceAccountManager ¶
type ServiceAccountManager interface { CreateServiceAccount(name string, pipelineCloneSecretName string, imagePullSecretNames []string) (*ServiceAccountWrap, error) GetServiceAccount(name string) (*ServiceAccountWrap, error) }
ServiceAccountManager manages serviceAccounts
func NewServiceAccountManager ¶
func NewServiceAccountManager(factory ClientFactory, namespace string) ServiceAccountManager
NewServiceAccountManager creates ServiceAccountManager
type ServiceAccountWrap ¶
type ServiceAccountWrap struct {
// contains filtered or unexported fields
}
ServiceAccountWrap wraps a Service Account and enriches it with futher things
func (*ServiceAccountWrap) AddRoleBinding ¶
func (a *ServiceAccountWrap) AddRoleBinding(clusterRole RoleName, targetNamespace string) (*v1beta1.RoleBinding, error)
AddRoleBinding creates a role binding in the targetNamespace connecting the service account with the specified cluster role
func (*ServiceAccountWrap) AttachImagePullSecrets ¶
func (a *ServiceAccountWrap) AttachImagePullSecrets(secretNames ...string)
AttachImagePullSecrets attaches a number of secrets to the service account. It does NOT create or update the resource via the underlying client.
func (*ServiceAccountWrap) AttachSecrets ¶
func (a *ServiceAccountWrap) AttachSecrets(secretNames ...string)
AttachSecrets attaches a number of secrets to the service account. It does NOT create or update the resource via the underlying client.
func (*ServiceAccountWrap) GetHelper ¶ added in v0.3.10
func (a *ServiceAccountWrap) GetHelper() ServiceAccountHelper
GetHelper returns a ServiceAccountHelper
func (*ServiceAccountWrap) GetServiceAccount ¶
func (a *ServiceAccountWrap) GetServiceAccount() *v1.ServiceAccount
GetServiceAccount returns *v1.ServiceAccount
func (ServiceAccountWrap) SetDoAutomountServiceAccountToken ¶ added in v0.3.10
func (a ServiceAccountWrap) SetDoAutomountServiceAccountToken(doAutomount bool)
SetDoAutomountServiceAccountToken sets the `automountServiceAccountToken` flag in the service account spec. It does NOT create or update the resource via the underlying client.
func (*ServiceAccountWrap) Update ¶
func (a *ServiceAccountWrap) Update() error
Update performs an update of the service account resource object via the underlying client.
type TenantFetcher ¶
type TenantFetcher interface { // ByKey fetches Tenant resource from Kubernetes. // key has to be "<namespace>/<name>" // Return nil,nil if tenant with key does not exist ByKey(key string) (*api.Tenant, error) }
TenantFetcher has methods to fetch tenants from Kubernetes
func NewClientBasedTenantFetcher ¶
func NewClientBasedTenantFetcher(factory ClientFactory) TenantFetcher
NewClientBasedTenantFetcher returns an operative implementation of TenantFetcher
func NewListerBasedTenantFetcher ¶
func NewListerBasedTenantFetcher(lister stewardLister.TenantLister) TenantFetcher
NewListerBasedTenantFetcher creates a new lister based tenant fetcher
type TenantNamespace ¶
type TenantNamespace interface { GetSecretProvider() secrets.SecretProvider TargetClientFactory() ClientFactory }
TenantNamespace representing the client
func NewTenantNamespace ¶
func NewTenantNamespace(factory ClientFactory, namespace string) TenantNamespace
NewTenantNamespace creates new TenantNamespace object
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
client-go/corev1
Package corev1 is a generated GoMock package.
|
Package corev1 is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |