common

package
v0.0.0-...-d2b1218 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetadataNamespace is the namespace for service mesh metadata (labels, annotations)
	MetadataNamespace = "maistra.io"

	// CreatedByKey is used in annotations to mark ServiceMeshMemberRolls created by the ServiceMeshMember controller
	CreatedByKey = MetadataNamespace + "/created-by"

	// OwnerKey represents the mesh (namespace) to which the resource relates
	OwnerKey = MetadataNamespace + "/owner"

	// OwnerNameKey represents the name of the SMCP to which the resource relates
	OwnerNameKey = MetadataNamespace + "/owner-name"

	// MemberOfKey represents the mesh (namespace) to which the resource relates
	MemberOfKey = MetadataNamespace + "/member-of"

	// IgnoreNamespaceKey indicates that sidecar injection should be disabled for the namespace
	IgnoreNamespaceKey = MetadataNamespace + "/ignore-namespace"

	// GenerationKey represents the generation to which the resource was last reconciled
	GenerationKey = MetadataNamespace + "/generation"

	// MeshGenerationKey represents the generation of the service mesh to which the resource was last reconciled.  This uniquely identifies an installation, incorporating the operator version and the smcp resource generation.
	MeshGenerationKey = MetadataNamespace + "/mesh-generation"

	// InternalKey is used to identify the resource as being internal to the mesh itself (i.e. should not be applied to members)
	InternalKey = MetadataNamespace + "/internal"

	// FinalizerName is the finalizer name the controllers add to any resources that need to be finalized during deletion
	FinalizerName = MetadataNamespace + "/istio-operator"

	// KubernetesAppNamespace is the common namespace for application information
	KubernetesAppNamespace    = "app.kubernetes.io"
	KubernetesAppNameKey      = KubernetesAppNamespace + "/name"
	KubernetesAppInstanceKey  = KubernetesAppNamespace + "/instance"
	KubernetesAppVersionKey   = KubernetesAppNamespace + "/version"
	KubernetesAppComponentKey = KubernetesAppNamespace + "/component"
	KubernetesAppPartOfKey    = KubernetesAppNamespace + "/part-of"
	KubernetesAppManagedByKey = KubernetesAppNamespace + "/managed-by"

	// KubernetesAppPartOfValue is the KubernetesAppPartOfKey label value the operator sets on all objects it creates
	KubernetesAppPartOfValue = "istio"

	// KubernetesAppManagedByValue is the KubernetesAppManagedByKey label value the operator sets on all objects it creates
	KubernetesAppManagedByValue = "maistra-istio-operator"

	// MemberRollName is the only name we allow for ServiceMeshMemberRoll objects
	MemberRollName = "default"

	// MemberName is the only name we allow for ServiceMeshMember objects
	MemberName = "default"
)

Variables

View Source
var (
	// IstioRootCertKey name of Secret entry Istio uses for the cert
	IstioRootCertKey = "root-cert.pem"
	// IstiodCertKey name of Secret entry Istiod uses for the cert
	IstiodCertKey = "ca-cert.pem"
	// ServiceCABundleKey name of config map entry service-ca operator uses for the CA bundle
	ServiceCABundleKey = "service-ca.crt"
)
View Source
var Config = &config{}

Config is the config used to drive the operator

Functions

func AddFinalizer

func AddFinalizer(ctx context.Context, obj runtime.Object, cl client.Client) error

func BoolToConditionStatus

func BoolToConditionStatus(b bool) core.ConditionStatus

func ConvertObjectToConfigMap

func ConvertObjectToConfigMap(obj runtime.Object) (*core.ConfigMap, error)

ConvertObjectToConfigMap tries to convert an runtime.Object into a ConfigMap

func ConvertObjectToDeployment

func ConvertObjectToDeployment(obj runtime.Object) (*appsv1.Deployment, error)

ConvertObjectToDeployment tries to convert an runtime.Object into a Deployment

func DeleteAnnotation

func DeleteAnnotation(resource metav1.Object, annotation string)

func DeleteLabel

func DeleteLabel(resource metav1.Object, label string)

func GetAnnotation

func GetAnnotation(resource metav1.Object, annotation string) (value string, ok bool)

func GetLabel

func GetLabel(resource metav1.Object, label string) (value string, ok bool)

func GetMeshNamespaces

func GetMeshNamespaces(controlPlaneNamespace string, smmr *v1.ServiceMeshMemberRoll) sets.String

GetMeshNamespaces returns all namespaces that are part of a mesh.

func GetOperatorNamespace

func GetOperatorNamespace() string

GetOperatorNamespace initializes and caches this operator's namespace; panics on error

func HasAnnotation

func HasAnnotation(resource metav1.Object, annotation string) bool

func HasFinalizer

func HasFinalizer(obj runtime.Object) bool

func HasLabel

func HasLabel(resource metav1.Object, label string) bool

func IndexOf

func IndexOf(l []string, s string) int

func InjectCABundle

func InjectCABundle(config *v1.WebhookClientConfig, caBundle []byte) bool

InjectCABundle updates the CABundle in a WebhookClientConfig. It returns true if the value has changed, false otherwise

func IsConflict

func IsConflict(err error) bool

func LogFromContext

func LogFromContext(ctx context.Context) logr.Logger

LogFromContext returns the Logger bound to the context or panics if none exists

func NameSet

func NameSet(list runtime.Object) sets.String

func NewConflictHandlingReconciler

func NewConflictHandlingReconciler(reconciler reconcile.Reconciler) reconcile.Reconciler

func NewContext

func NewContext() context.Context

NewContext creates a new context without an associated Logger

func NewContextWithLog

func NewContextWithLog(ctx context.Context, logger logr.Logger) context.Context

NewContextWithLog returns a copy of the parent context and associates it with a Logger.

func NewContextWithLogValues

func NewContextWithLogValues(ctx context.Context, logKeysAndValues ...interface{}) context.Context

NewContextWithLogValues returns a copy of the parent context and adds the given keys and values to its logger

func NewReconcileContext

func NewReconcileContext(logger logr.Logger) context.Context

NewReconcileContext creates a new context and associates it with a Logger.

func NewStatusPatch

func NewStatusPatch(status interface{}) *statusPatch

func NewViper

func NewViper() (*viper.Viper, error)

NewViper returns a new viper.Viper configured with all the common.Config keys Note, environment variables cannot be used to override command line defaults.

func RemoveFinalizer

func RemoveFinalizer(ctx context.Context, obj runtime.Object, cl client.Client) error

func SetAnnotation

func SetAnnotation(resource metav1.Object, annotation, value string)

func SetLabel

func SetLabel(resource metav1.Object, label, value string)

func SetLabels

func SetLabels(resource metav1.Object, labels map[string]string)

func ToNamespacedName

func ToNamespacedName(obj metav1.Object) types.NamespacedName

func UpdateField

func UpdateField(helmValues *v1.HelmValues, path string, value interface{}) error

UpdateField updates a nested field at the specified path, e.g. UpdateField(smcp.Spec.Istio, "global.proxy.image", "docker.io/maistra/proxyv2-ubi8:1.1.0")

Types

type ContextValueKey

type ContextValueKey string

type ControllerResources

type ControllerResources struct {
	Client            client.Client
	Scheme            *runtime.Scheme
	EventRecorder     record.EventRecorder
	OperatorNamespace string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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