v1alpha1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	// DefaultHealthCheckProbeTimeout holds the default timeout to be applied to
	// healthchecks in seconds. This matches Cloud Foundry's default timeout.
	DefaultHealthCheckProbeTimeout = 60

	// DefaultHealthCheckProbeEndpoint is the default endpoint to use for HTTP
	// Get health checks.
	DefaultHealthCheckProbeEndpoint = "/"

	// DefaultHealthCheckPeriodSeconds holds the default period between health
	// check polls.
	DefaultHealthCheckPeriodSeconds = 10

	// DefaultHealthCheckFailureThreshold is the number of times the probe can
	// return a failure before the app is considered bad.
	DefaultHealthCheckFailureThreshold = 3
)
View Source
const (
	// AppConditionReady is set when the app is configured
	// and is usable by developers.
	AppConditionReady = apis.ConditionReady
	// AppConditionSourceReady is set when the build is ready.
	AppConditionSourceReady apis.ConditionType = "SourceReady"
	// AppConditionKnativeServiceReady is set when service is ready.
	AppConditionKnativeServiceReady apis.ConditionType = "KnativeServiceReady"
	// AppConditionSpaceReady is used to indicate when the space has an error that
	// causes apps to not reconcile correctly.
	AppConditionSpaceReady apis.ConditionType = "SpaceReady"
	// AppConditionRouteReady is set when route is ready.
	AppConditionRouteReady apis.ConditionType = "RouteReady"
	// AppConditionEnvVarSecretReady is set when env var secret is ready.
	AppConditionEnvVarSecretReady apis.ConditionType = "EnvVarSecretReady"
	// AppConditionServiceBindingsReady is set when all service bindings are ready.
	AppConditionServiceBindingsReady apis.ConditionType = "ServiceBindingsReady"
)

ConditionType represents a Service condition value

View Source
const (
	// NameLabel holds the standard label key for Kubernetes app names.
	NameLabel = "app.kubernetes.io/name"
	// ManagedByLabel holds the standard label key for Kubernetes app managers.
	ManagedByLabel = "app.kubernetes.io/managed-by"
	// ComponentLabel holds the standard label key for Kubernetes app component
	// identifiers.
	ComponentLabel = "app.kubernetes.io/component"
)
View Source
const (
	// RouteHostname is the hostname of a route.
	RouteHostname = "route.kf.dev/hostname"
	// RouteDomain is the domain of a route.
	RouteDomain = "route.kf.dev/domain"
	// RoutePath is the URL path of a route.
	RoutePath = "route.kf.dev/path"
	// RouteAppName is the App's name that owns the Route.
	RouteAppName = "route.kf.dev/appname"
)
View Source
const (
	// SourceConditionSucceeded is set when the source is configured
	// and is usable by developers.
	SourceConditionSucceeded                         = apis.ConditionSucceeded
	SourceConditionBuildSucceeded apis.ConditionType = "BuildSucceeded"

	BuildArgImage             = "IMAGE"
	BuildArgBuildpack         = "BUILDPACK"
	BuildArgBuildpackBuilder  = "BUILDER_IMAGE"
	BuildArgBuildpackRunImage = "RUN_IMAGE"
	BuildArgDockerfile        = "DOCKERFILE"
)
View Source
const (
	// DefaultBuilderImage contains the default buildpack builder image.
	DefaultBuilderImage = "gcr.io/kf-releases/buildpack-builder:latest"

	// DefaultDomainTemplate contains the default domain template. It should
	// be used with `fmt.Sprintf(DefaultDomainTemplate, namespace)`
	DefaultDomainTemplate = "%s.%s"
)

TODO(#396): We should pull these from a ConfigMap

View Source
const (
	// SpaceConditionReady is set when the space is configured
	// and is usable by developers.
	SpaceConditionReady = apis.ConditionReady
	// SpaceConditionNamespaceReady is set when the backing namespace is ready.
	SpaceConditionNamespaceReady apis.ConditionType = "NamespaceReady"
	// SpaceConditionDeveloperRoleReady is set when the developer RBAC role is
	// ready.
	SpaceConditionDeveloperRoleReady apis.ConditionType = "DeveloperRoleReady"
	// SpaceConditionAuditorRoleReady is set when the auditor RBAC role is
	// ready.
	SpaceConditionAuditorRoleReady apis.ConditionType = "AuditorRoleReady"
	// SpaceConditionResourceQuotaReady is set when the resource quota is
	// ready.
	SpaceConditionResourceQuotaReady apis.ConditionType = "ResourceQuotaReady"
	// SpaceConditionLimitRangeReady is set when the limit range is
	// ready.
	SpaceConditionLimitRangeReady apis.ConditionType = "LimitRangeReady"
)

ConditionType represents a Service condition value

View Source
const (
	KfNamespace = "kf"
)

Variables

View Source
var (
	AddToScheme = schemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{
	Group:   kf.GroupName,
	Version: "v1alpha1",
}

SchemeGroupVersion is group version used to register these objects

Functions

func BuildPathRegexp

func BuildPathRegexp(path string) (string, error)

BuildPathRegexp uses gorilla/mux to convert a path into regular expression that can be used to determine if a requests' path matches.

func DefaultDomain

func DefaultDomain(ctx context.Context) (domain string)

DefaultDomain gets the default domain to use for spaces from the context.

Example
fmt.Println(DefaultDomain(context.Background()))
Output:

example.com

func GenerateName

func GenerateName(parts ...string) string

GenerateName generates a name given the parts. It is a DNS valid name.

func GenerateRouteClaimName

func GenerateRouteClaimName(hostname, domain, urlPath string) string

GenerateRouteClaimName creates the deterministic name for a Route claim.

func GenerateRouteName

func GenerateRouteName(hostname, domain, urlPath, appName string) string

GenerateRouteName creates the deterministic name for a Route.

func GenerateRouteNameFromSpec

func GenerateRouteNameFromSpec(spec RouteSpecFields, appName string) string

GenerateRouteNameFromSpec creates the deterministic name for a Route.

func GetBuildArg

func GetBuildArg(b *build.Build, key string) string

func IsStatusFinal

func IsStatusFinal(duck duckv1beta1.Status) bool

IsStatusFinal returns true if the Ready or Succeeded conditions are True or False for a Status.

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func PropagateCondition

func PropagateCondition(manager apis.ConditionManager, destination apis.ConditionType, source *apis.Condition) bool

PropagateCondition copies the condition of a sub-resource (source) to a destination on the given manager. It returns true if the condition is true, otherwise false.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

func SetKfAppContainerDefaults

func SetKfAppContainerDefaults(_ context.Context, container *corev1.Container)

SetKfAppContainerDefaults sets the defaults for an application container. This function MAY be context sensitive in the future.

func SetupIstioClient

func SetupIstioClient(ctx context.Context, istioClient cv1alpha3.VirtualServicesGetter) context.Context

func ToBase36

func ToBase36(s string) string

ToBase36 is a helpful function that converts a string into something that is encoded and safe for URLs, names etc... Base 36 uses 0-9a-z

func ValidatePodSpec

func ValidatePodSpec(podSpec v1.PodSpec) (errs *apis.FieldError)

ValidatePodSpec proxies Knative Serving's checks on PodSpec, except for one condition. We don't allow setting the container image directly on the PodSpec because it'll be set by the source instead.

Types

type App

type App struct {
	metav1.TypeMeta `json:",inline"`

	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec AppSpec `json:"spec,omitempty"`

	// +optional
	Status AppStatus `json:"status,omitempty"`
}

App is a 12-factor application deployed to Knative. It encompasses source code, configuration, and the current state of the application.

func (*App) ComponentLabels

func (app *App) ComponentLabels(component string) map[string]string

ComponentLabels returns Kubernetes recommended labels to tie together deployed applications and their pieces. The provided component name specifies the sub-resource of the app e.g. "database", "load-balancer", or "server".

Example
app := App{}
app.Name = "my-app"

labels := app.ComponentLabels("database")

fmt.Println("label count:", len(labels))
fmt.Println("name:", labels[NameLabel])
fmt.Println("managed-by:", labels[ManagedByLabel])
fmt.Println("component:", labels[ComponentLabel])
Output:

label count: 3
name: my-app
managed-by: kf
component: database

func (*App) DeepCopy

func (in *App) DeepCopy() *App

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new App.

func (*App) DeepCopyInto

func (in *App) DeepCopyInto(out *App)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*App) DeepCopyObject

func (in *App) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*App) GetGroupVersionKind

