Documentation
¶
Index ¶
- Constants
- func CreateTokenRequestSecret(ctx context.Context, client kubernetes.Interface, ...) (*corev1.Secret, error)
- func DeleteTokenRequestSecret(ctx context.Context, client kubernetes.Interface, ...) error
- func FetchCappLogs(ctx context.Context, client kubernetes.Interface, ...) (io.ReadCloser, error)
- func FetchCappPodName(podName string, pods *corev1.PodList) (string, bool)
- func FetchPodLogs(ctx context.Context, client kubernetes.Interface, ...) (io.ReadCloser, error)
- func HandleStartTerminal(clientSet kubernetes.Interface, config *rest.Config, ...) (types.StartTerminalResponse, error)
- type CappController
- type CappPaginator
- type CappRevisionController
- type CappRevisionPaginator
- type ConfigMapController
- type ContainerController
- type NamespaceController
- type NamespacePaginator
- type PodController
- type PodPaginator
- type SecretController
- type SecretPaginator
- type ServiceAccountController
- type ServiceAccountPaginator
- type TokenController
- type UserController
- type UserPaginator
Constants ¶
const ( ErrCouldNotListCapps = "Could not list capps" ErrCouldNotCreateCapp = "Could not create capp %q in namespace %q" ErrCouldNotGetCapp = "Could not get capp %q in namespace %q" ErrCouldNotGetDNS = "Could not get dns related to capp %q in namespace %q" ErrCouldNotUpdateCapp = "Could not get capp %q in namespace %q" ErrCouldNotDeleteCapp = "Could not delete capp %q in namespace %q" ErrParsingLabelSelector = "Could not parse labelSelector" ErrCouldNotGetPlacements = "Could not get Placements with %q=%q and %q=%q" ErrNoPlacementsFound = "No matching Placements found" ErrUnsetPlacementQueryParameters = "%q and/or %q query parameters must be set when Site is unspecified in request body" )
const ( ErrCouldNotListCappRevisions = "Could not list capp revisions" ErrCouldNotGetCappRevision = "Could not get capp revision %q in namespace %q" )
const ( ErrCouldNotGetNamespaces = "Could not get namespaces" ErrCouldNotFetchNamespace = "Could not fetch namespace %q" ErrCouldNotCreateNamespace = "Could not create namespace %q" ErrCouldNotDeleteNamespace = "Could not delete namespace %q" )
const ( ErrCouldNotCreateSecret = "Could not create secret %q" ErrCouldNotListSecrets = "Could not list secrets" ErrCouldNotGetSecret = "Could not get secret %q" ErrCouldNotUpdateSecret = "Could not update secret %q" ErrCouldNotDecodeSecret = "Error decoding secret %q with error: %v" ErrCouldNotDeleteSecret = "Could not delete secret %q" )
const ( ErrCouldNotGetServiceAccount = "Could not get ServiceAccount %q in namespace %q" ErrCouldNotGetServiceAccounts = "Could not list ServiceAccounts" ErrNoTokenFound = "No token found for ServiceAccount %q" ErrCouldNotCreateServiceAccount = "Could not create ServiceAccount %q in namespace %q" ErrCouldNotDeleteServiceAccount = "Could not delete ServiceAccount %q in namespace %q" )
const ( ErrCouldNotCreateTokenRequestSecret = "Could not create token request secret for serviceaccount %q in namespace %q" ErrCouldNotGetTokenRequestSecret = "Could not get token request secret for serviceaccount %q in namespace %q" ErrCouldNotDeleteTokenRequestSecret = "Could not delete token request secret for serviceaccount %q in namespace %q" ErrCouldNotCreateTokenRequest = "Could not create token request for serviceaccount %q in namespace %q" ErrInvalidExpirationSeconds = "Invalid expiration seconds: %s" )
const ( AdminClusterRole = "capp-user-admin" ContributorClusterRole = "capp-user-contributor" ViewerClusterRole = "capp-user-viewer" AdminPlatformRole = "admin" ContributorPlatformRole = "contributor" ViewerPlatformRole = "viewer" )
const ( ErrCouldNotListUsers = "Could not list users" ErrCouldNotGetRoleBinding = "Could not get rolebinding %q" ErrCouldNotCreateRolebinding = "Could not create rolebinding %q" ErrCouldNotUpdateRolebinding = "Could not update rolebinding %q" ErrCouldNotGetRolebindings = "Could not get rolebindings" ErrCouldNotDeleteRolebinding = "Could not delete rolebinding %q" )
const (
ErrCouldNotGetConfigMap = "Could not get configmap %q"
)
const (
ErrCouldNotGetPod = "failed to get pod %q in the namespace %q"
)
const (
ErrCouldNotGetPods = "Could not get pods"
)
Variables ¶
This section is empty.
Functions ¶
func CreateTokenRequestSecret ¶
func CreateTokenRequestSecret(ctx context.Context, client kubernetes.Interface, serviceAccountName, namespace string, log *zap.Logger) (*corev1.Secret, error)
CreateTokenRequestSecret creates a secret for the token request. All token requests for a service account are bound to this secret. When this secret is deleted, all tokens bound to it are revoked.
func DeleteTokenRequestSecret ¶
func DeleteTokenRequestSecret(ctx context.Context, client kubernetes.Interface, serviceAccountName, namespace string) error
DeleteTokenRequestSecret deletes the secret for token requests.
func FetchCappLogs ¶
func FetchCappLogs(ctx context.Context, client kubernetes.Interface, namespace, cappName, containerName, podName string, previous bool, logger *zap.Logger) (io.ReadCloser, error)
FetchCappLogs retrieves the logs of a Capp's Knative service. It fetches the pods associated with the service, selects the first pod, and retrieves its logs.
func FetchCappPodName ¶
FetchCappPodName returns the validated pod name from the provided list of pods. If name is empty, it returns the name of the first pod in the list. It also returns a boolean indicating if the pod name was found in the list.
func FetchPodLogs ¶
func FetchPodLogs(ctx context.Context, client kubernetes.Interface, namespace, podName, containerName string, previous bool, logger *zap.Logger) (io.ReadCloser, error)
FetchPodLogs retrieves the logs of a specific container in a pod. It opens a log stream, reads the logs, and returns them as a string.
func HandleStartTerminal ¶
func HandleStartTerminal(clientSet kubernetes.Interface, config *rest.Config, clusterName, namespaceName, podName, containerName, shell string, logger *zap.Logger) (types.StartTerminalResponse, error)
HandleStartTerminal Handles execute shell API call, opens new session which listens to the created session id and returns the session id.
Types ¶
type CappController ¶
type CappController interface { // CreateCapp creates a new Capp in the specified namespace. CreateCapp(namespace string, capp types.CreateCapp, cappQuery types.CreateCappQuery) (types.Capp, error) // GetCapps gets all Capps from a specific namespace. GetCapps(namespace string, limit, page int, cappQuery types.GetCappQuery) (types.CappList, error) // GetCapp gets a specific Capp from the specified namespace. GetCapp(namespace, name string) (types.Capp, error) // UpdateCapp updates a specific Capp in the specified namespace. UpdateCapp(namespace, name string, capp types.UpdateCapp) (types.Capp, error) // DeleteCapp deletes a specific Capp in the specified namespace. DeleteCapp(namespace, name string) (types.MessageResponse, error) // EditCappState edits the state of a specific Capp in the specified namespace. EditCappState(namespace string, cappName string, state string) (types.CappStateResponse, error) // GetCappState gets the state of a specific Capp from the specified namespace. GetCappState(namespace, name string) (types.GetCappStateResponse, error) // GetCappDNS gets the dns records which are related to the Capp GetCappDNS(namespace, name string) (types.GetDNSResponse, error) }
func NewCappController ¶
type CappPaginator ¶
type CappPaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
CappPaginator paginates through capps in a specified namespace.
func (*CappPaginator) FetchList ¶
func (p *CappPaginator) FetchList(listOptions metav1.ListOptions) (*types.List[cappv1alpha1.Capp], error)
FetchList retrieves a list of capps from the specified namespace with given options.
type CappRevisionController ¶
type CappRevisionController interface { // GetCappRevisions gets all CappRevision names and count from a specific namespace. GetCappRevisions(namespace string, limit, page int, cappName string) (types.CappRevisionList, error) // GetCappRevision gets a specific CappRevision from the specified namespace. GetCappRevision(namespace, name string) (types.CappRevision, error) }
type CappRevisionPaginator ¶
type CappRevisionPaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
CappRevisionPaginator paginates through capprevisions in a specified namespace.
func (*CappRevisionPaginator) FetchList ¶
func (p *CappRevisionPaginator) FetchList(listOptions metav1.ListOptions) (*types.List[cappv1alpha1.CappRevision], error)
FetchList retrieves a list of capps from the specified namespace with given options.
type ConfigMapController ¶
type ConfigMapController interface { // GetConfigMap gets a specific config map from the specified namespace. GetConfigMap(namespace, name string) (types.ConfigMap, error) }
func NewConfigMapController ¶
func NewConfigMapController(client kubernetes.Interface, context context.Context, logger *zap.Logger) ConfigMapController
NewConfigMapController creates a new config map controller to get them from Kubernetes API.
type ContainerController ¶
type ContainerController interface {
GetContainers(namespace, podName string) (types.GetContainersResponse, error)
}
ContainerController defines methods to interact with pod containers.
func NewContainerController ¶
func NewContainerController(client kubernetes.Interface, context context.Context, logger *zap.Logger) ContainerController
NewContainerController creates a new instance of ContainerController.
type NamespaceController ¶
type NamespaceController interface { GetNamespaces(limit, page int) (types.NamespaceList, error) GetNamespace(name string) (types.Namespace, error) CreateNamespace(name string) (types.Namespace, error) DeleteNamespace(name string) error }
func NewNamespaceController ¶
func NewNamespaceController(client kubernetes.Interface, context context.Context, logger *zap.Logger) NamespaceController
type NamespacePaginator ¶
type NamespacePaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
NamespacePaginator paginates through secrets in a specified namespace.
func (*NamespacePaginator) FetchList ¶
func (p *NamespacePaginator) FetchList(listOptions metav1.ListOptions) (*types.List[corev1.Namespace], error)
FetchList retrieves a list of secrets from the specified namespace with given options.
type PodController ¶
type PodController interface {
GetPods(namespace, cappName string, limit, page int) (types.GetPodsResponse, error)
}
PodController defines methods to interact with pods.
func NewPodController ¶
func NewPodController(client kubernetes.Interface, context context.Context, logger *zap.Logger) PodController
NewPodController creates a new instance of PodController.
type PodPaginator ¶
type PodPaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
PodPaginator paginates through pods in a specified namespace.
func (*PodPaginator) FetchList ¶
func (p *PodPaginator) FetchList(listOptions metav1.ListOptions) (*types.List[corev1.Pod], error)
FetchList retrieves a list of pods from the specified namespace with given options.
type SecretController ¶
type SecretController interface { // CreateSecret creates a new secret in the specified namespace. CreateSecret(namespace string, request types.CreateSecretRequest) (types.CreateSecretResponse, error) // GetSecrets gets all secretes from the specified namespace. GetSecrets(namespace string, limit, page int) (types.GetSecretsResponse, error) // GetSecret gets a specific secret from the specified namespace. GetSecret(namespace, name string) (types.GetSecretResponse, error) // UpdateSecret updates a specific secret in the specified namespace. UpdateSecret(namespace, name string, request types.UpdateSecretRequest) (types.UpdateSecretResponse, error) // DeleteSecret deletes a specific secret in the specified namespace. DeleteSecret(namespace, name string) (types.DeleteSecretResponse, error) }
func NewSecretController ¶
func NewSecretController(client kubernetes.Interface, context context.Context, logger *zap.Logger) SecretController
NewSecretController creates a new secrets controller to make requests of CRUD operations using Kubernetes API.
type SecretPaginator ¶
type SecretPaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
SecretPaginator paginates through secrets in a specified namespace.
func (*SecretPaginator) FetchList ¶
func (p *SecretPaginator) FetchList(listOptions metav1.ListOptions) (*types.List[corev1.Secret], error)
FetchList retrieves a list of secrets from the specified namespace with given options.
type ServiceAccountController ¶
type ServiceAccountController interface { // GetServiceAccount retrieves a ServiceAccount by name and namespace, returning the ServiceAccount and any error encountered. GetServiceAccount(name, namespace string) (types.ServiceAccount, error) // GetServiceAccountToken retrieves the token for a given ServiceAccount by name and namespace, returning the token and any error encountered. GetServiceAccountToken(serviceAccountName, namespace string) (types.TokenResponse, error) // CreateServiceAccount creates a new ServiceAccount with the given name and namespace. CreateServiceAccount(name, namespace string) (types.ServiceAccount, error) // DeleteServiceAccount deletes a ServiceAccount by name and namespace. DeleteServiceAccount(name, namespace string) error // GetServiceAccounts retrieves all ServiceAccounts in a given namespace, returning the ServiceAccounts and any error encountered. GetServiceAccounts(namespace string, limit, page int) (types.ServiceAccountOutput, error) }
ServiceAccountController defines methods to interact with ServiceAccounts.
func NewServiceAccountController ¶
func NewServiceAccountController(client kubernetes.Interface, context context.Context, logger *zap.Logger) ServiceAccountController
NewServiceAccountController creates a new instance of ServiceAccountController.
type ServiceAccountPaginator ¶
type ServiceAccountPaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
ServiceAccountPaginator paginates through secrets in a specified namespace.
func (*ServiceAccountPaginator) FetchList ¶
func (p *ServiceAccountPaginator) FetchList(listOptions metav1.ListOptions) (*types.List[corev1.ServiceAccount], error)
FetchList retrieves a list of serviceAccounts from the specified namespace with given options.
type TokenController ¶
type TokenController interface { // RevokeToken revokes a token by name of the serviceaccount. RevokeToken(serviceAccountName, namespace string) error // CreateToken creates a token for a serviceaccount. CreateToken(serviceAccountName, namespace string, expirationSeconds string) (types.TokenRequestResponse, error) }
func NewTokenController ¶
func NewTokenController(client kubernetes.Interface, ctx context.Context, logger *zap.Logger) TokenController
NewTokenController creates a new token controller.
type UserController ¶
type UserController interface { // GetUsers get users from specified namespace and returns them as users. GetUsers(namespace string, limit, page int) (types.UsersOutput, error) // GetUser gets a specific user from specified namespace and returns it as user. GetUser(userIdentifier types.UserIdentifier) (types.User, error) // AddUser creates a new roleBinding in the specified namespace. AddUser(user types.UserInput) (types.User, error) // DeleteUser deletes user in the specified namespace. DeleteUser(userIdentifier types.UserIdentifier) (types.DeleteUserResponse, error) // UpdateUser updates user in the specified namespace. UpdateUser(user types.UserInput) (types.User, error) }
func NewUserController ¶
func NewUserController(client kubernetes.Interface, context context.Context, logger *zap.Logger) UserController
type UserPaginator ¶
type UserPaginator struct { pagination.GenericPaginator // contains filtered or unexported fields }
UserPaginator paginates through secrets in a specified namespace.
func (*UserPaginator) FetchList ¶
func (p *UserPaginator) FetchList(listOptions metav1.ListOptions) (*types.List[rbacv1.RoleBinding], error)
FetchList retrieves a list of secrets from the specified namespace with given options.