controllers

package
v0.0.0-...-ba6faa5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminClusterRole        = "capp-user-admin"
	ContributorClusterRole  = "capp-user-contributor"
	ViewerClusterRole       = "capp-user-viewer"
	AdminPlatformRole       = "admin"
	ContributorPlatformRole = "contributor"
	ViewerPlatformRole      = "viewer"
)

Variables

This section is empty.

Functions

func FetchCappLogs

func FetchCappLogs(ctx context.Context, client kubernetes.Interface, namespace, cappName, containerName, podName string, 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

func FetchCappPodName(podName string, pods *corev1.PodList) (string, bool)

FetchCappPodName returns the validated pod name from the provided list of pods. If cappName 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, 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.

Types

type CappController

type CappController interface {
	// CreateCapp creates a new Capp in the specified namespace.
	CreateCapp(namespace string, capp types.CreateCapp) (types.Capp, error)

	// GetCapps gets all Capps from a specific namespace.
	GetCapps(namespace string, cappQuery types.CappQuery) (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.CappError, error)

	// EditCappState edits the state of a specific Capp in the specified namespace.
	EditCappState(namespace string, cappName string, state string) (types.CappStateReponse, error)

	// GetCappState gets the state of a specific Capp from the specified namespace.
	GetCappState(namespace, name string) (types.GetCappStateResponse, error)
}

func NewCappController

func NewCappController(client client.Client, context context.Context, logger *zap.Logger) CappController

type CappRevisionController

type CappRevisionController interface {
	// GetCappRevisions gets all CappRevision names and count from a specific namespace.
	GetCappRevisions(namespace string, cappRevisionQuery types.CappRevisionQuery) (types.CappRevisionList, error)

	// GetCappRevision gets a specific CappRevision from the specified namespace.
	GetCappRevision(namespace, name string) (types.CappRevision, error)
}

func NewCappRevisionController

func NewCappRevisionController(client client.Client, context context.Context, logger *zap.Logger) CappRevisionController

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() (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 PodController

type PodController interface {
	GetPods(namespace, cappName string) (types.GetPodsResponse, error)
}

PodController defines methods to interact with pod pods.

func NewPodController

func NewPodController(client kubernetes.Interface, context context.Context, logger *zap.Logger) PodController

NewPodController creates a new instance of PodController.

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) (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 UserController

type UserController interface {
	// GetUsers get users from specified namespace and returns them as users.
	GetUsers(namespace string) (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

Jump to

Keyboard shortcuts

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