func (r *App) GetGroupVersionKind() schema.GroupVersionKind

GetGroupVersionKind returns the GroupVersionKind.

func (*App) SetDefaults

func (k *App) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*App) Validate

func (app *App) Validate(ctx context.Context) (errs *apis.FieldError)

Validate checks for errors in the App's spec or status fields.

type AppList

type AppList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []App `json:"items"`
}

AppList is a list of App resources.

func (*AppList) DeepCopy

func (in *AppList) DeepCopy() *AppList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppList.

func (*AppList) DeepCopyInto

func (in *AppList) DeepCopyInto(out *AppList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AppList) DeepCopyObject

func (in *AppList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type AppSpec

type AppSpec struct {

	// Source contains the source configuration of the App.
	// +optional
	Source SourceSpec `json:"source,omitempty"`

	// Template defines the App's runtime configuration.
	// +optional
	Template AppSpecTemplate `json:"template"`

	// Instances defines the scaling rules for the App.
	Instances AppSpecInstances `json:"instances,omitempty"`

	// Routes defines the routing rules for the App.
	// +optional
	// +patchStrategy=merge
	Routes []RouteSpecFields `json:"routes,omitempty"`

	// ServiceBindings defines desired bindings to external services for the
	// App.
	// +optional
	// +patchStrategy=merge
	ServiceBindings []AppSpecServiceBinding `json:"serviceBindings,omitempty"`
}

AppSpec is the desired configuration for an App.

func (*AppSpec) DeepCopy

func (in *AppSpec) DeepCopy() *AppSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSpec.

func (*AppSpec) DeepCopyInto

func (in *AppSpec) DeepCopyInto(out *AppSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AppSpec) SetDefaults

func (k *AppSpec) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*AppSpec) SetServiceBindingDefaults

func (k *AppSpec) SetServiceBindingDefaults(ctx context.Context)

SetServiceBindingDefaults sets the defaults for an AppSpec's ServiceBindings.

func (*AppSpec) SetSourceDefaults

func (k *AppSpec) SetSourceDefaults(ctx context.Context)

SetSourceDefaults implements apis.Defaultable for the embedded SourceSpec.

func (*AppSpec) Validate

func (spec *AppSpec) Validate(ctx context.Context) (errs *apis.FieldError)

Validate checks that the pod template the user has submitted is valid and that the scaling and lifecycle is valid.

func (*AppSpec) ValidateServiceBindings

func (spec *AppSpec) ValidateServiceBindings(ctx context.Context) (errs *apis.FieldError)

ValidateServiceBindings validates each AppSpecServiceBinding for an App.

func (*AppSpec) ValidateSourceSpec

func (spec *AppSpec) ValidateSourceSpec(ctx context.Context) (errs *apis.FieldError)

ValidateSourceSpec validates the SourceSpec embedded in the AppSpec.

type AppSpecInstances

type AppSpecInstances struct {

	// Stopped determines if the App should be running or not.
	Stopped bool `json:"stopped,omitempty"`

	// Exactly defines a static number of desired instances.
	// If Exactly is set, it supersedes the Min and Max values.
	Exactly *int `json:"exactly,omitempty"`

	// Min defines a minimum auto-scaling limit.
	Min *int `json:"min,omitempty"`

	// Max defines a maximum auto-scaling limit.
	Max *int `json:"max,omitempty"`
}

AppSpecInstances defines the scaling rules for an App.

func (*AppSpecInstances) DeepCopy

func (in *AppSpecInstances) DeepCopy() *AppSpecInstances

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSpecInstances.

func (*AppSpecInstances) DeepCopyInto

func (in *AppSpecInstances) DeepCopyInto(out *AppSpecInstances)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AppSpecInstances) MaxAnnotationValue

func (instances *AppSpecInstances) MaxAnnotationValue() string

MaxAnnotationValue returns the value autoscaling.knative.dev/maxScale should be set to.

func (*AppSpecInstances) MinAnnotationValue

func (instances *AppSpecInstances) MinAnnotationValue() string

MinAnnotationValue returns the value autoscaling.knative.dev/minScale should be set to.

func (*AppSpecInstances) ScalingAnnotations

func (instances *AppSpecInstances) ScalingAnnotations() map[string]string

ScalingAnnotations returns the annotations to put on the underling Serving to set scaling bounds.

func (*AppSpecInstances) Validate

func (instances *AppSpecInstances) Validate(ctx context.Context) (errs *apis.FieldError)

Validate checks that the fields the user has specified in AppSpecInstances can be used together.

type AppSpecServiceBinding

type AppSpecServiceBinding struct {

	// Instance is the service the app will bind to.
	Instance string `json:"instance"`

	// Parameters is an arbitrary JSON to be injected into VCAP_SERVICES.
	// +optional
	Parameters json.RawMessage `json:"parameters,omitempty"`

	// BindingName is the name of the binding.
	// If unspecified it will default to the service name
	// +optional
	BindingName string `json:"bindingName,omitempty"`
}

AppSpecServiceBinding is a binding to an external service.

func (*AppSpecServiceBinding) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSpecServiceBinding.

func (*AppSpecServiceBinding) DeepCopyInto

func (in *AppSpecServiceBinding) DeepCopyInto(out *AppSpecServiceBinding)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AppSpecServiceBinding) SetDefaults

