kubeobjects

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppNameLabel      = "app.kubernetes.io/name"
	AppCreatedByLabel = "app.kubernetes.io/created-by"
	AppManagedByLabel = "app.kubernetes.io/managed-by"
	AppComponentLabel = "app.kubernetes.io/component"
	AppVersionLabel   = "app.kubernetes.io/version"

	OneAgentComponentLabel   = "oneagent"
	ActiveGateComponentLabel = "activegate"
	WebhookComponentLabel    = "webhook"

	CustomImageLabelValue = "custom-image"
)
View Source
const (
	ReadOnlyMountPath  = true
	ReadWriteMountPath = false
)
View Source
const AnnotationHash = dynatracev1beta1.InternalFlagPrefix + "template-hash"
View Source
const UnprivilegedGroup = int64(1000)
View Source
const UnprivilegedUser = int64(1000)

Variables

This section is empty.

Functions

func AffinityNodeRequirement

func AffinityNodeRequirement() []corev1.NodeSelectorRequirement

func AffinityNodeRequirementWithARM64

func AffinityNodeRequirementWithARM64() []corev1.NodeSelectorRequirement

func AreSecretsEqual added in v0.7.0

func AreSecretsEqual(secret corev1.Secret, other corev1.Secret) bool

func CheckIfOneAgentAPMExists

func CheckIfOneAgentAPMExists(cfg *rest.Config) (bool, error)

CheckIfOneAgentAPMExists checks if a OneAgentAPM object exists

func ConfigMapDataEqual added in v0.6.0

func ConfigMapDataEqual(map1, map2 *corev1.ConfigMap) bool

func CreateOrUpdateDaemonSet

func CreateOrUpdateDaemonSet(kubernetesClient client.Client, logger logr.Logger, desiredDaemonSet *appsv1.DaemonSet) (bool, error)

func EnvVarIsIn added in v0.5.0

func EnvVarIsIn(envVars []corev1.EnvVar, envVarToCheck string) bool

func ExtractToken

func ExtractToken(secret *corev1.Secret, key string) (string, error)

func FindContainerInPod added in v0.8.0

func FindContainerInPod(pod corev1.Pod, name string) (*corev1.Container, error)

func FindEnvVar added in v0.7.0

func FindEnvVar(envVarList []corev1.EnvVar, name string) *corev1.EnvVar

func GenerateHash

func GenerateHash(ds interface{}) (string, error)

func GetDataFromSecretName added in v0.7.0

func GetDataFromSecretName(apiReader client.Reader, namespacedName types.NamespacedName, dataKey string) (string, error)

func GetDeployment

func GetDeployment(c client.Client, podName, namespace string) (*appsv1.Deployment, error)

GetDeployment returns the Deployment object who is the owner of this pod.

func GetField

func GetField(values map[string]string, key string, defaultValue string) string

func GetFieldBool

func GetFieldBool(values map[string]string, key string, defaultValue bool) bool

func GetVolumeByName added in v0.6.0

func GetVolumeByName(volumes []corev1.Volume, volumeName string) (*corev1.Volume, error)

func HasChanged

func HasChanged(a, b metav1.Object) bool

func IsSecretDataEqual added in v0.7.0

func IsSecretDataEqual(currentSecret *corev1.Secret, desired map[string][]byte) bool

func Key added in v0.6.0

func Key(object client.Object) client.ObjectKey

func LabelsNotEqual added in v0.6.0

func LabelsNotEqual(currentLabels, desiredLabels map[string]string) bool

func MergeLabels

func MergeLabels(labels ...map[string]string) map[string]string

func MountPathIsIn added in v0.5.0

func MountPathIsIn(volumeMounts []corev1.VolumeMount, mountPathToCheck string) bool

func MountPathIsReadOnlyOrReadWrite added in v0.6.0

func MountPathIsReadOnlyOrReadWrite(volumeMounts []corev1.VolumeMount, mountPathToCheck string, mode bool) bool

func NewEnvVarSourceForField added in v0.8.0

func NewEnvVarSourceForField(fieldPath string) *corev1.EnvVarSource

func NewSecret added in v0.7.0

func NewSecret(name string, namespace string, data map[string][]byte) *corev1.Secret

func PortIsIn added in v0.5.0

func PortIsIn(ports []corev1.ContainerPort, portToCheck int32) bool

func ValidateCertificateExpiration added in v0.5.0

