internal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PodArgumentor

type PodArgumentor struct {
	SSPodId SSPodIdentifier

	Collector annotation.QualifiedAnnotationCollector
	// contains filtered or unexported fields
}

PodArgumentor receives the admission request from API server when a Pod resource is created or updated

func (*PodArgumentor) Handle

func (*PodArgumentor) InjectDecoder

func (r *PodArgumentor) InjectDecoder(decoder *admission.Decoder) error

func (*PodArgumentor) Register

func (r *PodArgumentor) Register(h annotation.Handler)

func (*PodArgumentor) SetupWebhookWithManager

func (r *PodArgumentor) SetupWebhookWithManager(mgr ctrl.Manager)

type SSPodIdentifier

type SSPodIdentifier interface {
	Extract(accessor v1.ObjectMetaAccessor) (string, int, error)
}

type SSPodIdentifierFunc

type SSPodIdentifierFunc func(v1.ObjectMetaAccessor) (string, int, error)
var LabelSSPodIdentifier SSPodIdentifierFunc = func(accessor v1.ObjectMetaAccessor) (string, int, error) {
	l, ok := accessor.GetObjectMeta().GetLabels()["statefulset.kubernetes.io/pod-name"]
	if !ok {
		podIdentifierLog.Info("statefulset label not found", "label", "statefulset.kubernetes.io/pod-name")
		return "", -1, errors.New("missing statefulset label")
	}
	podIdentifierLog.Info("stateful pod name", "name", l)
	if b, err := regexp.MatchString(".+-\\d+", l); err != nil || !b {
		return "", -1, errors.New("unexpected label value")
	}
	i := strings.LastIndex(l, "-")
	ordinal, _ := strconv.Atoi(l[i+1:])
	return l[:i], ordinal, nil
}

func (SSPodIdentifierFunc) Extract

func (f SSPodIdentifierFunc) Extract(accessor v1.ObjectMetaAccessor) (string, int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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