func (k *AppSpecServiceBinding) SetDefaults(ctx context.Context)

SetDefaults sets the defaults for an AppSpecServiceBinding.

func (*AppSpecServiceBinding) Validate

func (binding *AppSpecServiceBinding) Validate(ctx context.Context) (errs *apis.FieldError)

Validate validates the fields of an AppSpecServiceBinding.

type AppSpecTemplate

type AppSpecTemplate struct {

	// UpdateRequests is a unique identifier for an AppSpecTemplate.
	// Updating sub-values will trigger a new value.
	UpdateRequests int `json:"updateRequests"`

	// Template is a PodSpec with additional restrictions.
	// The image name is ignored.
	// The Spec contains configuration for the App's Pod.
	// (Env, Vars, Quotas, etc)
	// +optional
	Spec core.PodSpec `json:"spec,omitempty"`
}

AppSpecTemplate defines an app's runtime configuration.

func (*AppSpecTemplate) DeepCopy

func (in *AppSpecTemplate) DeepCopy() *AppSpecTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppSpecTemplate.

func (*AppSpecTemplate) DeepCopyInto

func (in *AppSpecTemplate) DeepCopyInto(out *AppSpecTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AppSpecTemplate) SetDefaults

func (k *AppSpecTemplate) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

type AppStatus

type AppStatus struct {
	// Pull in the fields from Knative's duckv1beta1 status field.
	duckv1beta1.Status `json:",inline"`

	// SourceStatusFields embeds the image and build name for the latest
	// passing source.
	SourceStatusFields `json:",inline"`

	// Inline the latest serving.Service revisions that are ready
	serving.ConfigurationStatusFields `json:",inline"`

	// Inline the latest Service route information.
	serving.RouteStatusFields `json:",inline"`

	// LatestReadySourceName contains the name of the source that was most
	// recently built correctly.
	LatestReadySourceName string `json:"latestReadySource,omitempty"`

	// LatestCreatedSourceName contains the name of the source that was most
	// recently created.
	LatestCreatedSourceName string `json:"latestSource,omitempty"`

	// ServiceBindings are the bindings currently attached to the App.
	ServiceBindingNames []string `json:"serviceBindings,omitempty"`

	// ServiceBindingConditions are the conditions of the service bindings.
	ServiceBindingConditions duckv1beta1.Conditions `json:"serviceBindingConditions"`
}

AppStatus is the current configuration and running state for an App.

func (*AppStatus) DeepCopy

func (in *AppStatus) DeepCopy() *AppStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppStatus.

func (*AppStatus) DeepCopyInto

func (in *AppStatus) DeepCopyInto(out *AppStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AppStatus) EnvVarSecretCondition

func (status *AppStatus) EnvVarSecretCondition() SingleConditionManager

EnvVarSecretCondition gets a manager for the state of the env var secret.

func (*AppStatus) GetCondition

func (status *AppStatus) GetCondition(t apis.ConditionType) *apis.Condition

GetCondition returns the condition by name.

func (*AppStatus) InitializeConditions

func (status *AppStatus) InitializeConditions()

InitializeConditions sets the initial values to the conditions.

func (*AppStatus) IsReady

func (status *AppStatus) IsReady() bool

IsReady looks at the conditions to see if they are happy.

func (*AppStatus) KnativeServiceCondition

func (status *AppStatus) KnativeServiceCondition() SingleConditionManager

KnativeServiceCondition gets a manager for the state of the Knative Service.

func (*AppStatus) MarkSpaceHealthy

func (status *AppStatus) MarkSpaceHealthy()

MarkSpaceHealthy notes that the space was able to be retrieved and defaults can be applied from it.

func (*AppStatus) MarkSpaceUnhealthy

func (status *AppStatus) MarkSpaceUnhealthy(reason, message string)

MarkSpaceUnhealthy notes that the space was could not be retrieved.

func (*AppStatus) PropagateEnvVarSecretStatus

func (status *AppStatus) PropagateEnvVarSecretStatus(secret *v1.Secret)

PropagateEnvVarSecretStatus updates the env var secret readiness status.

func (*AppStatus) PropagateKnativeServiceStatus

func (status *AppStatus) PropagateKnativeServiceStatus(service *serving.Service)

PropagateKnativeServiceStatus updates the Knative service status to reflect the underlying service.

func (*AppStatus) PropagateRouteStatus added in v0.2.0

func (status *AppStatus) PropagateRouteStatus()

PropagateRouteStatus updates the route readiness status.

func (*AppStatus) PropagateServiceBindingsStatus

func (status *AppStatus) PropagateServiceBindingsStatus(bindings []servicecatalogv1beta1.ServiceBinding)

PropagateServiceBindingsStatus updates the service binding readiness status.

func (*AppStatus) PropagateSourceStatus

func (status *AppStatus) PropagateSourceStatus(source *Source)

PropagateSourceStatus copies the source status to the app's.

func (*AppStatus) RouteCondition

func (status *AppStatus) RouteCondition() SingleConditionManager

RouteCondition gets a manager for the state of the kf Route.

func (*AppStatus) ServiceBindingCondition

func (status *AppStatus) ServiceBindingCondition() SingleConditionManager

ServiceBindingCondition gets a manager for the state of the service bindings.

func (*AppStatus) SourceCondition

func (status *AppStatus) SourceCondition() SingleConditionManager

SourceCondition gets a manager for the state of the source.

type HTTPRoutes

type HTTPRoutes []v1alpha3.HTTPRoute

HTTPRoutes implements the necessary interfaces for the algorithms package.

func (HTTPRoutes) Append

Append implements Interface.

func (HTTPRoutes) Clone

func (h HTTPRoutes) Clone() algorithms.Interface

Clone implements Interface.

func (HTTPRoutes) DeepCopy

func (in HTTPRoutes) DeepCopy() HTTPRoutes

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRoutes.

func (HTTPRoutes) DeepCopyInto

func (in HTTPRoutes) DeepCopyInto(out *HTTPRoutes)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (HTTPRoutes) Len

func (h HTTPRoutes) Len() int

Len implements Interface.

func (HTTPRoutes) Less

func (h HTTPRoutes) Less(i int, j int) bool

Less implements Interface.

func (HTTPRoutes) Set

Set implements Interface.

func (HTTPRoutes) Slice

func (h HTTPRoutes) Slice(i int, j int) algorithms.Interface

Slice implements Interface.

func (HTTPRoutes) Swap

func (h HTTPRoutes) Swap(i int, j int)

Swap implements Interface.

type OwnerReferences

type OwnerReferences []metav1.OwnerReference

OwnerReferences implements the necessary interfaces for the algorithms package.

func (OwnerReferences) Append

Append implements Interface.

func (OwnerReferences) Clone

Clone implements Interface.

func (OwnerReferences) DeepCopy

func (in OwnerReferences) DeepCopy() OwnerReferences

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OwnerReferences.

func (OwnerReferences) DeepCopyInto

