common

package
v0.0.0-...-81d30be Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 40 Imported by: 8

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"
	// IstiodTLSSecretCertKey name of Secret entry containing intermediate certificate for Istio provided by cert-manager
	IstiodTLSSecretCertKey = "tls.crt"
	// 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 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 Reconciled

func Reconciled() (reconcile.Result, error)

func RemoveFinalizer

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

func RequeueAfter

func RequeueAfter(time time.Duration) (reconcile.Result, error)

func RequeueWithError

func RequeueWithError(err error) (reconcile.Result, 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
	DiscoveryClient   discovery.DiscoveryInterface
}

type DiscoveryClientProvider

type DiscoveryClientProvider interface {
	GetDiscoveryClient() discovery.DiscoveryInterface
}

type EnhancedManager

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

func (EnhancedManager) Add

func (m EnhancedManager) Add(runnable manager.Runnable) error

func (EnhancedManager) AddHealthzCheck

func (m EnhancedManager) AddHealthzCheck(name string, check healthz.Checker) error

func (EnhancedManager) AddMetricsExtraHandler

func (m EnhancedManager) AddMetricsExtraHandler(path string, handler http.Handler) error

func (EnhancedManager) AddReadyzCheck

func (m EnhancedManager) AddReadyzCheck(name string, check healthz.Checker) error

func (EnhancedManager) Elected

func (m EnhancedManager) Elected() <-chan struct{}

func (EnhancedManager) GetAPIReader

func (m EnhancedManager) GetAPIReader() client.Reader

func (EnhancedManager) GetCache

func (m EnhancedManager) GetCache() cache.Cache

func (EnhancedManager) GetClient

func (m EnhancedManager) GetClient() client.Client

func (EnhancedManager) GetConfig

func (m EnhancedManager) GetConfig() *rest.Config

func (EnhancedManager) GetDiscoveryClient

func (m EnhancedManager) GetDiscoveryClient() discovery.DiscoveryInterface

func (EnhancedManager) GetEventRecorderFor

func (m EnhancedManager) GetEventRecorderFor(name string) record.EventRecorder

func (EnhancedManager) GetFieldIndexer

func (m EnhancedManager) GetFieldIndexer() client.FieldIndexer

func (EnhancedManager) GetLogger

func (m EnhancedManager) GetLogger() logr.Logger

func (EnhancedManager) GetRESTMapper

func (m EnhancedManager) GetRESTMapper() meta.RESTMapper

func (EnhancedManager) GetScheme

func (m EnhancedManager) GetScheme() *runtime.Scheme

func (EnhancedManager) GetWebhookServer

func (m EnhancedManager) GetWebhookServer() *webhook.Server

func (EnhancedManager) SetFields

func (m EnhancedManager) SetFields(fields interface{}) error

func (EnhancedManager) Start

func (m EnhancedManager) Start(ch <-chan struct{}) error

type StatusPatch

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

func NewStatusPatch

func NewStatusPatch(status interface{}) *StatusPatch

func (*StatusPatch) Data

func (p *StatusPatch) Data(obj runtime.Object) ([]byte, error)

func (*StatusPatch) Type

func (p *StatusPatch) Type() types.PatchType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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