resource

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllErrorsFromChain

func GetAllErrorsFromChain(err error) []error

Types

type DoguStatusReporter

type DoguStatusReporter struct {
	KubernetesClient client.Client `json:"kubernetes_client"`
}

DoguStatusReporter is responsible to add messages to a dogu resource.

func NewDoguStatusReporter

func NewDoguStatusReporter(client client.Client) *DoguStatusReporter

NewDoguStatusReporter create a new instance of a dogu error reporter.

func (DoguStatusReporter) ReportError

func (der DoguStatusReporter) ReportError(ctx context.Context, doguResource *k8sv1.Dogu, reportError error) error

ReportError adds the or all errors from a multi error to the status of the dogu resource.

func (DoguStatusReporter) ReportMessage

func (der DoguStatusReporter) ReportMessage(ctx context.Context, doguResource *k8sv1.Dogu, message string) error

ReportMessage adds the given message to the status of the dogu resource.

type ErrorResourceState

type ErrorResourceState struct {
	SourceError error
	Resource    metav1.Object
}

ErrorResourceState is returned when a specific resource (pod/dogu) is not ready yet.

func (*ErrorResourceState) Error

func (e *ErrorResourceState) Error() string

Report returns the error in string representation

func (*ErrorResourceState) Report

func (e *ErrorResourceState) Report() string

Report constructs a simple human readable message

func (*ErrorResourceState) Requeue

func (e *ErrorResourceState) Requeue() bool

Requeue determines if the current dogu operation should be requeue when this error was responsible for its failure

type ExposedCommandExecutor

type ExposedCommandExecutor struct {
	Client                 kubernetes.Interface `json:"client"`
	CoreV1RestClient       rest.Interface       `json:"coreV1RestClient"`
	CommandExecutorCreator func(config *rest.Config, method string, url *url.URL) (remotecommand.Executor, error)
}

ExposedCommandExecutor is the unit to execute exposed commands in a dogu

func NewCommandExecutor

func NewCommandExecutor(client kubernetes.Interface, coreV1RestClient rest.Interface) *ExposedCommandExecutor

NewCommandExecutor creates a new instance of NewCommandExecutor

func (*ExposedCommandExecutor) ExecCommand

func (ce *ExposedCommandExecutor) ExecCommand(ctx context.Context, targetDogu string, namespace string,
	command *core.ExposedCommand, params []string) (*bytes.Buffer, error)

ExecCommand execs an exposed command in the first found pod of a dogu

type ReportableError

type ReportableError interface {
	// Report constructs a human readable message for the dogu resource status.
	Report() string
}

ReportableError is used to identify all errors that are designed to report something into the dogu resource status.

type ResourceGenerator

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

ResourceGenerator generate k8s resources for a given dogu. All resources will be referenced with the dogu resource as controller

func NewResourceGenerator

func NewResourceGenerator(scheme *runtime.Scheme) *ResourceGenerator

NewResourceGenerator creates a new generator for k8s resources

func (*ResourceGenerator) GetDoguDeployment

func (r *ResourceGenerator) GetDoguDeployment(doguResource *k8sv1.Dogu, dogu *core.Dogu) (*appsv1.Deployment, error)

GetDoguDeployment creates a new instance of a deployment with a given dogu.json and dogu custom resource

func (*ResourceGenerator) GetDoguExposedServices

func (r *ResourceGenerator) GetDoguExposedServices(doguResource *k8sv1.Dogu, dogu *core.Dogu) ([]corev1.Service, error)

GetDoguExposedServices creates a new instance of a LoadBalancer service for each exposed port.

func (*ResourceGenerator) GetDoguPVC

func (r *ResourceGenerator) GetDoguPVC(doguResource *k8sv1.Dogu) (*corev1.PersistentVolumeClaim, error)

GetDoguPVC creates a persistent volume claim with a 5Gi storage for the given dogu

func (*ResourceGenerator) GetDoguSecret

func (r *ResourceGenerator) GetDoguSecret(doguResource *k8sv1.Dogu, stringData map[string]string) (*corev1.Secret, error)

GetDoguSecret generates a secret with a given data map for the dogu

func (*ResourceGenerator) GetDoguService

func (r *ResourceGenerator) GetDoguService(doguResource *k8sv1.Dogu, imageConfig *imagev1.ConfigFile) (*corev1.Service, error)

GetDoguService creates a new instance of a service with the given dogu custom resource and container image. The container image is used to extract the exposed ports

Jump to

Keyboard shortcuts

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