webhook

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InjectionInstanceLabel can be set in a Namespace and indicates the corresponding DynaKube object assigned to it.
	InjectionInstanceLabel = "dynakube.internal.dynatrace.com/instance"

	// AnnotationDynatraceInjected is set to "true" by the webhook to Pods to indicate that it has been injected.
	AnnotationDynatraceInjected = "dynakube.dynatrace.com/injected"

	// AnnotationDynatraceInject is set to "false" on the Pod to indicate that does not want any injection.
	AnnotationDynatraceInject = "dynatrace.com/inject"

	OneAgentPrefix = "oneagent"
	// AnnotationOneAgentInject can be set at pod level to enable/disable OneAgent injection.
	AnnotationOneAgentInject   = OneAgentPrefix + ".dynatrace.com/inject"
	AnnotationOneAgentInjected = OneAgentPrefix + ".dynatrace.com/injected"
	AnnotationOneAgentReason   = OneAgentPrefix + ".dynatrace.com/reason"

	EmptyConnectionInfoReason = "EmptyConnectionInfo"

	DataIngestPrefix = "data-ingest"
	// AnnotationDataIngestInject can be set at pod level to enable/disable data-ingest injection.
	AnnotationDataIngestInject   = DataIngestPrefix + ".dynatrace.com/inject"
	AnnotationDataIngestInjected = DataIngestPrefix + ".dynatrace.com/injected"

	// AnnotationFlavor can be set on a Pod to configure which code modules flavor to download. It's set to "default"
	// if not set.
	AnnotationFlavor = "oneagent.dynatrace.com/flavor"

	// AnnotationTechnologies can be set on a Pod to configure which code module technologies to download. It's set to
	// "all" if not set.
	AnnotationTechnologies = "oneagent.dynatrace.com/technologies"

	// AnnotationInstallPath can be set on a Pod to configure on which directory the OneAgent will be available from,
	// defaults to DefaultInstallPath if not set.
	AnnotationInstallPath = "oneagent.dynatrace.com/install-path"

	// AnnotationInstallerUrl can be set on a Pod to configure the installer url for downloading the agent
	// defaults to the PaaS installer download url of your tenant
	AnnotationInstallerUrl = "oneagent.dynatrace.com/installer-url"

	// AnnotationFailurePolicy can be set on a Pod to control what the init container does on failures. When set to
	// "fail", the init container will exit with error code 1. Defaults to "silent".
	AnnotationFailurePolicy = "oneagent.dynatrace.com/failure-policy"

	// DefaultInstallPath is the default directory to install the app-only OneAgent package.
	DefaultInstallPath = "/opt/dynatrace/oneagent-paas"

	// SecretCertsName is the name of the secret where the webhook certificates are stored.
	SecretCertsName = "dynatrace-webhook-certs"

	// DeploymentName is the name used for the Deployment of any webhooks and WebhookConfiguration objects.
	DeploymentName = "dynatrace-webhook"

	WebhookContainerName = "webhook"

	// InstallContainerName is the name used for the install container
	InstallContainerName = "install-oneagent"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRequest added in v0.8.0

type BaseRequest struct {
	Pod       *corev1.Pod
	DynaKube  dynatracev1beta1.DynaKube
	Namespace corev1.Namespace
}

BaseRequest is the base request for all mutation requests

func (BaseRequest) PodName added in v0.11.0

func (req BaseRequest) PodName() string

type MutationRequest added in v0.8.0

type MutationRequest struct {
	*BaseRequest
	Context          context.Context
	InstallContainer *corev1.Container
}

MutationRequest contains all the information needed to mutate a pod It is meant to be passed into each mutator, so that they can mutate the elements in the way they need to, and after passing it in to all the mutator the request will have the final state which can be used to mutate the pod.

func NewMutationRequest added in v0.8.0

func NewMutationRequest(ctx context.Context, namespace corev1.Namespace, installContainer *corev1.Container, pod *corev1.Pod, dynakube dynatracev1beta1.DynaKube) *MutationRequest

func (*MutationRequest) ToReinvocationRequest added in v0.8.0

func (request *MutationRequest) ToReinvocationRequest() *ReinvocationRequest

type PodMutator added in v0.8.0

type PodMutator interface {
	// Enabled returns true if the mutator needs to be executed for the given request.
	// This is used to filter out mutators that are not needed for the given request.
	Enabled(request *BaseRequest) bool

	// Injected returns true if the mutator has already injected into the pod of the given request.
	// This is used during reinvocation to prevent multiple injections.
	Injected(request *BaseRequest) bool

	// Mutate mutates the elements of the given MutationRequest, specifically the pod and installContainer.
	Mutate(request *MutationRequest) error

	// Reinvocation mutates the pod of the given ReinvocationRequest.
	// It only mutates the parts of the pod that haven't been mutated yet. (example: another webhook mutated the pod after our webhook was executed)
	Reinvoke(request *ReinvocationRequest) bool
}

type PodMutatorMock added in v0.8.0

type PodMutatorMock struct {
	mock.Mock
}

func (*PodMutatorMock) Enabled added in v0.8.0

func (mutator *PodMutatorMock) Enabled(request *BaseRequest) bool

func (*PodMutatorMock) Injected added in v0.8.0

func (mutator *PodMutatorMock) Injected(request *BaseRequest) bool

func (*PodMutatorMock) Mutate added in v0.8.0

func (mutator *PodMutatorMock) Mutate(request *MutationRequest) error

func (*PodMutatorMock) Reinvoke added in v0.8.0

func (mutator *PodMutatorMock) Reinvoke(request *ReinvocationRequest) bool

type ReinvocationRequest added in v0.8.0

type ReinvocationRequest struct {
	*BaseRequest
}

ReinvocationRequest contains all the information needed to reinvoke a pod It is meant to be passed into each mutator, so that they can mutate the elements in the way they need to, and after passing it in to all the mutator the request will have the final state which can be used to mutate the pod.

Jump to

Keyboard shortcuts

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