func (in OwnerReferences) DeepCopyInto(out *OwnerReferences)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (OwnerReferences) Len

func (d OwnerReferences) Len() int

Len implements Interface.

func (OwnerReferences) Less

func (d OwnerReferences) Less(i int, j int) bool

Less implements Interface.

func (OwnerReferences) Set

Set implements Interface.

func (OwnerReferences) Slice

func (d OwnerReferences) Slice(i int, j int) algorithms.Interface

Slice implements Interface.

func (OwnerReferences) Swap

func (d OwnerReferences) Swap(i int, j int)

Swap implements Interface.

type Route

type Route struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec RouteSpec `json:"spec,omitempty"`
}

Route is a high level structure that encompasses an Istio VirtualService and configuration applied to it.

func (*Route) DeepCopy

func (in *Route) DeepCopy() *Route

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.

func (*Route) DeepCopyInto

func (in *Route) DeepCopyInto(out *Route)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Route) DeepCopyObject

func (in *Route) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Route) GetGroupVersionKind

func (r *Route) GetGroupVersionKind() schema.GroupVersionKind

GetGroupVersionKind returns the GroupVersionKind.

func (*Route) SetDefaults

func (k *Route) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

Example (Labels)
r := &Route{}
r.Spec.Hostname = "some-hostname"
r.Spec.Domain = "example.com"
r.SetDefaults(context.Background())

fmt.Println("Hostname:", r.Labels[RouteHostname])
fmt.Println("Domain:", r.Labels[RouteDomain])
fmt.Println("Path:", r.Labels[RoutePath])
Output:

Hostname: some-hostname
Domain: example.com
Path: pvdf1ls1w14a
Example (PrefixRoutes)
r := &Route{}
r.Spec.Path = "some-path"
r.SetDefaults(context.Background())

fmt.Println("Route:", r.Spec.Path)
Output:

Route: /some-path

func (*Route) SetSpaceDefaults

func (k *Route) SetSpaceDefaults(space *Space)

SetSpaceDefaults sets the default values for the Route based on the space's settings.

func (*Route) Validate

func (r *Route) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that Route is properly configured.

type RouteClaim

type RouteClaim struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec RouteClaimSpec `json:"spec,omitempty"`
}

RouteClaim is similar to Route, however it is not associated with an App. It is created (by the Route Controller) along with its associated Routes.

func (*RouteClaim) DeepCopy

func (in *RouteClaim) DeepCopy() *RouteClaim

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteClaim.

func (*RouteClaim) DeepCopyInto

func (in *RouteClaim) DeepCopyInto(out *RouteClaim)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RouteClaim) DeepCopyObject

func (in *RouteClaim) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*RouteClaim) SetDefaults

func (k *RouteClaim) SetDefaults(ctx context.Context)

SetDefaults sets the defaults for a RouteClaim.

Example (Labels)
r := &RouteClaim{}
r.Spec.Hostname = "some-hostname"
r.Spec.Domain = "example.com"
r.SetDefaults(context.Background())

fmt.Println("Hostname:", r.Labels[RouteHostname])
fmt.Println("Domain:", r.Labels[RouteDomain])
fmt.Println("Path:", r.Labels[RoutePath])
Output:

Hostname: some-hostname
Domain: example.com
Path: pvdf1ls1w14a

func (*RouteClaim) Validate

func (r *RouteClaim) Validate(ctx context.Context) (errs *apis.FieldError)

Validate validates a RouteClaim.

type RouteClaimList

type RouteClaimList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []RouteClaim `json:"items"`
}

RouteClaimList is a list of RouteClaim resources

func (*RouteClaimList) DeepCopy

func (in *RouteClaimList) DeepCopy() *RouteClaimList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteClaimList.

func (*RouteClaimList) DeepCopyInto

func (in *RouteClaimList) DeepCopyInto(out *RouteClaimList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RouteClaimList) DeepCopyObject

func (in *RouteClaimList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RouteClaimSpec

type RouteClaimSpec struct {
	// RouteSpecFields contains the fields of a route.
	RouteSpecFields `json:",inline"`
}

RouteClaimSpec contains the specification for a RouteClaim.

func (*RouteClaimSpec) DeepCopy

func (in *RouteClaimSpec) DeepCopy() *RouteClaimSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteClaimSpec.

func (*RouteClaimSpec) DeepCopyInto

func (in *RouteClaimSpec) DeepCopyInto(out *RouteClaimSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RouteClaimSpec) SetDefaults

func (k *RouteClaimSpec) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*RouteClaimSpec) Validate

func (r *RouteClaimSpec) Validate(ctx context.Context) (errs *apis.FieldError)

Validate validates a RouteClaimSpec.

type RouteList

type RouteList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []Route `json:"items"`
}

RouteList is a list of Route resources

func (*RouteList) DeepCopy

func (in *RouteList) DeepCopy() *RouteList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteList.

func (*RouteList) DeepCopyInto

func (in *RouteList) DeepCopyInto(out *RouteList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RouteList) DeepCopyObject

func (in *RouteList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RouteSpec

type RouteSpec struct {
	// AppName contains the Kf App that is bound to the route.
	AppName string `json:"appName,omitempty"`

	// RouteSpecFields contains the fields of a route.
	RouteSpecFields `json:",inline"`
}

RouteSpec contains the specification for a Route.

func (*RouteSpec) DeepCopy

func (in *RouteSpec) DeepCopy() *RouteSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteSpec.

func (*RouteSpec) DeepCopyInto

func (in *RouteSpec) DeepCopyInto(out *RouteSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RouteSpec) SetDefaults

func (k *RouteSpec) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*RouteSpec) SetSpaceDefaults

func (k *RouteSpec) SetSpaceDefaults(space *Space)

SetSpaceDefaults sets the default values for the RouteSpec based on the space's settings.

func (*RouteSpec) Validate

func (r *RouteSpec) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that RouteSpec is properly configured.

type RouteSpecFields

type RouteSpecFields struct {
	// Hostname is the hostname or subdomain of the route (e.g, in
	// hostname.example.com it would be hostname).
	// +optional
	Hostname string `json:"hostname,omitempty"`

	// Domain is the domain of the route (e.g, in hostname.example.com it
	// would be example.com).
	// +optional
	Domain string `json:"domain,omitempty"`

	// Path is the URL path of the route.
	// +optional
	Path string `json:"path,omitempty"`
}

RouteSpecFields contains the fields of a route.

func (*RouteSpecFields) DeepCopy

func (in *RouteSpecFields) DeepCopy() *RouteSpecFields

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteSpecFields.

func (*RouteSpecFields) DeepCopyInto

func (in *RouteSpecFields) DeepCopyInto(out *RouteSpecFields)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RouteSpecFields) SetDefaults

func (k *RouteSpecFields) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*RouteSpecFields) SetSpaceDefaults

func (k *RouteSpecFields) SetSpaceDefaults(space *Space)