func ValidateCertificateExpiration(certData []byte, renewalThreshold time.Duration, now time.Time, log logr.Logger) (bool, error)

func VolumeIsDefined added in v0.5.0

func VolumeIsDefined(volumes []corev1.Volume, volumeNameToCheck string) bool

func VolumeMountIsDefined added in v0.6.0

func VolumeMountIsDefined(volumeMounts []corev1.VolumeMount, volumeMountNameToCheck string) bool

Types

type AppLabels added in v0.6.0

type AppLabels struct {
	Component string
	Version   string
	// contains filtered or unexported fields
}

func NewAppLabels added in v0.6.0

func NewAppLabels(appName, dynakubeName, feature, featureVersion string) *AppLabels

NewAppLabels abstracts labels that are specific to an application managed by the operator which have their own version separate from the operator version. Follows the recommended label pattern: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels

func (*AppLabels) BuildLabels added in v0.6.0

func (labels *AppLabels) BuildLabels() map[string]string

BuildLabels creates labels that include oneagent or activegate mode and version

func (*AppLabels) BuildMatchLabels added in v0.6.0

func (labels *AppLabels) BuildMatchLabels() map[string]string

BuildMatchLabels creates labels that don't change when switching oneagent or activegate mode

type ContainerBuilder added in v0.6.0

type ContainerBuilder interface {
	BuildContainer() corev1.Container
	BuildVolumes() []corev1.Volume
}

type CoreLabels added in v0.6.0

type CoreLabels struct {
	Version string
	// contains filtered or unexported fields
}

func NewCoreLabels added in v0.6.0

func NewCoreLabels(dynakubeName, component string) *CoreLabels

NewCoreLabels abstracts labels that are used for core functionality in the operator which are not specific to an application's version Follows the recommended label pattern: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels

func (*CoreLabels) BuildLabels added in v0.6.0

func (labels *CoreLabels) BuildLabels() map[string]string

BuildLabels creates labels that include operator version

func (*CoreLabels) BuildMatchLabels added in v0.6.0

func (labels *CoreLabels) BuildMatchLabels() map[string]string

BuildMatchLabels creates labels that don't change when switching operator versions

type DynakubeQuery added in v0.7.0

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

func NewDynakubeQuery added in v0.7.0

func NewDynakubeQuery(clt client.Client, namespace string) DynakubeQuery

func (DynakubeQuery) Proxy added in v0.7.0

func (query DynakubeQuery) Proxy(dynakube dynatracev1beta1.DynaKube) (string, error)

func (DynakubeQuery) TlsCert added in v0.7.0

func (query DynakubeQuery) TlsCert(dynakube dynatracev1beta1.DynaKube) (string, error)

func (DynakubeQuery) TrustedCAs added in v0.7.0

func (query DynakubeQuery) TrustedCAs(dynakube dynatracev1beta1.DynaKube) ([]byte, error)

func (DynakubeQuery) WithContext added in v0.7.0

func (query DynakubeQuery) WithContext(ctx context.Context) DynakubeQuery

type ProbeResult added in v0.5.0

type ProbeResult int
const (
	ProbeObjectFound ProbeResult = iota
	ProbeObjectNotFound
	ProbeTypeFound
	ProbeTypeNotFound
	ProbeUnknown
)

func KubernetesObjectProbe added in v0.5.0

func KubernetesObjectProbe(gvk schema.GroupVersionKind,
	namespace string, name string, config *rest.Config) (ProbeResult, error)

func MapErrorToObjectProbeResult added in v0.5.0

func MapErrorToObjectProbeResult(err error) (ProbeResult, error)

type SecretQuery added in v0.7.0

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

func NewSecretQuery added in v0.7.0

func NewSecretQuery(ctx context.Context, kubeClient client.Client, kubeReader client.Reader, log logr.Logger) SecretQuery

func (SecretQuery) Create added in v0.7.0

func (query SecretQuery) Create(secret corev1.Secret) error

func (SecretQuery) CreateOrUpdate added in v0.7.0

func (query SecretQuery) CreateOrUpdate(secret corev1.Secret) error

func (SecretQuery) Get added in v0.7.0

func (query SecretQuery) Get(objectKey client.ObjectKey) (corev1.Secret, error)

func (SecretQuery) Update added in v0.7.0

func (query SecretQuery) Update(secret corev1.Secret) error

type Tokens

type Tokens struct {
	ApiToken  string
	PaasToken string
}

func NewTokens

func NewTokens(secret *corev1.Secret) (*Tokens, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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