serving

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 20 Imported by: 199

Documentation

Index

Constants

View Source
const (
	// DeploymentConditionReady means the underlying deployment is ready.
	DeploymentConditionReady = apis.ConditionReady
	// DeploymentConditionReplicaSetReady inverts the underlying deployment's
	// ReplicaSetFailure condition.
	DeploymentConditionReplicaSetReady apis.ConditionType = "ReplicaSetReady"
	// DeploymentConditionProgressing reflects the underlying deployment's
	// Progressing condition.
	DeploymentConditionProgressing apis.ConditionType = "Progressing"
)
View Source
const (
	// GroupName is the group name for knative labels and annotations
	GroupName = "serving.knative.dev"

	// GroupNamePrefix is the prefix for label key and annotation key
	GroupNamePrefix = GroupName + "/"

	// ConfigurationLabelKey is the label key attached to a Revision indicating by
	// which Configuration it is created.
	ConfigurationLabelKey = GroupName + "/configuration"

	// RevisionLastPinnedAnnotationKey is the annotation key used for determining when a route has
	// pinned a revision
	RevisionLastPinnedAnnotationKey = GroupName + "/lastPinned"

	// RevisionPreservedAnnotationKey is the annotation key used for preventing garbage collector
	// from automatically deleting the revision.
	RevisionPreservedAnnotationKey = GroupName + "/no-gc"

	// RouteLabelKey is the label key attached to a Configuration indicating by
	// which Route it is configured as traffic target.
	// The key is also attached to Revision resources to indicate they are directly
	// referenced by a Route, or are a child of a Configuration which is referenced by a Route.
	// The key can also be attached to Ingress resources to indicate
	// which Route triggered their creation.
	// The key is also attached to k8s Service resources to indicate which Route
	// triggered their creation.
	RouteLabelKey = GroupName + "/route"

	// RoutesAnnotationKey is an annotation attached to a Revision to indicate that it is
	// referenced by one or many routes. The value is a comma separated list of Route names.
	RoutesAnnotationKey = GroupName + "/routes"

	// RolloutDurationKey is an annotation attached to a Route to indicate the duration
	// of the rollout of the latest revision. The value must be a valid positive
	// Golang time.Duration value serialized to string.
	// The value can be specified with at most with a second precision.
	RolloutDurationKey = GroupName + "/rolloutDuration"

	// RoutingStateLabelKey is the label attached to a Revision indicating
	// its state in relation to serving a Route.
	RoutingStateLabelKey = GroupName + "/routingState"

	// RoutingStateModifiedAnnotationKey indicates the last time the RoutingStateLabel
	// was modified. This is used for ordering when Garbage Collecting old Revisions.
	RoutingStateModifiedAnnotationKey = GroupName + "/routingStateModified"

	// RouteNamespaceLabelKey is the label key attached to a Ingress
	// by a Route to indicate which namespace the Route was created in.
	RouteNamespaceLabelKey = GroupName + "/routeNamespace"

	// RevisionLabelKey is the label key attached to k8s resources to indicate
	// which Revision triggered their creation.
	RevisionLabelKey = GroupName + "/revision"

	// RevisionUID is the label key attached to a revision to indicate
	// its unique identifier
	RevisionUID = GroupName + "/revisionUID"

	// ConfigurationUIDLabelKey is the label key attached to a pod to reference its
	// Knative Configuration by its unique UID
	ConfigurationUIDLabelKey = GroupName + "/configurationUID"

	// ServiceUIDLabelKey is the label key attached to a pod to reference its
	// Knative Service by its unique UID
	ServiceUIDLabelKey = GroupName + "/serviceUID"

	// ServiceLabelKey is the label key attached to a Route and Configuration indicating by
	// which Service they are created.
	ServiceLabelKey = GroupName + "/service"

	// DomainMappingUIDLabelKey is the label key attached to Ingress resources to indicate
	// which DomainMapping triggered their creation.
	// This uses a uid rather than a name because domain mapping names can exceed
	// a label's 63 character limit.
	DomainMappingUIDLabelKey = GroupName + "/domainMappingUID"

	// DomainMappingNamespaceLabelKey is the label key attached to Ingress
	// resources created by a DomainMapping to indicate which namespace the
	// DomainMapping was created in.
	DomainMappingNamespaceLabelKey = GroupName + "/domainMappingNamespace"

	// ConfigurationGenerationLabelKey is the label key attached to a Revision indicating the
	// metadata generation of the Configuration that created this revision
	ConfigurationGenerationLabelKey = GroupName + "/configurationGeneration"

	// CreatorAnnotation is the annotation key to describe the user that
	// created the resource.
	CreatorAnnotation = GroupName + "/creator"
	// UpdaterAnnotation is the annotation key to describe the user that
	// last updated the resource.
	UpdaterAnnotation = GroupName + "/lastModifier"

	// QueueSideCarResourcePercentageAnnotation is the percentage of user container resources to be used for queue-proxy
	// It has to be in [0.1,100]
	QueueSideCarResourcePercentageAnnotation = "queue.sidecar." + GroupName + "/resourcePercentage"

	// VisibilityClusterLocal is the label value for VisibilityLabelKey
	// that will result to the Route/KService getting a cluster local
	// domain suffix.
	VisibilityClusterLocal = "cluster-local"
)