SetSpaceDefaults sets the default values for the RouteSpec based on the space's settings.

func (RouteSpecFields) String

func (route RouteSpecFields) String() string

String returns a RouteSpecFields converted into an address.

Example
r := RouteSpecFields{
	Hostname: "foo",
	Domain:   "example.com",
	Path:     "bar",
}

fmt.Println(r.String())
Output:

foo.example.com/bar
Example (Without_hostname)
r := RouteSpecFields{
	Domain: "example.com",
	Path:   "bar",
}

fmt.Println(r.String())
Output:

example.com/bar
Example (Without_path)
r := RouteSpecFields{
	Hostname: "foo",
	Domain:   "example.com",
}

fmt.Println(r.String())
Output:

foo.example.com/

func (*RouteSpecFields) Validate

func (r *RouteSpecFields) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that RouteSpecFields is properly configured.

type RouteSpecFieldsSlice

type RouteSpecFieldsSlice []RouteSpecFields

RouteSpecFieldsSlice implements the necessary interfaces for the algorithms package.

func (RouteSpecFieldsSlice) Append

Append implements Interface.

func (RouteSpecFieldsSlice) Clone

Clone implements Interface.

func (RouteSpecFieldsSlice) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteSpecFieldsSlice.

func (RouteSpecFieldsSlice) DeepCopyInto

func (in RouteSpecFieldsSlice) DeepCopyInto(out *RouteSpecFieldsSlice)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (RouteSpecFieldsSlice) Len

func (d RouteSpecFieldsSlice) Len() int

Len implements Interface.

func (RouteSpecFieldsSlice) Less

func (d RouteSpecFieldsSlice) Less(i int, j int) bool

Less implements Interface.

func (RouteSpecFieldsSlice) Set

Set implements Interface.

func (RouteSpecFieldsSlice) Slice

Slice implements Interface.

func (RouteSpecFieldsSlice) Swap

func (d RouteSpecFieldsSlice) Swap(i int, j int)

Swap implements Interface.

type Routes

type Routes []Route

Routes implements the necessary interfaces for the algorithms package.

func (Routes) Append

Append implements Interface.

func (Routes) Clone

func (d Routes) Clone() algorithms.Interface

Clone implements Interface.

func (Routes) DeepCopy

func (in Routes) DeepCopy() Routes

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Routes.

func (Routes) DeepCopyInto

func (in Routes) DeepCopyInto(out *Routes)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Routes) Len

func (d Routes) Len() int

Len implements Interface.

func (Routes) Less

func (d Routes) Less(i int, j int) bool

Less implements Interface.

func (Routes) Set

Set implements Interface.

func (Routes) Slice

func (d Routes) Slice(i int, j int) algorithms.Interface

Slice implements Interface.

func (Routes) Swap

func (d Routes) Swap(i int, j int)

Swap implements Interface.

type ServiceBindings

type ServiceBindings []servicecatalogv1beta1.ServiceBinding

ServiceBindings implements the necessary interfaces for the algorithms package.

func (ServiceBindings) Append

Append implements Interface.

func (ServiceBindings) Clone

Clone implements Interface.

func (ServiceBindings) DeepCopy

func (in ServiceBindings) DeepCopy() ServiceBindings

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindings.

func (ServiceBindings) DeepCopyInto

func (in ServiceBindings) DeepCopyInto(out *ServiceBindings)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ServiceBindings) Len

func (s ServiceBindings) Len() int

Len implements Interface.

func (ServiceBindings) Less

func (s ServiceBindings) Less(i int, j int) bool

Less implements Interface.

func (ServiceBindings) Set

Set implements Interface.

func (ServiceBindings) Slice

func (s ServiceBindings) Slice(i int, j int) algorithms.Interface

Slice implements Interface.

func (ServiceBindings) Swap

func (s ServiceBindings) Swap(i int, j int)

Swap implements Interface.

type SingleConditionManager

type SingleConditionManager interface {
	// MarkChildNotOwned marks the child with the given name as not being owned by
	// the app.
	MarkChildNotOwned(childName string) error

	// MarkTemplateError marks the condition as having an error in its template.
	MarkTemplateError(err error) error

	// MarkSourceReconciliationError marks the Source having some error during the
	// reconciliation process. Context should contain the action that failed.
	MarkReconciliationError(context string, err error) error

	// IsPending returns whether the condition's state is final or in progress.
	IsPending() bool
}

SingleConditionManager provides a standard way to set conditions.

func NewSingleConditionManager

func NewSingleConditionManager(manager apis.ConditionManager, destination apis.ConditionType, childType string) SingleConditionManager

NewSingleConditionManager sets up a manager for setting the conditions of a single sub-resource.

type Source

type Source struct {
	metav1.TypeMeta `json:",inline"`

	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec SourceSpec `json:"spec,omitempty"`

	// +optional
	Status SourceStatus `json:"status,omitempty"`
}

Source represents the source code and build configuration for an App.

func (*Source) DeepCopy

func (in *Source) DeepCopy() *Source

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source.

func (*Source) DeepCopyInto

func (in *Source) DeepCopyInto(out *Source)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Source) DeepCopyObject

func (in *Source) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Source) GetGroupVersionKind

func (r *Source) GetGroupVersionKind() schema.GroupVersionKind

GetGroupVersionKind returns the GroupVersionKind.

func (*Source) SetDefaults

func (k *Source) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*Source) Validate

func (source *Source) Validate(ctx context.Context) (errs *apis.FieldError)

Validate checks for errors in the Source's spec or status fields.

type SourceList

type SourceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []Source `json:"items"`
}

SourceList is a list of Source resources.

func (*SourceList) DeepCopy

func (in *SourceList) DeepCopy() *SourceList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceList.

func (*SourceList) DeepCopyInto

func (in *SourceList) DeepCopyInto(out *SourceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SourceList) DeepCopyObject

