v1

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultService

func DefaultService(name, namespace string, so ...ServiceOption) *v1.Service

DefaultService creates a service with ServiceOptions and with default values set

func MarkActive

func MarkActive(r *v1.Revision)

MarkActive calls .Status.MarkActive on the Revision.

func MarkCertificateNotOwned

func MarkCertificateNotOwned(r *v1.Route)

MarkCertificateNotOwned calls the method of the same name on .Status

func MarkCertificateNotReady

func MarkCertificateNotReady(r *v1.Route)

MarkCertificateNotReady calls the method of the same name on .Status

func MarkCertificateReady

func MarkCertificateReady(r *v1.Route)

MarkCertificateReady calls the method of the same name on .Status

func MarkConfigurationNotOwned

func MarkConfigurationNotOwned(service *v1.Service)

MarkConfigurationNotOwned calls the function of the same name on the Service's status.

func MarkConfigurationNotReconciled

func MarkConfigurationNotReconciled(service *v1.Service)

MarkConfigurationNotReconciled calls the function of the same name on the Service's status.

func MarkContainerMissing

func MarkContainerMissing(rev *v1.Revision)

MarkContainerMissing calls .Status.MarkContainerMissing on the Revision.

func MarkIngressNotConfigured

func MarkIngressNotConfigured(r *v1.Route)

MarkIngressNotConfigured calls the method of the same name on .Status

func MarkIngressReady

func MarkIngressReady(r *v1.Route)

MarkIngressReady propagates a Ready=True Ingress status to the Route.

func MarkRevisionNameTaken

func MarkRevisionNameTaken(service *v1.Service)

MarkRevisionNameTaken calls the function of the same name on the Service's status

func MarkRevisionReady

func MarkRevisionReady(r *v1.Revision)

MarkRevisionReady calls the necessary helpers to make the Revision Ready=True.

func MarkRouteNotOwned

func MarkRouteNotOwned(service *v1.Service)

MarkRouteNotOwned calls the function of the same name on the Service's status.

func MarkServiceNotOwned

func MarkServiceNotOwned(r *v1.Route)

MarkServiceNotOwned calls the function of the same name on the Service's status.

func MarkTrafficAssigned

func MarkTrafficAssigned(r *v1.Route)

MarkTrafficAssigned calls the method of the same name on .Status

func Route

func Route(namespace, name string, ro ...RouteOption) *v1.Route

Route creates a route with RouteOptions

func Service

func Service(name, namespace string, so ...ServiceOption) *v1.Service

Service creates a service with ServiceOptions

func ServiceWithoutNamespace

func ServiceWithoutNamespace(name string, so ...ServiceOption) *v1.Service

ServiceWithoutNamespace creates a service with ServiceOptions but without a specific namespace

func WithAddress

func WithAddress(r *v1.Route)

WithAddress sets the .Status.Address field to the prototypical internal hostname.

func WithAnotherDomain

func WithAnotherDomain(r *v1.Route)

WithAnotherDomain sets the .Status.Domain field to an atypical domain.

func WithConfigDeletionTimestamp

func WithConfigDeletionTimestamp(r *v1.Configuration)

func WithConfigOwnersRemoved

func WithConfigOwnersRemoved(cfg *v1.Configuration)

WithConfigOwnersRemoved clears the owner references of this Configuration.

func WithHTTPSDomain

func WithHTTPSDomain(r *v1.Route)

func WithInitRevConditions

func WithInitRevConditions(r *v1.Revision)

WithInitRevConditions calls .Status.InitializeConditions() on a Revision.

func WithInitRouteConditions

func WithInitRouteConditions(rt *v1.Route)

WithInitRouteConditions initializes the Service's conditions.

func WithInitSvcConditions

func WithInitSvcConditions(s *v1.Service)

WithInitSvcConditions initializes the Service's conditions.

func WithLocalDomain

func WithLocalDomain(r *v1.Route)

WithLocalDomain sets the .Status.Domain field to use `svc.cluster.local` suffix.

func WithLogURL

func WithLogURL(r *v1.Revision)

WithLogURL sets the .Status.LogURL to the expected value.

func WithNamedRevision

func WithNamedRevision(s *v1.Service)

WithNamedRevision configures the Service to use BYO Revision in the template spec and reference that same revision name in the route spec.

func WithObservedGen