Variables

View Source
var (
	// ServicesResource represents a Knative Service
	ServicesResource = schema.GroupResource{
		Group:    GroupName,
		Resource: "services",
	}

	// ConfigurationsResource represents a Knative Configuration
	ConfigurationsResource = schema.GroupResource{
		Group:    GroupName,
		Resource: "configurations",
	}

	// RevisionsResource represents a Knative Revision
	RevisionsResource = schema.GroupResource{
		Group:    GroupName,
		Resource: "revisions",
	}

	// RoutesResource represents a Knative Route
	RoutesResource = schema.GroupResource{
		Group:    GroupName,
		Resource: "routes",
	}
)

Functions

func AllMountedVolumes added in v0.16.0

func AllMountedVolumes(containers []corev1.Container) sets.String

AllMountedVolumes returns all the mounted volumes in all the containers.

func CapabilitiesMask added in v0.24.0

func CapabilitiesMask(ctx context.Context, in *corev1.Capabilities) *corev1.Capabilities

CapabilitiesMask performs a _shallow_ copy of the Kubernetes Capabilities object to a new Kubernetes Capabilities object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ConfigMapEnvSourceMask added in v0.6.0

func ConfigMapEnvSourceMask(in *corev1.ConfigMapEnvSource) *corev1.ConfigMapEnvSource

ConfigMapEnvSourceMask performs a _shallow_ copy of the Kubernetes ConfigMapEnvSource object to a new Kubernetes ConfigMapEnvSource object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ConfigMapKeySelectorMask added in v0.6.0

func ConfigMapKeySelectorMask(in *corev1.ConfigMapKeySelector) *corev1.ConfigMapKeySelector

ConfigMapKeySelectorMask performs a _shallow_ copy of the Kubernetes ConfigMapKeySelector object to a new Kubernetes ConfigMapKeySelector object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ConfigMapProjectionMask added in v0.7.0

func ConfigMapProjectionMask(in *corev1.ConfigMapProjection) *corev1.ConfigMapProjection

ConfigMapProjectionMask performs a _shallow_ copy of the Kubernetes ConfigMapProjection object to a new Kubernetes ConfigMapProjection object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ContainerMask added in v0.6.0

func ContainerMask(in *corev1.Container) *corev1.Container

ContainerMask performs a _shallow_ copy of the Kubernetes Container object to a new Kubernetes Container object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ContainerPortMask added in v0.6.0

func ContainerPortMask(in *corev1.ContainerPort) *corev1.ContainerPort

ContainerPortMask performs a _shallow_ copy of the Kubernetes ContainerPort object to a new Kubernetes ContainerPort object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func EnvFromSourceMask added in v0.6.0

func EnvFromSourceMask(in *corev1.EnvFromSource) *corev1.EnvFromSource

EnvFromSourceMask performs a _shallow_ copy of the Kubernetes EnvFromSource object to a new Kubernetes EnvFromSource object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func EnvVarMask added in v0.6.0

func EnvVarMask(in *corev1.EnvVar) *corev1.EnvVar

EnvVarMask performs a _shallow_ copy of the Kubernetes EnvVar object to a new Kubernetes EnvVar object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func EnvVarSourceMask added in v0.6.0

func EnvVarSourceMask(in *corev1.EnvVarSource, fieldRef bool) *corev1.EnvVarSource

EnvVarSourceMask performs a _shallow_ copy of the Kubernetes EnvVarSource object to a new Kubernetes EnvVarSource object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ExecActionMask added in v0.6.0

func ExecActionMask(in *corev1.ExecAction) *corev1.ExecAction

ExecActionMask performs a _shallow_ copy of the Kubernetes ExecAction object to a new Kubernetes ExecAction object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func HTTPGetActionMask added in v0.6.0

func HTTPGetActionMask(in *corev1.HTTPGetAction) *corev1.HTTPGetAction

HTTPGetActionMask performs a _shallow_ copy of the Kubernetes HTTPGetAction object to a new Kubernetes HTTPGetAction object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func HandlerMask added in v0.6.0