func (in *SourceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SourceSpec

type SourceSpec struct {

	// UpdateRequests is a unique identifier for an SourceSpec.
	// Updating sub-values will trigger a new value.
	// +optional
	UpdateRequests int `json:"updateRequests,omitempty"`

	// ServiceAccount holds the service account the build will execute as.
	// This can be used to attach credentials to the build.
	// +optional
	ServiceAccount string `json:"serviceAccount,omitempty"`

	// ContainerImage defines the container image for source.
	// +optional
	ContainerImage SourceSpecContainerImage `json:"containerImage,omitempty"`

	// BuildpackBuild defines buildpack information for source.
	// +optional
	BuildpackBuild SourceSpecBuildpackBuild `json:"buildpackBuild,omitempty"`

	// Dockerfile defines Dockerfile information for source.
	// +optional
	Dockerfile SourceSpecDockerfile `json:"dockerfile,omitempty"`
}

SourceSpec defines the source code for an App. The fields ContainerImage and BuildpackBuild are mutually exclusive.

func AppSpecSourceMask

func AppSpecSourceMask(in SourceSpec) SourceSpec

AppSpecSourceMask is a _shallow_ copy of the SourceSpec object to a new SourceSpec object bringing over only the fields allowed to be set in the App by developers. This does not validate the contents or the bounds of the provided fields.

This function should be used with godoc.org/knative.dev/pkg/apis#CheckDisallowedFields to validate that the user hasn't set any fields they're not allowed to in the source of AppSpec.

func (*SourceSpec) DeepCopy

func (in *SourceSpec) DeepCopy() *SourceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpec.

func (*SourceSpec) DeepCopyInto

func (in *SourceSpec) DeepCopyInto(out *SourceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SourceSpec) IsBuildpackBuild

func (spec *SourceSpec) IsBuildpackBuild() bool

IsBuildpackBuild returns true if the build is for a buildpack

func (*SourceSpec) IsContainerBuild

func (spec *SourceSpec) IsContainerBuild() bool

IsContainerBuild returns true if the build is for a container

func (*SourceSpec) IsDockerfileBuild added in v0.2.0

func (spec *SourceSpec) IsDockerfileBuild() bool

IsDockerfileBuild returns true if the build is for a dockerfile

func (*SourceSpec) NeedsUpdateRequestsIncrement

func (spec *SourceSpec) NeedsUpdateRequestsIncrement(old SourceSpec) bool

NeedsUpdateRequestsIncrement returns true if UpdateRequests needs to be incremented to force a rebuild. This function should be used as a part of defaulting and validating webhooks when SourceSpec is embedded.

This can happen if a field in the source changes without also updating the UpdateRequests.

func (*SourceSpec) SetDefaults

func (k *SourceSpec) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*SourceSpec) Validate

func (spec *SourceSpec) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that a SourceSpec is properly configured.

type SourceSpecBuildpackBuild

type SourceSpecBuildpackBuild struct {

	// Source is the Container Image which contains the App's source code.
	Source string `json:"source"`

	// Stack is the base layer to use for the App.
	// +optional
	Stack string `json:"stack,omitempty"`

	// Buildpack is the Buildpack to use for the App.
	// +optional
	Buildpack string `json:"buildpack,omitempty"`

	// BuildpackBuilder is the container image which builds the App.
	BuildpackBuilder string `json:"buildpackBuilder"`

	// Image is the location to store the built image.
	Image string `json:"image"`

	// Env represents the environment variables to apply when building the App.
	Env []corev1.EnvVar `json:"env,omitempty"`
}

SourceSpecBuildpackBuild defines building an App using Buildpacks.

func (*SourceSpecBuildpackBuild) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpecBuildpackBuild.

func (*SourceSpecBuildpackBuild) DeepCopyInto

func (in *SourceSpecBuildpackBuild) DeepCopyInto(out *SourceSpecBuildpackBuild)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SourceSpecBuildpackBuild) Validate

func (buildpackBuild *SourceSpecBuildpackBuild) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that a SourceSpecBuildpackBuild is properly configured.

type SourceSpecContainerImage

type SourceSpecContainerImage struct {

	// Image is the container image URI for the App.
	Image string `json:"image"`
}

SourceSpecContainerImage defines a container image for an App.

func (*SourceSpecContainerImage) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpecContainerImage.

func (*SourceSpecContainerImage) DeepCopyInto

func (in *SourceSpecContainerImage) DeepCopyInto(out *SourceSpecContainerImage)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SourceSpecContainerImage) Validate

func (containerImage *SourceSpecContainerImage) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that an SourceSpecContainerImage is properly configured.

type SourceSpecDockerfile added in v0.2.0

type SourceSpecDockerfile struct {

	// Source is the Container Image which contains the App's source code and
	// Dockerfile
	Source string `json:"source"`

	// Path is the path to the dockerfile.
	Path string `json:"path"`

	// Image is the location to store the built image.
	Image string `json:"image"`
}

SourceSpecDockerfile defines building an App using a Dockerfile.

func (*SourceSpecDockerfile) DeepCopy added in v0.2.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceSpecDockerfile.

func (*SourceSpecDockerfile) DeepCopyInto added in v0.2.0

func (in *SourceSpecDockerfile) DeepCopyInto(out *SourceSpecDockerfile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SourceSpecDockerfile) Validate added in v0.2.0

func (dockerfile *SourceSpecDockerfile) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that a SourceSpecDockerfile is properly configured.

type SourceStatus

type SourceStatus struct {
	// Pull in the fields from Knative's duckv1beta1 status field.
	duckv1beta1.Status `json:",inline"`

	SourceStatusFields `json:",inline"`
}

SourceStatus is the current configuration and running state for an App's Source.

func (*SourceStatus) DeepCopy

func (in *SourceStatus) DeepCopy() *SourceStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceStatus.

func (*SourceStatus) DeepCopyInto

func (in *SourceStatus) DeepCopyInto(out *SourceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SourceStatus) GetCondition

func (status *SourceStatus) GetCondition(t apis.ConditionType) *apis.Condition

GetCondition returns the condition by name.

func (*SourceStatus) InitializeConditions

func (status *SourceStatus) InitializeConditions()

InitializeConditions sets the initial values to the conditions.

func (*SourceStatus) MarkBuildNotOwned

func (status *SourceStatus) MarkBuildNotOwned(name string)

MarkBuildNotOwned marks the Build as not being owned by the Source.

func (*SourceStatus) PropagateBuildStatus

func (status *SourceStatus) PropagateBuildStatus(build *build.Build)

PropagateBuildStatus copies fields from the Build status to Space and updates the readiness based on the current phase.

func (*SourceStatus) Succeeded

func (status *SourceStatus) Succeeded() bool

Succeeded returns if the space is ready to be used.

type SourceStatusFields

type SourceStatusFields struct {
	// Image is the latest successfully built image.
	// +optional
	Image string `json:"image,omitempty"`

	// BuildName is the name of the build that produced the image.
	// +optional
	BuildName string `json:"buildName,omitempty"`
}

SourceStatusFields holds the fields of Source's status that are shared. This is defined separately and inlined so that other types can readily consume these fields via duck typing.

func (*SourceStatusFields) DeepCopy

func (in *SourceStatusFields) DeepCopy() *SourceStatusFields

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceStatusFields.

func (*SourceStatusFields) DeepCopyInto

func (in *SourceStatusFields) DeepCopyInto(out *SourceStatusFields)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Space

type Space struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec SpaceSpec `json:"spec,omitempty"`

	// +optional
	Status SpaceStatus `json:"status,omitempty"`
}

Space is a high level structure that encompasses a namespace, permissions on it and configuration applied to it.

func (*Space) DeepCopy

func (in *Space) DeepCopy() *Space

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Space.

func (*Space) DeepCopyInto

func (in *Space) DeepCopyInto(out *Space)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Space) DeepCopyObject

func (in *Space) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Space) GetGroupVersionKind

