serving

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserImageAnnotationKey = "client.knative.dev/user-image"
	ApiTooOldError         = errors.New("the service is using too old of an API format for the operation")
)

Functions

func AutoscaleWindow added in v0.12.0

func AutoscaleWindow(m *metav1.ObjectMeta) string

func ConcurrencyTarget added in v0.10.0

func ConcurrencyTarget(m *metav1.ObjectMeta) *int

func ConcurrencyTargetUtilization added in v0.13.2

func ConcurrencyTargetUtilization(m *metav1.ObjectMeta) *int

func ContainerOfRevisionSpec

func ContainerOfRevisionSpec(revisionSpec *servingv1.RevisionSpec) (*corev1.Container, error)

func ContainerOfRevisionTemplate

func ContainerOfRevisionTemplate(template *servingv1.RevisionTemplateSpec) (*corev1.Container, error)

func EnvToMap

func EnvToMap(vars []corev1.EnvVar) (map[string]string, error)

EnvToMap is an utility function to translate between the API list form of env vars, and the more convenient map form.

func FreezeImageToDigest

func FreezeImageToDigest(template *servingv1.RevisionTemplateSpec, baseRevision *servingv1.Revision) error

FreezeImageToDigest sets the image on the template to the image digest of the base revision.

func GenerateRevisionName

func GenerateRevisionName(nameTempl string, service *servingv1.Service) (string, error)

GenerateRevisionName returns an automatically-generated name suitable for the next revision of the given service.

func GenerateVolumeName added in v0.10.0

func GenerateVolumeName(path string) string

GenerateVolumeName generates a volume name with respect to a given path string. Current implementation basically sanitizes the path string by replacing "/" with "-" To reduce any chance of duplication, a checksum part generated from the path string is appended to the sanitized string. The volume name must follow the DNS label standard as defined in RFC 1123. This means the name must: - contain at most 63 characters - contain only lowercase alphanumeric characters or '-' - start with an alphanumeric character - end with an alphanumeric character

func Port added in v0.10.0

func Port(revisionSpec *servingv1.RevisionSpec) *int32

func SetUserImageAnnot

func SetUserImageAnnot(template *servingv1.RevisionTemplateSpec)

SetUserImageAnnot sets the user image annotation if the image isn't by-digest already.

func UnsetUserImageAnnot

func UnsetUserImageAnnot(template *servingv1.RevisionTemplateSpec)

UnsetUserImageAnnot removes the user image annotation

func UpdateAnnotations

func UpdateAnnotations(
	service *servingv1.Service,
	template *servingv1.RevisionTemplateSpec,
	toUpdate map[string]string,
	toRemove []string) error

UpdateAnnotations updates the annotations identically on a service and template. Does not overwrite the entire Annotations field, only makes the requested updates.

func UpdateAutoscaleWindow added in v0.12.0

func UpdateAutoscaleWindow(template *servingv1.RevisionTemplateSpec, window string) error

UpdateAutoscaleWindow updates the autoscale window annotation

func UpdateConcurrencyLimit

func UpdateConcurrencyLimit(template *servingv1.RevisionTemplateSpec, limit int64) error

UpdateConcurrencyLimit updates container concurrency limit

func UpdateConcurrencyTarget

func UpdateConcurrencyTarget(template *servingv1.RevisionTemplateSpec, target int) error

UpdateConcurrencyTarget updates container concurrency annotation

func UpdateConcurrencyUtilization added in v0.13.2

func UpdateConcurrencyUtilization(template *servingv1.RevisionTemplateSpec, target int) error

UpdateConcurrencyUtilization updates container target utilization percentage annotation

func UpdateContainerArg added in v0.13.0

func UpdateContainerArg(template *servingv1.RevisionTemplateSpec, arg []string) error

UpdateContainerArg updates container with a given argument

func UpdateContainerCommand added in v0.13.0

func UpdateContainerCommand(template *servingv1.RevisionTemplateSpec, command string) error

UpdateContainerCommand updates container with a given argument