func HandlerMask(in *corev1.Handler) *corev1.Handler

HandlerMask performs a _shallow_ copy of the Kubernetes Handler object to a new Kubernetes Handler object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func IsInSidecarContainer added in v0.16.0

func IsInSidecarContainer(ctx context.Context) bool

IsInSidecarContainer checks if we are in the context of a sidecar container in the revision.

func KeyToPathMask added in v0.7.0

func KeyToPathMask(in *corev1.KeyToPath) *corev1.KeyToPath

KeyToPathMask performs a _shallow_ copy of the Kubernetes KeyToPath object to a new Kubernetes KeyToPath object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func LocalObjectReferenceMask added in v0.6.0

func LocalObjectReferenceMask(in *corev1.LocalObjectReference) *corev1.LocalObjectReference

LocalObjectReferenceMask performs a _shallow_ copy of the Kubernetes LocalObjectReference object to a new Kubernetes LocalObjectReference object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func NamespacedObjectReferenceMask added in v0.6.0

func NamespacedObjectReferenceMask(in *corev1.ObjectReference) *corev1.ObjectReference

NamespacedObjectReferenceMask performs a _shallow_ copy of the Kubernetes ObjectReference object to a new Kubernetes ObjectReference object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func PodSecurityContextMask added in v0.17.0

func PodSecurityContextMask(ctx context.Context, in *corev1.PodSecurityContext) *corev1.PodSecurityContext

PodSecurityContextMask performs a _shallow_ copy of the Kubernetes PodSecurityContext object into a new Kubernetes PodSecurityContext object bringing over only the fields allowed in the Knative API. This does not validate the contents or bounds of the provided fields.

func PodSpecMask added in v0.6.0

func PodSpecMask(ctx context.Context, in *corev1.PodSpec) *corev1.PodSpec

PodSpecMask performs a _shallow_ copy of the Kubernetes PodSpec object to a new Kubernetes PodSpec object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ProbeMask added in v0.6.0

func ProbeMask(in *corev1.Probe) *corev1.Probe

ProbeMask performs a _shallow_ copy of the Kubernetes Probe object to a new Kubernetes Probe object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ResourceRequirementsMask added in v0.6.0

func ResourceRequirementsMask(in *corev1.ResourceRequirements) *corev1.ResourceRequirements

ResourceRequirementsMask performs a _shallow_ copy of the Kubernetes ResourceRequirements object to a new Kubernetes ResourceRequirements object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func SecretEnvSourceMask added in v0.6.0

func SecretEnvSourceMask(in *corev1.SecretEnvSource) *corev1.SecretEnvSource

SecretEnvSourceMask performs a _shallow_ copy of the Kubernetes SecretEnvSource object to a new Kubernetes SecretEnvSource object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func SecretKeySelectorMask added in v0.6.0

func SecretKeySelectorMask(in *corev1.SecretKeySelector) *corev1.SecretKeySelector

SecretKeySelectorMask performs a _shallow_ copy of the Kubernetes SecretKeySelector object to a new Kubernetes SecretKeySelector object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func SecretProjectionMask added in v0.7.0

func SecretProjectionMask(in *corev1.SecretProjection) *corev1.SecretProjection

SecretProjectionMask performs a _shallow_ copy of the Kubernetes SecretProjection object to a new Kubernetes SecretProjection object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func SecurityContextMask added in v0.6.0

func SecurityContextMask(ctx context.Context, in *corev1.SecurityContext) *corev1.SecurityContext

SecurityContextMask performs a _shallow_ copy of the Kubernetes SecurityContext object to a new Kubernetes SecurityContext object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func ServiceAccountTokenProjectionMask added in v0.18.0

func ServiceAccountTokenProjectionMask(in *corev1.ServiceAccountTokenProjection) *corev1.ServiceAccountTokenProjection

ServiceAccountTokenProjectionMask performs a _shallow_ copy of the Kubernetes ServiceAccountTokenProjection object to a new Kubernetes ServiceAccountTokenProjection object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func SetUserInfo added in v0.10.0

func SetUserInfo(ctx context.Context, oldSpec, newSpec, resource interface{})

SetUserInfo sets creator and updater annotations

func TCPSocketActionMask added in v0.6.0

func TCPSocketActionMask(in *corev1.TCPSocketAction) *corev1.TCPSocketAction

TCPSocketActionMask performs a _shallow_ copy of the Kubernetes TCPSocketAction object to a new Kubernetes TCPSocketAction object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func TransformDeploymentStatus added in v0.9.0

func TransformDeploymentStatus(ds *appsv1.DeploymentStatus) *duckv1.Status

TransformDeploymentStatus transforms the Kubernetes DeploymentStatus into a duckv1.Status that uses ConditionSets to propagate failures and expose a top-level happy state, per our condition conventions.