func WithObservedGen(cfg *v1.Configuration)

WithObservedGen sets the observed generation of the Configuration.

func WithOutOfDateConfig

func WithOutOfDateConfig(s *v1.Service)

WithOutOfDateConfig reflects the Configuration's readiness in the Service resource.

func WithReadyCertificateName

func WithReadyCertificateName(name string) func(*v1.Route)

WithReadyCertificateName marks the certificate specified by name as ready.

func WithReadyRoute

func WithReadyRoute(s *v1.Service)

WithReadyRoute reflects the Route's readiness in the Service resource.

func WithRevisionDeletionTimestamp

func WithRevisionDeletionTimestamp(r *v1.Revision)

WithRevisionDeletionTimestamp will set the DeletionTimestamp on the Revision.

func WithRouteFinalizer

func WithRouteFinalizer(r *v1.Route)

WithRouteFinalizer adds the Route finalizer to the Route.

func WithRouteObservedGeneration

func WithRouteObservedGeneration(r *v1.Route)

WithRouteObservedGeneneration sets the route's observed generation to it's generation

func WithRouteOwnersRemoved

func WithRouteOwnersRemoved(r *v1.Route)

WithRouteOwnersRemoved clears the owner references of this Route.

func WithRunLatestRollout

func WithRunLatestRollout(s *v1.Service)

WithRunLatestRollout configures the Service to use a "runLatest" rollout.

func WithServiceDefaults

func WithServiceDefaults(svc *v1.Service)

WithServiceDefaults will set the default values on the service.

func WithServiceDeletionTimestamp

func WithServiceDeletionTimestamp(r *v1.Service)

WithServiceDeletionTimestamp will set the DeletionTimestamp on the Service.

func WithServiceObservedGeneration

func WithServiceObservedGeneration(svc *v1.Service)

WithServiceObservedGeneration sets the service's observed generation to it's generation

func WithServiceStatusRouteNotReady

func WithServiceStatusRouteNotReady(s *v1.Service)

WithServiceStatusRouteNotReady sets the `RoutesReady` condition on the service to `Unknown`.

func WithSvcStatusAddress

func WithSvcStatusAddress(s *v1.Service)

WithSvcStatusAddress updates the service's status with the address.

func WithSvcStatusDomain

func WithSvcStatusDomain(s *v1.Service)

WithSvcStatusDomain propagates the domain name to the status of the Service.

func WithURL

func WithURL(r *v1.Route)

WithURL sets the .Status.Domain field to the prototypical domain.

Types

type ConfigOption

type ConfigOption func(*v1.Configuration)

ConfigOption enables further configuration of a Configuration.

func MarkLatestCreatedFailed

func MarkLatestCreatedFailed(msg string) ConfigOption

MarkLatestCreatedFailed calls .Status.MarkLatestCreatedFailed.

func MarkRevisionCreationFailed

func MarkRevisionCreationFailed(msg string) ConfigOption

MarkRevisionCreationFailed calls .Status.MarkRevisionCreationFailed.

func WithConfigContainerConcurrency

func WithConfigContainerConcurrency(cc int64) ConfigOption

WithConfigContainerConcurrency sets the given Configuration's concurrency.

func WithConfigImage

func WithConfigImage(img string) ConfigOption

WithConfigImage sets the container image to be the provided string.

func WithConfigLabel

func WithConfigLabel(key, value string) ConfigOption

WithConfigLabel attaches a particular label to the configuration.

func WithConfigReadinessProbe

func WithConfigReadinessProbe(p *corev1.Probe) ConfigOption

WithConfigReadinessProbe sets the provided probe to be the readiness probe on the configuration.

func WithGeneration

func WithGeneration(gen int64) ConfigOption

WithGeneration sets the generation of the Configuration.

func WithLatestCreated

func WithLatestCreated(name string) ConfigOption

WithLatestCreated initializes the .status.latestCreatedRevisionName to be the name of the latest revision that the Configuration would have created.

func WithLatestReady

func WithLatestReady(name string) ConfigOption

WithLatestReady initializes the .status.latestReadyRevisionName to be the name of the latest revision that the Configuration would have created.

type RevisionOption

type RevisionOption func(*v1.Revision)

RevisionOption enables further configuration of a Revision.

func MarkActivating

func MarkActivating(reason, message string) RevisionOption

