instrumentation

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2024.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DefaultLicenseKeySecretName = "newrelic-key-secret"
)

Variables

This section is empty.

Functions

func GetLanguageInstrumentations added in v0.14.0

func GetLanguageInstrumentations(instCandidates []*v1alpha2.Instrumentation) ([]*v1alpha2.Instrumentation, error)

GetLanguageInstrumentations is used to collect all instrumentations and validate that only a single instrumentation exists for each language, and return them together, modifying the slice items in place

func GetSecretNameFromInstrumentations added in v0.14.0

func GetSecretNameFromInstrumentations(insts []*v1alpha2.Instrumentation) (string, error)

GetSecretNameFromInstrumentations is used to get a single secret key name from a list of Instrumentation's. It will use the default if none is provided. If any of them are different by name, this will fail, as we can only bind a single license key to a single pod.

func NewMutator

func NewMutator(
	logger logr.Logger,
	client client.Client,
	sdkInjector SdkInjector,
	secretReplicator SecretReplicator,
	instrumentationLocator InstrumentationLocator,
	operatorNamespace string,
) *instPodMutator

NewMutator is used to get a new instance of a mutator

Types

type InstrumentationDefaulter added in v0.14.0

type InstrumentationDefaulter struct {
	Logger logr.Logger
}

InstrumentationDefaulter is used to set defaults for instrumentation

func (*InstrumentationDefaulter) Default added in v0.14.0

Default to set the default values for Instrumentation

type InstrumentationLocator added in v0.14.0

type InstrumentationLocator interface {
	GetInstrumentations(ctx context.Context, ns corev1.Namespace, pod corev1.Pod) ([]*v1alpha2.Instrumentation, error)
}

InstrumentationLocator is used to find instrumentations

type InstrumentationValidator added in v0.14.0

type InstrumentationValidator struct {
	Logger            logr.Logger
	InjectorRegistery *apm.InjectorRegistery
}

InstrumentationValidator is used to validate instrumentations

func (*InstrumentationValidator) ValidateCreate added in v0.14.0

ValidateCreate to validate the creation operation

func (*InstrumentationValidator) ValidateDelete added in v0.14.0

ValidateDelete to validate the deletion operation

func (*InstrumentationValidator) ValidateUpdate added in v0.14.0

func (r *InstrumentationValidator) ValidateUpdate(ctx context.Context, oldObj runtime.Object, newObj runtime.Object) (admission.Warnings, error)

ValidateUpdate to validate the update operation

type NewrelicInstrumentationLocator added in v0.14.0

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

NewrelicInstrumentationLocator is the base struct for locating instrumentations

func NewNewRelicInstrumentationLocator added in v0.14.0

func NewNewRelicInstrumentationLocator(logger logr.Logger, client client.Client, operatorNamespace string) *NewrelicInstrumentationLocator

NewNewRelicInstrumentationLocator is the constructor for getting instrumentations

func (*NewrelicInstrumentationLocator) GetInstrumentations added in v0.14.0

GetInstrumentations is used to get all instrumentations in the cluster. While we could limit it to the operator namespace, it's more helpful to list anything in the logs that may have been excluded.

type NewrelicSdkInjector added in v0.14.0

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

NewrelicSdkInjector is the base struct used to inject our instrumentation into a pod

func NewNewrelicSdkInjector added in v0.14.0

func NewNewrelicSdkInjector(logger logr.Logger, client client.Client, injectorRegistry *apm.InjectorRegistery) *NewrelicSdkInjector

NewNewrelicSdkInjector is used to create our injector

func (*NewrelicSdkInjector) Inject added in v0.14.0

Inject is used to utilize a list of instrumentations, and if the injectors language matches the instrumentation, trigger the injector

type NewrelicSecretReplicator added in v0.14.0

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

NewrelicSecretReplicator is the base struct used for copying the secrets

func NewNewrelicSecretReplicator added in v0.14.0

func NewNewrelicSecretReplicator(logger logr.Logger, client client.Client) *NewrelicSecretReplicator

NewNewrelicSecretReplicator is the constructor for copying secrets

func (*NewrelicSecretReplicator) ReplicateSecret added in v0.14.0

func (sr *NewrelicSecretReplicator) ReplicateSecret(ctx context.Context, ns corev1.Namespace, pod corev1.Pod, operatorNamespace string, secretName string) error

ReplicateSecret is used to copy the secret from the operator namespace to the pod namespace if the secret doesn't already exist

type SdkInjector added in v0.14.0

type SdkInjector interface {
	Inject(ctx context.Context, insts []*v1alpha2.Instrumentation, ns corev1.Namespace, pod corev1.Pod) corev1.Pod
}

SdkInjector is used to inject our instrumentation into a pod

type SecretReplicator added in v0.14.0

type SecretReplicator interface {
	ReplicateSecret(ctx context.Context, ns corev1.Namespace, pod corev1.Pod, operatorNamespace string, secretName string) error
}

SecretReplicator is used to copy secrets from one namespace to another

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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