func (r *Space) GetGroupVersionKind() schema.GroupVersionKind

GetGroupVersionKind returns the GroupVersionKind.

func (*Space) SetDefaults

func (k *Space) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

Example
space := Space{}
space.Name = "mynamespace"
space.SetDefaults(dummyConfig())

var domainNames []string
for _, domain := range space.Spec.Execution.Domains {
	if domain.Default {
		domainNames = append(domainNames, "*"+domain.Domain)
		continue
	}
	domainNames = append(domainNames, domain.Domain)
}

fmt.Println("Builder:", space.Spec.BuildpackBuild.BuilderImage)
fmt.Println("Domains:", strings.Join(domainNames, ", "))
Output:

Builder: gcr.io/kf-releases/buildpack-builder:latest
Domains: *mynamespace.custom.example.com

func (*Space) Validate

func (space *Space) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that Space is properly configured.

type SpaceDomain

type SpaceDomain struct {
	// Domain is the valid domain that can be used in conjunction with a
	// hostname and path for a route.
	Domain string `json:"domain"`

	// Default implies that this SpaceDomain is used when a domain is not
	// specified. There can only be a single default set to true per space.
	// NOTE: This may change in the future.
	Default bool `json:"default,omitempty"`
}

SpaceDomain stores information about a domain available in a space.

func (*SpaceDomain) DeepCopy

func (in *SpaceDomain) DeepCopy() *SpaceDomain

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceDomain.

func (*SpaceDomain) DeepCopyInto

func (in *SpaceDomain) DeepCopyInto(out *SpaceDomain)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SpaceDomains

type SpaceDomains []SpaceDomain

SpaceDomains implements the necessary interfaces for the algorithms package.

func (SpaceDomains) Append

Append implements Interface.

func (SpaceDomains) Clone

func (d SpaceDomains) Clone() algorithms.Interface

Clone implements Interface.

func (SpaceDomains) DeepCopy

func (in SpaceDomains) DeepCopy() SpaceDomains

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceDomains.

func (SpaceDomains) DeepCopyInto

func (in SpaceDomains) DeepCopyInto(out *SpaceDomains)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (SpaceDomains) Len

func (d SpaceDomains) Len() int

Len implements Interface.

func (SpaceDomains) Less

func (d SpaceDomains) Less(i int, j int) bool

Less implements Interface.

func (SpaceDomains) Set

Set implements Interface.

func (SpaceDomains) Slice

func (d SpaceDomains) Slice(i int, j int) algorithms.Interface

Slice implements Interface.

func (SpaceDomains) Swap

func (d SpaceDomains) Swap(i int, j int)

Swap implements Interface.

type SpaceList

type SpaceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []Space `json:"items"`
}

SpaceList is a list of KfSpace resources

func (*SpaceList) DeepCopy

func (in *SpaceList) DeepCopy() *SpaceList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceList.

func (*SpaceList) DeepCopyInto

func (in *SpaceList) DeepCopyInto(out *SpaceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceList) DeepCopyObject

func (in *SpaceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SpaceSpec

type SpaceSpec struct {
	// Security contains config for RBAC roles that will be created for the
	// space.
	// +optional
	Security SpaceSpecSecurity `json:"security,omitempty"`

	// BuildpackBuild contains config for the build pipelines.
	// Currently, this is the only way to build source -> container workflows, but
	// in the future additional types may be added. For example DockerBuild or
	// WebhookBuild to execute a build via webhook.
	// +optional
	BuildpackBuild SpaceSpecBuildpackBuild `json:"buildpackBuild,omitempty"`

	// Execution contains settings for the execution environment.
	// +optional
	Execution SpaceSpecExecution `json:"execution,omitempty"`

	// SpaceSpecResourceLimits contains definitions for resource usage limits.
	// +optional
	ResourceLimits SpaceSpecResourceLimits `json:"resourceLimits,omitempty"`
}

SpaceSpec contains the specification for a space.

func (*SpaceSpec) DeepCopy

func (in *SpaceSpec) DeepCopy() *SpaceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceSpec.

func (*SpaceSpec) DeepCopyInto

func (in *SpaceSpec) DeepCopyInto(out *SpaceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceSpec) SetDefaults

func (k *SpaceSpec) SetDefaults(ctx context.Context, name string)

SetDefaults implements apis.Defaultable

func (*SpaceSpec) Validate

func (s *SpaceSpec) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that SpaceSpec is properly configured.

type SpaceSpecBuildpackBuild

type SpaceSpecBuildpackBuild struct {

	// BuilderImage is a buildpacks.io builder image.
	BuilderImage string `json:"builderImage,omitempty"`

	// ContainerRegistry holds the container registry that buildpack builds are
	// stored in.
	ContainerRegistry string `json:"containerRegistry,omitempty"`

	// Env sets default environment variables on the builder.
	//
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
}

SpaceSpecBuildpackBuild holds fields for managing building via buildpacks.

func (*SpaceSpecBuildpackBuild) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceSpecBuildpackBuild.

func (*SpaceSpecBuildpackBuild) DeepCopyInto

func (in *SpaceSpecBuildpackBuild) DeepCopyInto(out *SpaceSpecBuildpackBuild)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceSpecBuildpackBuild) SetDefaults

func (k *SpaceSpecBuildpackBuild) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*SpaceSpecBuildpackBuild) Validate

func (s *SpaceSpecBuildpackBuild) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that SpaceSpecBuildpackBuild is properly configured.

type SpaceSpecExecution

type SpaceSpecExecution struct {
	// Env sets default environment variables on kf applications for the whole
	// space.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

	// Domains sets valid domains that can be used for routes in the space.
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	Domains []SpaceDomain `json:"domains,omitempty" patchStrategy:"merge" patchMergeKey:"domain"`
}

SpaceSpecExecution contains settings for the execution environment.

func (*SpaceSpecExecution) DeepCopy

func (in *SpaceSpecExecution) DeepCopy() *SpaceSpecExecution

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceSpecExecution.

func (*SpaceSpecExecution) DeepCopyInto

func (in *SpaceSpecExecution) DeepCopyInto(out *SpaceSpecExecution)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceSpecExecution) SetDefaults

func (k *SpaceSpecExecution) SetDefaults(ctx context.Context, name string)

SetDefaults implements apis.Defaultable

Example (Dedupe)
space := Space{}
space.Spec.Execution = SpaceSpecExecution{
	Domains: []SpaceDomain{
		{Domain: "example.com"},
		{Domain: "other-example.com"},
		{Domain: "example.com", Default: true},
		{Domain: "other-example.com"},
	},
}
space.SetDefaults(context.Background())

var domainNames []string
for _, domain := range space.Spec.Execution.Domains {
	if domain.Default {
		domainNames = append(domainNames, "*"+domain.Domain)
		continue
	}
	domainNames = append(domainNames, domain.Domain)
}

fmt.Println(strings.Join(domainNames, ", "))
Output:

*example.com, other-example.com