MarkActivating calls .Status.MarkActivating on the Revision.

func MarkContainerExiting

func MarkContainerExiting(exitCode int32, message string) RevisionOption

MarkContainerExiting calls .Status.MarkContainerExiting on the Revision.

func MarkDeploying

func MarkDeploying(reason string) RevisionOption

MarkDeploying calls .Status.MarkDeploying on the Revision.

func MarkInactive

func MarkInactive(reason, message string) RevisionOption

MarkInactive calls .Status.MarkInactive on the Revision.

func MarkProgressDeadlineExceeded

func MarkProgressDeadlineExceeded(message string) RevisionOption

MarkProgressDeadlineExceeded calls the method of the same name on the Revision with the message we expect the Revision Reconciler to pass.

func MarkResourceNotOwned

func MarkResourceNotOwned(kind, name string) RevisionOption

MarkResourceNotOwned calls the function of the same name on the Revision's status.

func MarkResourcesUnavailable

func MarkResourcesUnavailable(reason, message string) RevisionOption

MarkResourcesUnavailable calls .Status.MarkResourcesUnavailable on the Revision.

func WithCreationTimestamp

func WithCreationTimestamp(t time.Time) RevisionOption

WithCreationTimestamp sets the Revision's timestamp to the provided time. TODO(mattmoor): Ideally this could be a more generic Option and use meta.Accessor, but unfortunately Go's type system cannot support that.

func WithImagePullSecrets

func WithImagePullSecrets(secretName string) RevisionOption

WithImagePullSecrets updates the revision spec ImagePullSecrets to the provided secrets

func WithLastPinned

func WithLastPinned(t time.Time) RevisionOption

WithLastPinned updates the "last pinned" annotation to the provided timestamp.

func WithRevContainerConcurrency

func WithRevContainerConcurrency(cc int64) RevisionOption

WithRevContainerConcurrency sets the given Revision's concurrency.

func WithRevName

func WithRevName(name string) RevisionOption

WithRevName sets the name of the revision

func WithRevStatus

func WithRevStatus(st v1.RevisionStatus) RevisionOption

WithRevStatus is a generic escape hatch for creating hard-to-craft status orientations.

func WithRevisionLabel

func WithRevisionLabel(key, value string) RevisionOption

WithRevisionLabel attaches a particular label to the revision.

func WithServiceName

func WithServiceName(sn string) RevisionOption

WithServiceName propagates the given service name to the revision status.

type RouteOption

type RouteOption func(*v1.Route)

RouteOption enables further configuration of a Route.

func MarkConfigurationFailed

func MarkConfigurationFailed(name string) RouteOption

MarkConfigurationFailed calls the method of the same name on .Status

func MarkConfigurationNotReady

func MarkConfigurationNotReady(name string) RouteOption

MarkConfigurationNotReady calls the method of the same name on .Status

func MarkMissingTrafficTarget

func MarkMissingTrafficTarget(kind, revision string) RouteOption

MarkMissingTrafficTarget calls the method of the same name on .Status

func WithConfigTarget

func WithConfigTarget(config string) RouteOption

WithConfigTarget sets the Route's traffic block to point at a particular Configuration.

func WithIngressClass

func WithIngressClass(ingressClass string) RouteOption

WithIngressClass sets the ingress class annotation on the Route.

func WithRevTarget

func WithRevTarget(revision string) RouteOption

WithRevTarget sets the Route's traffic block to point at a particular Revision.

func WithRouteAnnotation

func WithRouteAnnotation(annotation map[string]string) RouteOption

WithRouteAnnotation sets the specified annotation on the Route.

func WithRouteDeletionTimestamp

func WithRouteDeletionTimestamp(t *metav1.Time) RouteOption

WithRouteDeletionTimestamp adds the Route finalizer to the Route.

func WithRouteGeneration

func WithRouteGeneration(generation int64) RouteOption

WithRouteGeneration sets the route's generation

func WithRouteLabel

func WithRouteLabel(labels map[string]string) RouteOption

WithRouteLabel sets the specified label on the Route.

func WithRouteUID

func WithRouteUID(uid types.UID) RouteOption

WithRouteUID sets the Route's UID

func WithSpecTraffic

func WithSpecTraffic(traffic ...v1.TrafficTarget) RouteOption

WithSpecTraffic sets the Route's traffic block to the specified traffic targets.

