admisionrequest

package
v0.0.0-...-035f276 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	// Container name
	Name string
	// Image name
	Image string
}

Container represents container object.

type ContainersPath

type ContainersPath string

ContainersPath Declare ContainersPath enum.

type Extractor

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

Extractor implements extractor from admission request to workload resource.

func NewExtractor

func NewExtractor(instrumentationProvider instrumentation.IInstrumentationProvider, configuration *ExtractorConfiguration) *Extractor

NewExtractor Constructor for Extractor

func (*Extractor) ExtractWorkloadResourceFromAdmissionRequest

func (extractor *Extractor) ExtractWorkloadResourceFromAdmissionRequest(req *admission.Request) (resource *WorkloadResource, err error)

ExtractWorkloadResourceFromAdmissionRequest return WorkloadResource object according to the information in admission.Request.

type ExtractorConfiguration

type ExtractorConfiguration struct {
	SupportedKubernetesWorkloadResources []string
}

ExtractorConfiguration configuration for extractor

type IExtractor

type IExtractor interface {
	// ExtractWorkloadResourceFromAdmissionRequest return WorkloadResource object according
	// to the information in admission.Request.
	ExtractWorkloadResourceFromAdmissionRequest(req *admission.Request) (*WorkloadResource, error)
}

IExtractor represents interface for admission request extractor.

type ObjectMetadata

type ObjectMetadata struct {
	// Name is the resource's name.
	Name string
	// Namespace defines the space within which each name must be unique. An empty namespace is
	// equivalent to the "default" namespace, but "default" is the canonical representation.
	// Not all objects are required to be scoped to a namespace - the value of this field for
	// those objects will be empty.
	Namespace string
	// Annotations is an unstructured key value map stored with a resource that may be
	// set by external tools to store and retrieve arbitrary metadata. They are not
	// queryable and should be preserved when modifying objects.
	Annotations map[string]string
	// List of objects depended by this object. If ALL objects in the list have
	// been deleted, this object will be garbage collected. If this object is managed by a controller,
	// then an entry in this list will point to this controller, with the controller field set to true.
	// There cannot be more than one managing controller.
	OwnerReferences []*OwnerReference
}

ObjectMetadata represents the metadata of WorkloadResource object.

type OwnerReference

type OwnerReference struct {
	// API version of the referent.
	APIVersion string
	// Kind of the referent.
	Kind string
	// Name of the referent.
	Name string
}

OwnerReference contains information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.

type PodSpec

type PodSpec struct {
	// Containers is a list of Container objects.
	Containers []*Container
	// InitContainers is a list of Container objects.
	InitContainers []*Container
	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
	// If specified, these secrets will be passed to individual puller implementations for them to use.  For example,
	// in the case of docker, only DockerConfig type secrets are honored.
	ImagePullSecrets []*corev1.LocalObjectReference
	// ServiceAccountName is the name of the ServiceAccount to use to run this WorkloadResource
	// The WorkloadResource will be allowed to use secrets referenced by the ServiceAccount
	ServiceAccountName string
}

PodSpec represents a specification of the desired behavior of the WorkloadResource.

func (*PodSpec) ExtractContainersFromPodSpecAsString

func (podSpec *PodSpec) ExtractContainersFromPodSpecAsString() []string

ExtractContainersFromPodSpecAsString gets pod spec and returns all containers as containerName:image used by the pod as String. For example appContainer:alpine

type WorkloadResource

type WorkloadResource struct {
	// WorkloadResource metadata
	Metadata *ObjectMetadata
	// Spec defines the behavior of a WorkloadResource.
	Spec *PodSpec
}

WorkloadResource represents an abstraction of a kubernetes workload resources such as: Pod, Deployments, ReplicaSet, StatefulSets, DaemonSet, Jobs, CronJob and ReplicationController.

Jump to

Keyboard shortcuts

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