func (*SpaceSpecExecution) Validate

func (s *SpaceSpecExecution) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that SpaceSpecExecution is properly configured.

type SpaceSpecResourceLimits

type SpaceSpecResourceLimits struct {
	// SpaceQuota holds the k8s ResourceQuota created for the whole space.
	// For now, only one ResourceQuota per space is supported.
	// Consider allowing multiple ResourceQuotas when more quota scopes are enabled in k8s
	// +optional
	SpaceQuota corev1.ResourceList `json:"spaceQuota,omitempty"`

	// ResourceDefaults holds the k8s LimitRange created for the whole space,
	// which sets default request/limit for resources per pod or container.
	// +optional
	ResourceDefaults []corev1.LimitRangeItem `json:"resourceDefaults,omitempty"`
}

SpaceSpecResourceLimits contains definitions for resource usage limits.

func (*SpaceSpecResourceLimits) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceSpecResourceLimits.

func (*SpaceSpecResourceLimits) DeepCopyInto

func (in *SpaceSpecResourceLimits) DeepCopyInto(out *SpaceSpecResourceLimits)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceSpecResourceLimits) SetDefaults

func (k *SpaceSpecResourceLimits) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

func (*SpaceSpecResourceLimits) Validate

func (s *SpaceSpecResourceLimits) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that SpaceSpecResourceLimits is properly configured.

type SpaceSpecSecurity

type SpaceSpecSecurity struct {

	// EnableDeveloperLogsAccess allows developers to access pod logging endpoints.
	// +optional
	EnableDeveloperLogsAccess bool `json:"enableDeveloperLogsAccess,omitempty"`

	// BuildServiceAccount sets the service account that will be propagated to
	// all builds.
	// +optional
	BuildServiceAccount string `json:"buildServiceAccount,omitempty"`
}

SpaceSpecSecurity holds fields for creating RBAC in the space.

func (*SpaceSpecSecurity) DeepCopy

func (in *SpaceSpecSecurity) DeepCopy() *SpaceSpecSecurity

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceSpecSecurity.

func (*SpaceSpecSecurity) DeepCopyInto

func (in *SpaceSpecSecurity) DeepCopyInto(out *SpaceSpecSecurity)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceSpecSecurity) SetDefaults

func (k *SpaceSpecSecurity) SetDefaults(ctx context.Context)

SetDefaults implements apis.Defaultable

Example (BadContextPanic)
space := Space{}
space.Name = "mynamespace"
space.SetDefaults(context.Background())

var domainNames []string
for _, domain := range space.Spec.Execution.Domains {
	if domain.Default {
		domainNames = append(domainNames, "*"+domain.Domain)
		continue
	}
	domainNames = append(domainNames, domain.Domain)
}

fmt.Println("Domains:", strings.Join(domainNames, ", "))
Output:

Domains: *mynamespace.example.com
Example (Dedupe)
space := Space{}
space.Spec.Security = SpaceSpecSecurity{
	EnableDeveloperLogsAccess: false,
}
space.SetDefaults(dummyConfig())

fmt.Println("EnableDeveloperLogsAccess:", space.Spec.Security.EnableDeveloperLogsAccess)
Output:

EnableDeveloperLogsAccess: true

func (*SpaceSpecSecurity) Validate

func (s *SpaceSpecSecurity) Validate(ctx context.Context) (errs *apis.FieldError)

Validate makes sure that SpaceSpecSecurity is properly configured.

type SpaceStatus

type SpaceStatus struct {
	// Pull in the fields from Knative's duckv1beta1 status field.
	duckv1beta1.Status `json:",inline"`

	Quota corev1.ResourceQuotaStatus `json:"quota,omitempty"`
}

SpaceStatus represents information about the status of a Space.

func (*SpaceStatus) DeepCopy

func (in *SpaceStatus) DeepCopy() *SpaceStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpaceStatus.

func (*SpaceStatus) DeepCopyInto

func (in *SpaceStatus) DeepCopyInto(out *SpaceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SpaceStatus) GetCondition

func (status *SpaceStatus) GetCondition(t apis.ConditionType) *apis.Condition

GetCondition returns the condition by name.

func (*SpaceStatus) InitializeConditions

func (status *SpaceStatus) InitializeConditions()

InitializeConditions sets the initial values to the conditions.

func (*SpaceStatus) IsReady

func (status *SpaceStatus) IsReady() bool

IsReady returns if the space is ready to be used.

func (*SpaceStatus) MarkAuditorRoleNotOwned

func (status *SpaceStatus) MarkAuditorRoleNotOwned(name string)

MarkAuditorRoleNotOwned marks the auditor role as not being owned by the Space.

func (*SpaceStatus) MarkDeveloperRoleNotOwned

func (status *SpaceStatus) MarkDeveloperRoleNotOwned(name string)

MarkDeveloperRoleNotOwned marks the developer role as not being owned by the Space.

func (*SpaceStatus) MarkLimitRangeNotOwned

func (status *SpaceStatus) MarkLimitRangeNotOwned(name string)

MarkLimitRangeNotOwned marks the LimitRange as not being owned by the Space.

func (*SpaceStatus) MarkNamespaceNotOwned

func (status *SpaceStatus) MarkNamespaceNotOwned(name string)

MarkNamespaceNotOwned marks the namespace as not being owned by the Space.

func (*SpaceStatus) MarkResourceQuotaNotOwned

func (status *SpaceStatus) MarkResourceQuotaNotOwned(name string)

MarkResourceQuotaNotOwned marks the ResourceQuota as not being owned by the Space.

func (*SpaceStatus) PropagateAuditorRoleStatus

func (status *SpaceStatus) PropagateAuditorRoleStatus(*rv1.Role)

PropagateAuditorRoleStatus copies fields from the Role to Space and updates the readiness based on the current phase.

func (*SpaceStatus) PropagateDeveloperRoleStatus

func (status *SpaceStatus) PropagateDeveloperRoleStatus(*rv1.Role)

PropagateDeveloperRoleStatus copies fields from the Role to Space and updates the readiness based on the current phase.

func (*SpaceStatus) PropagateLimitRangeStatus

func (status *SpaceStatus) PropagateLimitRangeStatus(limitRange *v1.LimitRange)

PropagateLimitRangeStatus updates the readiness of the space based on if a LimitRange exists.

func (*SpaceStatus) PropagateNamespaceStatus

func (status *SpaceStatus) PropagateNamespaceStatus(ns *v1.Namespace)

PropagateNamespaceStatus copies fields from the Namespace status to Space and updates the readiness based on the current phase.

func (*SpaceStatus) PropagateResourceQuotaStatus

func (status *SpaceStatus) PropagateResourceQuotaStatus(quota *v1.ResourceQuota)

PropagateResourceQuotaStatus copies the ResourceQuota Used and Hard amounts to the Space and updates the readiness based on if a quota exists.

Jump to

Keyboard shortcuts

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