func ValidateContainer added in v0.6.0

func ValidateContainer(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume) (errs *apis.FieldError)

ValidateContainer validate fields for serving containers

func ValidateContainerConcurrency added in v0.9.0

func ValidateContainerConcurrency(ctx context.Context, containerConcurrency *int64) *apis.FieldError

ValidateContainerConcurrency function validates the ContainerConcurrency field TODO(#5007): Move this to autoscaling.

func ValidateHasNoAutoscalingAnnotation added in v0.18.0

func ValidateHasNoAutoscalingAnnotation(annotations map[string]string) (errs *apis.FieldError)

ValidateHasNoAutoscalingAnnotation validates that the respective entity does not have annotations from the autoscaling group. It's to be used to validate Service and Configuration.

func ValidateNamespacedObjectReference added in v0.6.0

func ValidateNamespacedObjectReference(p *corev1.ObjectReference) *apis.FieldError

ValidateNamespacedObjectReference validates an ObjectReference which may not contain a namespace.

func ValidateObjectMetadata added in v0.6.0

func ValidateObjectMetadata(ctx context.Context, meta metav1.Object, allowAutoscalingAnnotations bool) *apis.FieldError

ValidateObjectMetadata validates that the `metadata` stanza of the resources is correct. If `allowAutoscalingAnnotations` is true autoscaling annotations, if present, are validated. If `allowAutoscalingAnnotations` is false autoscaling annotations are validated not to be present.

func ValidatePodSecurityContext added in v0.17.0

func ValidatePodSecurityContext(ctx context.Context, sc *corev1.PodSecurityContext) *apis.FieldError

ValidatePodSecurityContext validates the PodSecurityContext struct. All fields are disallowed unless the 'PodSpecSecurityContext' feature flag is enabled

See the allowed properties in the `PodSecurityContextMask`

func ValidatePodSpec added in v0.6.0

func ValidatePodSpec(ctx context.Context, ps corev1.PodSpec) *apis.FieldError

ValidatePodSpec validates the pod spec

func ValidateRolloutDurationAnnotation added in v0.21.0

func ValidateRolloutDurationAnnotation(annos map[string]string) (errs *apis.FieldError)

ValidateRolloutDurationAnnotation validates the rollout duration annotation. This annotation can be set on either service or route objects.

func ValidateVolumes added in v0.6.0

func ValidateVolumes(ctx context.Context, vs []corev1.Volume, mountedVolumes sets.String) (map[string]corev1.Volume, *apis.FieldError)

ValidateVolumes validates the Volumes of a PodSpec.

func VolumeMask added in v0.6.0

func VolumeMask(ctx context.Context, in *corev1.Volume) *corev1.Volume

VolumeMask performs a _shallow_ copy of the Kubernetes Volume object to a new Kubernetes Volume object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func VolumeMountMask added in v0.6.0

func VolumeMountMask(in *corev1.VolumeMount) *corev1.VolumeMount

VolumeMountMask performs a _shallow_ copy of the Kubernetes VolumeMount object to a new Kubernetes VolumeMount object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func VolumeProjectionMask added in v0.7.0

func VolumeProjectionMask(in *corev1.VolumeProjection) *corev1.VolumeProjection

VolumeProjectionMask performs a _shallow_ copy of the Kubernetes VolumeProjection object to a new Kubernetes VolumeProjection object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func VolumeSourceMask added in v0.6.0

func VolumeSourceMask(ctx context.Context, in *corev1.VolumeSource) *corev1.VolumeSource

VolumeSourceMask performs a _shallow_ copy of the Kubernetes VolumeSource object to a new Kubernetes VolumeSource object bringing over only the fields allowed in the Knative API. This does not validate the contents or the bounds of the provided fields.

func WithinSidecarContainer added in v0.16.0

func WithinSidecarContainer(ctx context.Context) context.Context

WithinSidecarContainer notes on the context that further validation or defaulting is within the context of a sidecar container in the revision.

func WithinUserContainer added in v0.16.0

func WithinUserContainer(ctx context.Context) context.Context

WithinUserContainer notes on the context that further validation or defaulting is within the context of a user container in the revision.

Types

This section is empty.

Directories

Path Synopsis
Package v1 contains the Serving v1 API types.
Package v1 contains the Serving v1 API types.
Package v1alpha1 contains the v1alpha1 versions of the serving apis.
Package v1alpha1 contains the v1alpha1 versions of the serving apis.
Package v1beta1 contains the v1beta1 versions of the serving apis.
Package v1beta1 contains the v1beta1 versions of the serving apis.

Jump to

Keyboard shortcuts

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