Documentation
¶
Index ¶
- Constants
- func AtLeaseOneEnabled(config druidconfigv1alpha1.WebhookConfiguration) bool
- func CreateObjectKey(partialObjMeta *metav1.PartialObjectMetadata) client.ObjectKey
- func DetermineStatusCode(err error) int32
- func GetGroupKindFromRequest(req admission.Request) schema.GroupKind
- func GetReconcilerServiceAccountFQDN(config druidconfigv1alpha1.EtcdComponentProtectionWebhookConfiguration) (string, error)
- func ServiceAccountMatchesUsername(namespace, serviceAccountName, username string) bool
- type RequestDecoder
Constants ¶
const ( // ErrDecodeRequestObject indicates an error in decoding the request object. ErrDecodeRequestObject = "ERR_DECODE_REQUEST_OBJECT" // ErrGetStatefulSet indicates an error in fetching the StatefulSet resource. ErrGetStatefulSet = "ERR_GET_SCALE_SUBRESOURCE_PARENT" // ErrTooManyMatchingStatefulSets indicates that more than one StatefulSet was found for the given labels. ErrTooManyMatchingStatefulSets = "ERR_TOO_MANY_MATCHING_STATEFULSETS" )
Variables ¶
This section is empty.
Functions ¶
func AtLeaseOneEnabled ¶ added in v0.31.0
func AtLeaseOneEnabled(config druidconfigv1alpha1.WebhookConfiguration) bool
AtLeaseOneEnabled returns true if at least one webhook is enabled. NOTE for contributors: For every new webhook, add a disjunction condition with the webhook's Enabled field.
func CreateObjectKey ¶
func CreateObjectKey(partialObjMeta *metav1.PartialObjectMetadata) client.ObjectKey
CreateObjectKey creates a client.ObjectKey from the given PartialObjectMetadata.
func DetermineStatusCode ¶
DetermineStatusCode determines the HTTP status code based on the given error.
func GetGroupKindFromRequest ¶
GetGroupKindFromRequest returns the GroupKind from the given admission request.
func GetReconcilerServiceAccountFQDN ¶ added in v0.31.0
func GetReconcilerServiceAccountFQDN(config druidconfigv1alpha1.EtcdComponentProtectionWebhookConfiguration) (string, error)
GetReconcilerServiceAccountFQDN constructs the fully qualified domain name of a service account from PodInfo. It reads the mounted files for namespace and service account name. If there is any error reading the files then it will return an error.
func ServiceAccountMatchesUsername ¶
ServiceAccountMatchesUsername checks whether the provided username matches the namespace and name Use this when checking a service account namespace and name against a known string.
Types ¶
type RequestDecoder ¶
type RequestDecoder struct {
// contains filtered or unexported fields
}
RequestDecoder is a decoder for admission requests.
func NewRequestDecoder ¶
func NewRequestDecoder(mgr manager.Manager) *RequestDecoder
NewRequestDecoder returns a new RequestDecoder.
func (*RequestDecoder) DecodeRequestObjectAsPartialObjectMetadata ¶
func (d *RequestDecoder) DecodeRequestObjectAsPartialObjectMetadata(ctx context.Context, req admission.Request) (*metav1.PartialObjectMetadata, error)
DecodeRequestObjectAsPartialObjectMetadata decodes the request object as a PartialObjectMetadata.