func UpdateContainerPort

func UpdateContainerPort(template *servingv1.RevisionTemplateSpec, port string) error

UpdateContainerPort updates container with a given name:port

func UpdateEnvFrom added in v0.10.0

func UpdateEnvFrom(template *servingv1.RevisionTemplateSpec, toUpdate []string, toRemove []string) error

UpdateEnvFrom updates envFrom

func UpdateEnvVars

func UpdateEnvVars(template *servingv1.RevisionTemplateSpec, toUpdate map[string]string, toRemove []string) error

UpdateEnvVars gives the configuration all the env var values listed in the given map of vars. Does not touch any environment variables not mentioned, but it can add new env vars and change the values of existing ones, then sort by env key name.

func UpdateImage

func UpdateImage(template *servingv1.RevisionTemplateSpec, image string) error

UpdateImage a given image

func UpdateImagePullSecrets added in v0.12.0

func UpdateImagePullSecrets(template *servingv1.RevisionTemplateSpec, pullsecrets string)

UpdateImagePullSecrets updates the image pull secrets used for the corresponding knative service

func UpdateLabels

func UpdateLabels(labelsMap map[string]string, add map[string]string, remove []string) map[string]string

UpdateLabels updates the labels by adding items from `add` then removing any items from `remove`

func UpdateMaxScale

func UpdateMaxScale(template *servingv1.RevisionTemplateSpec, max int) error

UpdateMaxScale updates max scale annotation

func UpdateMinScale

func UpdateMinScale(template *servingv1.RevisionTemplateSpec, min int) error

UpdateMinScale updates min scale annotation

func UpdateResources

func UpdateResources(template *servingv1.RevisionTemplateSpec, resources corev1.ResourceRequirements, requestsToRemove, limitsToRemove []string) error

UpdateResources updates container resources for given revision template

func UpdateResourcesDeprecated added in v0.15.0

func UpdateResourcesDeprecated(template *servingv1.RevisionTemplateSpec, requestsResourceList corev1.ResourceList, limitsResourceList corev1.ResourceList) error

UpdateResourcesDeprecated updates resources as requested

func UpdateRevisionTemplateAnnotation

func UpdateRevisionTemplateAnnotation(template *servingv1.RevisionTemplateSpec, annotation string, value string) error

UpdateRevisionTemplateAnnotation updates an annotation for the given Revision Template. Also validates the autoscaling annotation values

func UpdateServiceAccountName

func UpdateServiceAccountName(template *servingv1.RevisionTemplateSpec, serviceAccountName string) error

UpdateServiceAccountName updates the service account name used for the corresponding knative service

func UpdateUser added in v0.13.0

func UpdateUser(template *servingv1.RevisionTemplateSpec, user int64) error

UpdateRunAsUser updates container with a given user id

func UpdateVolumeMountsAndVolumes added in v0.10.0

func UpdateVolumeMountsAndVolumes(template *servingv1.RevisionTemplateSpec,
	mountsToUpdate *util.OrderedMap, mountsToRemove []string, volumesToUpdate *util.OrderedMap, volumesToRemove []string) error

UpdateVolumeMountsAndVolumes updates the configuration for volume mounts and volumes.

func UserImage added in v0.10.0

func UserImage(m *metav1.ObjectMeta) string

Types

type Scaling added in v0.10.0

type Scaling struct {
	Min *int
	Max *int
}

func ScalingInfo added in v0.10.0

func ScalingInfo(m *metav1.ObjectMeta) (*Scaling, error)

type VolumeSourceType added in v0.10.0

type VolumeSourceType int

VolumeSourceType is a type standing for enumeration of ConfigMap and Secret

const (
	ConfigMapVolumeSourceType VolumeSourceType = iota
	SecretVolumeSourceType
	PortFormatErr = "" /* 154-byte string literal not displayed */
)

Enumeration of volume source types: ConfigMap or Secret

func (VolumeSourceType) String added in v0.10.0

func (vt VolumeSourceType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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