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
- func GetLanguageInstrumentations(instCandidates []*v1alpha2.Instrumentation) ([]*v1alpha2.Instrumentation, error)
- func GetSecretNameFromInstrumentations(insts []*v1alpha2.Instrumentation) (string, error)
- func NewMutator(logger logr.Logger, client client.Client, sdkInjector SdkInjector, ...) *instPodMutator
- type InstrumentationDefaulter
- type InstrumentationLocator
- type InstrumentationValidator
- func (r *InstrumentationValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
- func (r *InstrumentationValidator) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
- func (r *InstrumentationValidator) ValidateUpdate(ctx context.Context, oldObj runtime.Object, newObj runtime.Object) (admission.Warnings, error)
- type NewrelicInstrumentationLocator
- type NewrelicSdkInjector
- type NewrelicSecretReplicator
- type SdkInjector
- type SecretReplicator
Constants ¶
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
InstrumentationDefaulter is used to set defaults 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
func (r *InstrumentationValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
ValidateCreate to validate the creation operation
func (*InstrumentationValidator) ValidateDelete ¶ added in v0.14.0
func (r *InstrumentationValidator) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error)
ValidateDelete to validate the deletion 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
func (il *NewrelicInstrumentationLocator) GetInstrumentations(ctx context.Context, ns corev1.Namespace, pod corev1.Pod) ([]*v1alpha2.Instrumentation, error)
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
func (i *NewrelicSdkInjector) Inject(ctx context.Context, insts []*v1alpha2.Instrumentation, ns corev1.Namespace, pod corev1.Pod) corev1.Pod
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