func WithStatusTraffic

func WithStatusTraffic(traffic ...v1.TrafficTarget) RouteOption

WithStatusTraffic sets the Route's status traffic block to the specified traffic targets.

type ServiceOption

type ServiceOption func(*v1.Service)

ServiceOption enables further configuration of a Service.

func WithConfigSpec

func WithConfigSpec(config v1.ConfigurationSpec) ServiceOption

WithConfigSpec confgures the Service to use the given config spec

func WithContainerConcurrency

func WithContainerConcurrency(cc int64) ServiceOption

WithContainerConcurrency sets the given Service's concurrency.

func WithEnv

func WithEnv(evs ...corev1.EnvVar) ServiceOption

WithEnv configures the Service to use the provided environment variables.

func WithEnvFrom

func WithEnvFrom(evs ...corev1.EnvFromSource) ServiceOption

WithEnvFrom configures the Service to use the provided environment variables.

func WithFailedConfig

func WithFailedConfig(name, reason, message string) ServiceOption

WithFailedConfig reflects the Configuration's failure in the Service resource. The failing revision's name is reflected in LatestCreated.

func WithFailedRoute

func WithFailedRoute(reason, message string) ServiceOption

WithFailedRoute reflects a Route's failure in the Service resource.

func WithNamedPort

func WithNamedPort(name string) ServiceOption

WithNamedPort sets the name on the Service's port to the provided name

func WithNumberedPort

func WithNumberedPort(number int32) ServiceOption

WithNumberedPort sets the Service's port number to what's provided.

func WithReadyConfig

func WithReadyConfig(name string) ServiceOption

WithReadyConfig reflects the Configuration's readiness in the Service resource. This must coincide with the setting of Latest{Created,Ready} to the provided revision name.

func WithResourceRequirements

func WithResourceRequirements(resourceRequirements corev1.ResourceRequirements) ServiceOption

WithResourceRequirements attaches resource requirements to the service

func WithRevisionTimeoutSeconds

func WithRevisionTimeoutSeconds(revisionTimeoutSeconds int64) ServiceOption

WithRevisionTimeoutSeconds sets revision timeout

func WithRouteSpec

func WithRouteSpec(route v1.RouteSpec) ServiceOption

WithRouteSpec configures the Service to use the given route spec

func WithSecurityContext

func WithSecurityContext(sc *corev1.SecurityContext) ServiceOption

WithSecurityContext configures the Service to use the provided security context.

func WithServiceAccountName

func WithServiceAccountName(serviceAccountName string) ServiceOption

WithServiceAccountName sets revision service account name

func WithServiceAnnotation

func WithServiceAnnotation(k, v string) ServiceOption

WithServiceAnnotation adds the given annotation to the service.

func WithServiceAnnotationRemoved

func WithServiceAnnotationRemoved(k string) ServiceOption

WithServiceAnnotationRemoved adds the given annotation to the service.

func WithServiceAnnotations

func WithServiceAnnotations(annotations map[string]string) ServiceOption

WithServiceAnnotations adds the supplied annotations to the Service

func WithServiceGeneration

func WithServiceGeneration(generation int64) ServiceOption

WithServiceGeneration sets the service's generation

func WithServiceImage

func WithServiceImage(img string) ServiceOption

WithServiceImage sets the container image to be the provided string.

func WithServiceLabel

func WithServiceLabel(key, value string) ServiceOption

WithServiceLabel attaches a particular label to the service.

func WithServiceLatestReadyRevision

func WithServiceLatestReadyRevision(lrr string) ServiceOption

WithServiceLatestReadyRevision sets the latest ready revision on the Service's status.

func WithServiceTemplateMeta

func WithServiceTemplateMeta(m metav1.ObjectMeta) ServiceOption

WithServiceTemplateMeta sets the container image to be the provided string.

func WithSvcStatusTraffic

func WithSvcStatusTraffic(targets ...v1.TrafficTarget) ServiceOption

WithSvcStatusTraffic sets the Service's status traffic block to the specified traffic targets.

func WithVolume

func WithVolume(name, mountPath string, volumeSource corev1.VolumeSource) ServiceOption

WithVolume adds a volume to the service

func WithWorkingDir

func WithWorkingDir(wd string) ServiceOption

WithWorkingDir configures the Service to use the provided working directory.

Jump to

Keyboard shortcuts

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