Update k8s dependencies to 1.10 (#687)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# Fission CRD generation
|
||||
|
||||
* Use [code-generator](https://github.com/kubernetes/code-generator) to generate fission CRD object deepcopy and client methods.
|
||||
|
||||
``` bash
|
||||
$ vendor/k8s.io/code-generator/generate-groups.sh deepcopy \
|
||||
github.com/fission/fission/pkg/client \
|
||||
github.com/fission/fission/pkg/apis \
|
||||
fission.io:v1
|
||||
```
|
||||
|
||||
# Reference
|
||||
|
||||
* https://blog.openshift.com/kubernetes-deep-dive-code-generation-customresources/
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
const (
|
||||
EXECUTOR_INSTANCEID_LABEL string = "executorInstanceId"
|
||||
POOLMGR_INSTANCEID_LABEL string = "poolmgrInstanceId"
|
||||
)
|
||||
|
||||
const (
|
||||
ChecksumTypeSHA256 ChecksumType = "sha256"
|
||||
)
|
||||
|
||||
const (
|
||||
// ArchiveTypeLiteral means the package contents are specified in the Literal field of
|
||||
// resource itself.
|
||||
ArchiveTypeLiteral ArchiveType = "literal"
|
||||
|
||||
// ArchiveTypeUrl means the package contents are at the specified URL.
|
||||
ArchiveTypeUrl ArchiveType = "url"
|
||||
)
|
||||
|
||||
const (
|
||||
BuildStatusPending = "pending"
|
||||
BuildStatusRunning = "running"
|
||||
BuildStatusSucceeded = "succeeded"
|
||||
BuildStatusFailed = "failed"
|
||||
BuildStatusNone = "none"
|
||||
)
|
||||
|
||||
const (
|
||||
AllowedFunctionsPerContainerSingle = "single"
|
||||
AllowedFunctionsPerContainerInfinite = "infinite"
|
||||
)
|
||||
|
||||
const (
|
||||
ExecutorTypePoolmgr = "poolmgr"
|
||||
ExecutorTypeNewdeploy = "newdeploy"
|
||||
)
|
||||
|
||||
const (
|
||||
StrategyTypeExecution = "execution"
|
||||
)
|
||||
|
||||
const (
|
||||
SharedVolumeUserfunc = "userfunc"
|
||||
SharedVolumePackages = "packages"
|
||||
SharedVolumeSecrets = "secrets"
|
||||
SharedVolumeConfigmaps = "configmaps"
|
||||
)
|
||||
|
||||
const (
|
||||
MessageQueueTypeNats = "nats-streaming"
|
||||
MessageQueueTypeASQ = "azure-storage-queue"
|
||||
)
|
||||
|
||||
const (
|
||||
// FunctionReferenceFunctionName means that the function
|
||||
// reference is simply by function name.
|
||||
FunctionReferenceTypeFunctionName = "name"
|
||||
|
||||
// Other function reference types we'd like to support:
|
||||
// Versioned function, latest version
|
||||
// Versioned function. by semver "latest compatible"
|
||||
// Set of function references (recursively), by percentage of traffic
|
||||
)
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This file tells deepcopy-gen to generate deepcopy methods for all structs in the package.
|
||||
// For more details, please visit https://blog.openshift.com/kubernetes-deep-dive-code-generation-customresources/
|
||||
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +groupName=fission.io
|
||||
package v1
|
||||
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type (
|
||||
//
|
||||
// Functions and packages
|
||||
//
|
||||
|
||||
// ChecksumType specifies the checksum algorithm, such as
|
||||
// sha256, used for a checksum.
|
||||
ChecksumType string
|
||||
|
||||
// Checksum of package contents when the contents are stored
|
||||
// outside the Package struct. Type is the checksum algorithm;
|
||||
// "sha256" is the only currently supported one. Sum is hex
|
||||
// encoded.
|
||||
Checksum struct {
|
||||
Type ChecksumType `json:"type,omitempty"`
|
||||
Sum string `json:"sum,omitempty"`
|
||||
}
|
||||
|
||||
// ArchiveType is either literal or URL, indicating whether
|
||||
// the package is specified in the Archive struct or
|
||||
// externally.
|
||||
ArchiveType string
|
||||
|
||||
// Package contains or references a collection of source or
|
||||
// binary files.
|
||||
Archive struct {
|
||||
// Type defines how the package is specified: literal or URL.
|
||||
Type ArchiveType `json:"type,omitempty"`
|
||||
|
||||
// Literal contents of the package. Can be used for
|
||||
// encoding packages below TODO (256KB?) size.
|
||||
Literal []byte `json:"literal,omitempty"`
|
||||
|
||||
// URL references a package.
|
||||
URL string `json:"url,omitempty"`
|
||||
|
||||
// Checksum ensures the integrity of packages
|
||||
// refereced by URL. Ignored for literals.
|
||||
Checksum Checksum `json:"checksum,omitempty"`
|
||||
}
|
||||
|
||||
EnvironmentReference struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
SecretReference struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
ConfigMapReference struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
BuildStatus string
|
||||
|
||||
PackageSpec struct {
|
||||
Environment EnvironmentReference `json:"environment"`
|
||||
Source Archive `json:"source,omitempty"`
|
||||
Deployment Archive `json:"deployment,omitempty"`
|
||||
BuildCommand string `json:"buildcmd,omitempty"`
|
||||
// In the future, we can have a debug build here too
|
||||
}
|
||||
|
||||
PackageStatus struct {
|
||||
BuildStatus BuildStatus `json:"buildstatus,omitempty"`
|
||||
BuildLog string `json:"buildlog,omitempty"` // output of the build (errors etc)
|
||||
}
|
||||
|
||||
PackageRef struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Name string `json:"name"`
|
||||
|
||||
// Including resource version in the reference forces the function to be updated on
|
||||
// package update, making it possible to cache the function based on its metadata.
|
||||
ResourceVersion string `json:"resourceversion,omitempty"`
|
||||
}
|
||||
|
||||
FunctionPackageRef struct {
|
||||
PackageRef PackageRef `json:"packageref"`
|
||||
|
||||
// FunctionName specifies a specific function within the package. This allows
|
||||
// functions to share packages, by having different functions within the same
|
||||
// package.
|
||||
//
|
||||
// Fission itself does not interpret this path. It is passed verbatim to
|
||||
// build and runtime environments.
|
||||
//
|
||||
// This is optional: if unspecified, the environment has a default name.
|
||||
FunctionName string `json:"functionName,omitempty"`
|
||||
}
|
||||
|
||||
//ExecutorType is the primary executor for an environment
|
||||
ExecutorType string
|
||||
|
||||
//StrategyType is the strategy to be used for function execution
|
||||
StrategyType string
|
||||
|
||||
// FunctionSpec describes the contents of the function.
|
||||
FunctionSpec struct {
|
||||
// Environment is the build and runtime environment that this function is
|
||||
// associated with. An Environment with this name should exist, otherwise the
|
||||
// function cannot be invoked.
|
||||
Environment EnvironmentReference `json:"environment"`
|
||||
|
||||
// Reference to a package containing deployment and optionally the source
|
||||
Package FunctionPackageRef `json:"package"`
|
||||
|
||||
Secrets []SecretReference `json:"secrets"`
|
||||
ConfigMaps []ConfigMapReference `json:"configmaps"`
|
||||
|
||||
// cpu and memory resources as per K8S standards
|
||||
Resources apiv1.ResourceRequirements `json:"resources"`
|
||||
|
||||
// InvokeStrategy is a set of controls which affect how function executes
|
||||
InvokeStrategy InvokeStrategy
|
||||
}
|
||||
|
||||
/*InvokeStrategy is a set of controls over how the function executes.
|
||||
It affects the performance and resource usage of the function.
|
||||
|
||||
An InvokeStategy is of one of two types: ExecutionStrategy, which controls low-level
|
||||
parameters such as which ExecutorType to use, when to autoscale, minimum and maximum
|
||||
number of running instances, etc. A higher-level AbstractInvokeStrategy will also be
|
||||
supported; this strategy would specify the target request rate of the function,
|
||||
the target latency statistics, and the target cost (in terms of compute resources).
|
||||
*/
|
||||
InvokeStrategy struct {
|
||||
ExecutionStrategy ExecutionStrategy
|
||||
StrategyType StrategyType
|
||||
}
|
||||
|
||||
/*ExecutionStrategy specifies low-level parameters for function execution,
|
||||
such as the number of instances.
|
||||
|
||||
MinScale affects the cold start behaviour for a function. If MinScale is 0 then the
|
||||
deployment is created on first invocation of function and is good for requests of
|
||||
asynchronous nature. If MinScale is greater than 0 then MinScale number of pods are
|
||||
created at the time of creation of function. This ensures faster response during first
|
||||
invocation at the cost of consuming resources.
|
||||
|
||||
MaxScale is the maximum number of pods that function will scale to based on TargetCPUPercent
|
||||
and resources allocated to the function pod.
|
||||
*/
|
||||
ExecutionStrategy struct {
|
||||
ExecutorType ExecutorType
|
||||
MinScale int
|
||||
MaxScale int
|
||||
TargetCPUPercent int
|
||||
}
|
||||
|
||||
FunctionReferenceType string
|
||||
|
||||
FunctionReference struct {
|
||||
// Type indicates whether this function reference is by name or selector. For now,
|
||||
// the only supported reference type is by name. Future reference types:
|
||||
// * Function by label or annotation
|
||||
// * Branch or tag of a versioned function
|
||||
// * A "rolling upgrade" from one version of a function to another
|
||||
Type FunctionReferenceType `json:"type"`
|
||||
|
||||
// Name of the function.
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
//
|
||||
// Environments
|
||||
//
|
||||
|
||||
Runtime struct {
|
||||
// Image for containing the language runtime.
|
||||
Image string `json:"image"`
|
||||
|
||||
// LoadEndpointPort defines the port on which the
|
||||
// server listens for function load
|
||||
// requests. Optional; default 8888.
|
||||
LoadEndpointPort int32 `json:"loadendpointport"`
|
||||
|
||||
// LoadEndpointPath defines the relative URL on which
|
||||
// the server listens for function load
|
||||
// requests. Optional; default "/specialize".
|
||||
LoadEndpointPath string `json:"loadendpointpath"`
|
||||
|
||||
// FunctionEndpointPort defines the port on which the
|
||||
// server listens for function requests. Optional;
|
||||
// default 8888.
|
||||
FunctionEndpointPort int32 `json:"functionendpointport"`
|
||||
|
||||
// Container allows the modification of the deployed runtime
|
||||
// container using the Kubernetes Container spec. Fission overrides
|
||||
// the following fields:
|
||||
// - Name
|
||||
// - Image; set to the Runtime.Image
|
||||
// - TerminationMessagePath
|
||||
// - ImagePullPolicy
|
||||
// (optional)
|
||||
Container *apiv1.Container `json:"container,omitempty"`
|
||||
}
|
||||
|
||||
Builder struct {
|
||||
// Image for containing the language runtime.
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
// (Optional) Default build command to run for this build environment.
|
||||
Command string `json:"command,omitempty"`
|
||||
|
||||
// Container allows the modification of the deployed builder
|
||||
// container using the Kubernetes Container spec. Fission overrides
|
||||
// the following fields:
|
||||
// - Name
|
||||
// - Image; set to the Builder.Image
|
||||
// - Command; set to the Builder.Command
|
||||
// - TerminationMessagePath
|
||||
// - ImagePullPolicy
|
||||
// - ReadinessProbe
|
||||
// (optional)
|
||||
Container *apiv1.Container `json:"container,omitempty"`
|
||||
}
|
||||
|
||||
EnvironmentSpec struct {
|
||||
// Environment API version
|
||||
Version int `json:"version"`
|
||||
|
||||
// Runtime container image etc.; required
|
||||
Runtime Runtime `json:"runtime"`
|
||||
|
||||
// Optional
|
||||
Builder Builder `json:"builder"`
|
||||
|
||||
// Optional, but strongly encouraged. Used to populate
|
||||
// links from UI, CLI, etc.
|
||||
DocumentationURL string `json:"documentationurl,omitempty"`
|
||||
|
||||
// Optional, defaults to 'AllowedFunctionsPerContainerSingle'
|
||||
AllowedFunctionsPerContainer AllowedFunctionsPerContainer `json:"allowedFunctionsPerContainer,omitempty"`
|
||||
|
||||
// Optional, defaults to 'false'
|
||||
AllowAccessToExternalNetwork bool `json:"allowAccessToExternalNetwork,omitempty"`
|
||||
|
||||
// Request and limit resources for the environment
|
||||
Resources apiv1.ResourceRequirements `json:"resources"`
|
||||
|
||||
// The initial pool size for environment
|
||||
Poolsize int `json:"poolsize,omitempty"`
|
||||
|
||||
// The grace time for pod to perform connection draining before termination. The unit is in seconds.
|
||||
// Optional, defaults to 360 seconds
|
||||
TerminationGracePeriod int64
|
||||
}
|
||||
|
||||
AllowedFunctionsPerContainer string
|
||||
|
||||
//
|
||||
// Triggers
|
||||
//
|
||||
|
||||
HTTPTriggerSpec struct {
|
||||
Host string `json:"host"`
|
||||
RelativeURL string `json:"relativeurl"`
|
||||
CreateIngress bool `json:"createingress"`
|
||||
Method string `json:"method"`
|
||||
FunctionReference FunctionReference `json:"functionref"`
|
||||
}
|
||||
|
||||
KubernetesWatchTriggerSpec struct {
|
||||
Namespace string `json:"namespace"`
|
||||
Type string `json:"type"`
|
||||
LabelSelector map[string]string `json:"labelselector"`
|
||||
FunctionReference FunctionReference `json:"functionref"`
|
||||
}
|
||||
|
||||
MessageQueueType string
|
||||
|
||||
// MessageQueueTriggerSpec defines a binding from a topic in a
|
||||
// message queue to a function.
|
||||
MessageQueueTriggerSpec struct {
|
||||
FunctionReference FunctionReference `json:"functionref"`
|
||||
MessageQueueType MessageQueueType `json:"messageQueueType"`
|
||||
Topic string `json:"topic"`
|
||||
ResponseTopic string `json:"respTopic,omitempty"`
|
||||
ContentType string `json:"contentType"`
|
||||
}
|
||||
|
||||
// TimeTrigger invokes the specific function at a time or
|
||||
// times specified by a cron string.
|
||||
TimeTriggerSpec struct {
|
||||
Cron string `json:"cron"`
|
||||
FunctionReference `json:"functionref"`
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,384 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/go-multierror"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
//
|
||||
// To add a Fission CRD type:
|
||||
// 1. Create a "spec" type, for everything in the type except metadata
|
||||
// 2. Create the type with metadata + the spec
|
||||
// 3. Create a list type (for example see FunctionList and Function, below)
|
||||
// 4. Add methods at the bottom of this file for satisfying Object and List interfaces
|
||||
// 5. Add the type to configureClient in fission/crd/client.go
|
||||
// 6. Add the type to EnsureFissionCRDs in fission/crd/crd.go
|
||||
// 7. Add tests to fission/crd/crd_test.go
|
||||
// 8. Add a CRUD Interface type (analogous to FunctionInterface in fission/crd/function.go)
|
||||
// 9. Add a getter method for your interface type to FissionClient in fission/crd/client.go
|
||||
// 10. Follow the instruction in README.md to regenerate CRD type deepcopy methods
|
||||
//
|
||||
|
||||
type (
|
||||
|
||||
// Packages. Think of these as function-level images.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
Package struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec PackageSpec `json:"spec"`
|
||||
|
||||
Status PackageStatus `json:"status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
PackageList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Package `json:"items"`
|
||||
}
|
||||
|
||||
// Functions.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
Function struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec FunctionSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
FunctionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Function `json:"items"`
|
||||
}
|
||||
|
||||
// Environments.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
Environment struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec EnvironmentSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
EnvironmentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Environment `json:"items"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
HTTPTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec HTTPTriggerSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
HTTPTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []HTTPTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Kubernetes Watches as triggers
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
KubernetesWatchTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec KubernetesWatchTriggerSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
KubernetesWatchTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []KubernetesWatchTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Time triggers
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
TimeTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec TimeTriggerSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
TimeTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []TimeTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Message Queue triggers
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
MessageQueueTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec MessageQueueTriggerSpec `json:"spec"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
MessageQueueTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []MessageQueueTrigger `json:"items"`
|
||||
}
|
||||
)
|
||||
|
||||
// Each CRD type needs:
|
||||
// GetObjectKind (to satisfy the Object interface)
|
||||
//
|
||||
// In addition, each singular CRD type needs:
|
||||
// GetObjectMeta (to satisfy the ObjectMetaAccessor interface)
|
||||
//
|
||||
// And each list CRD type needs:
|
||||
// GetListMeta (to satisfy the ListMetaAccessor interface)
|
||||
|
||||
func (f *Function) GetObjectKind() schema.ObjectKind {
|
||||
return &f.TypeMeta
|
||||
}
|
||||
func (e *Environment) GetObjectKind() schema.ObjectKind {
|
||||
return &e.TypeMeta
|
||||
}
|
||||
func (ht *HTTPTrigger) GetObjectKind() schema.ObjectKind {
|
||||
return &ht.TypeMeta
|
||||
}
|
||||
func (w *KubernetesWatchTrigger) GetObjectKind() schema.ObjectKind {
|
||||
return &w.TypeMeta
|
||||
}
|
||||
func (t *TimeTrigger) GetObjectKind() schema.ObjectKind {
|
||||
return &t.TypeMeta
|
||||
}
|
||||
func (m *MessageQueueTrigger) GetObjectKind() schema.ObjectKind {
|
||||
return &m.TypeMeta
|
||||
}
|
||||
func (p *Package) GetObjectKind() schema.ObjectKind {
|
||||
return &p.TypeMeta
|
||||
}
|
||||
|
||||
func (f *Function) GetObjectMeta() metav1.Object {
|
||||
return &f.Metadata
|
||||
}
|
||||
func (e *Environment) GetObjectMeta() metav1.Object {
|
||||
return &e.Metadata
|
||||
}
|
||||
func (ht *HTTPTrigger) GetObjectMeta() metav1.Object {
|
||||
return &ht.Metadata
|
||||
}
|
||||
func (w *KubernetesWatchTrigger) GetObjectMeta() metav1.Object {
|
||||
return &w.Metadata
|
||||
}
|
||||
func (t *TimeTrigger) GetObjectMeta() metav1.Object {
|
||||
return &t.Metadata
|
||||
}
|
||||
func (m *MessageQueueTrigger) GetObjectMeta() metav1.Object {
|
||||
return &m.Metadata
|
||||
}
|
||||
func (p *Package) GetObjectMeta() metav1.Object {
|
||||
return &p.Metadata
|
||||
}
|
||||
|
||||
func (fl *FunctionList) GetObjectKind() schema.ObjectKind {
|
||||
return &fl.TypeMeta
|
||||
}
|
||||
func (el *EnvironmentList) GetObjectKind() schema.ObjectKind {
|
||||
return &el.TypeMeta
|
||||
}
|
||||
func (hl *HTTPTriggerList) GetObjectKind() schema.ObjectKind {
|
||||
return &hl.TypeMeta
|
||||
}
|
||||
func (wl *KubernetesWatchTriggerList) GetObjectKind() schema.ObjectKind {
|
||||
return &wl.TypeMeta
|
||||
}
|
||||
func (wl *TimeTriggerList) GetObjectKind() schema.ObjectKind {
|
||||
return &wl.TypeMeta
|
||||
}
|
||||
func (ml *MessageQueueTriggerList) GetObjectKind() schema.ObjectKind {
|
||||
return &ml.TypeMeta
|
||||
}
|
||||
func (pl *PackageList) GetObjectKind() schema.ObjectKind {
|
||||
return &pl.TypeMeta
|
||||
}
|
||||
|
||||
func (fl *FunctionList) GetListMeta() metav1.ListInterface {
|
||||
return &fl.Metadata
|
||||
}
|
||||
func (el *EnvironmentList) GetListMeta() metav1.ListInterface {
|
||||
return &el.Metadata
|
||||
}
|
||||
func (hl *HTTPTriggerList) GetListMeta() metav1.ListInterface {
|
||||
return &hl.Metadata
|
||||
}
|
||||
func (wl *KubernetesWatchTriggerList) GetListMeta() metav1.ListInterface {
|
||||
return &wl.Metadata
|
||||
}
|
||||
func (wl *TimeTriggerList) GetListMeta() metav1.ListInterface {
|
||||
return &wl.Metadata
|
||||
}
|
||||
func (ml *MessageQueueTriggerList) GetListMeta() metav1.ListInterface {
|
||||
return &ml.Metadata
|
||||
}
|
||||
func (pl *PackageList) GetListMeta() metav1.ListInterface {
|
||||
return &pl.Metadata
|
||||
}
|
||||
|
||||
func validateMetadata(field string, m metav1.ObjectMeta) error {
|
||||
return ValidateKubeReference(field, m.Name, m.Namespace)
|
||||
}
|
||||
|
||||
func (p *Package) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("Package", p.Metadata),
|
||||
p.Spec.Validate(),
|
||||
p.Status.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (pl *PackageList) Validate() error {
|
||||
var result *multierror.Error
|
||||
// not validate ListMeta
|
||||
for _, p := range pl.Items {
|
||||
result = multierror.Append(result, p.Validate())
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (f *Function) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("Function", f.Metadata),
|
||||
f.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (fl *FunctionList) Validate() error {
|
||||
var result *multierror.Error
|
||||
for _, f := range fl.Items {
|
||||
result = multierror.Append(result, f.Validate())
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (e *Environment) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("Environment", e.Metadata),
|
||||
e.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (el *EnvironmentList) Validate() error {
|
||||
var result *multierror.Error
|
||||
for _, e := range el.Items {
|
||||
result = multierror.Append(result, e.Validate())
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (h *HTTPTrigger) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("HTTPTrigger", h.Metadata),
|
||||
h.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (hl *HTTPTriggerList) Validate() error {
|
||||
var result *multierror.Error
|
||||
for _, h := range hl.Items {
|
||||
result = multierror.Append(result, h.Validate())
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (k *KubernetesWatchTrigger) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("KubernetesWatchTrigger", k.Metadata),
|
||||
k.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (kl *KubernetesWatchTriggerList) Validate() error {
|
||||
var result *multierror.Error
|
||||
for _, k := range kl.Items {
|
||||
result = multierror.Append(result, k.Validate())
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (t *TimeTrigger) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("TimeTrigger", t.Metadata),
|
||||
t.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (tl *TimeTriggerList) Validate() error {
|
||||
var result *multierror.Error
|
||||
for _, t := range tl.Items {
|
||||
result = multierror.Append(result, t.Validate())
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (m *MessageQueueTrigger) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
validateMetadata("MessageQueueTrigger", m.Metadata),
|
||||
m.Spec.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ml *MessageQueueTriggerList) Validate() error {
|
||||
var result *multierror.Error
|
||||
for _, m := range ml.Items {
|
||||
result = multierror.Append(result, m.Validate())
|
||||
}
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
/*
|
||||
Copyright 2018 The Fission Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-multierror"
|
||||
nsUtil "github.com/nats-io/nats-streaming-server/util"
|
||||
"github.com/robfig/cron"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
)
|
||||
|
||||
const (
|
||||
ErrorUnsupportedType = iota
|
||||
ErrorInvalidValue
|
||||
ErrorInvalidObject
|
||||
)
|
||||
|
||||
var (
|
||||
validAzureQueueName = regexp.MustCompile("^[a-z0-9][a-z0-9\\-]*[a-z0-9]$")
|
||||
)
|
||||
|
||||
type (
|
||||
ValidationErrorType int
|
||||
|
||||
// ValidationError is a custom error type for resource validation.
|
||||
// It indicate which field is invalid or illegal in the fission resource.
|
||||
// Also, it shows what kind of error type, bad value and detail error messages.
|
||||
ValidationError struct {
|
||||
// Type of validation error.
|
||||
// It indicates what kind of error of field in error output.
|
||||
Type ValidationErrorType
|
||||
|
||||
// Name of error field.
|
||||
// Example: FunctionReference.Name
|
||||
Field string
|
||||
|
||||
// Error field value.
|
||||
BadValue string
|
||||
|
||||
// Detail error message
|
||||
Detail string
|
||||
}
|
||||
)
|
||||
|
||||
func (e ValidationError) Error() string {
|
||||
// Example error message
|
||||
// Failed to create HTTP trigger: Invalid fission HTTPTrigger object:
|
||||
// * FunctionReference.Name: Invalid value: findped.ts: [...]
|
||||
|
||||
errMsg := fmt.Sprintf("%v: ", e.Field)
|
||||
|
||||
switch e.Type {
|
||||
case ErrorUnsupportedType:
|
||||
errMsg += fmt.Sprintf("Unsupported type: %v", e.BadValue)
|
||||
case ErrorInvalidValue:
|
||||
errMsg += fmt.Sprintf("Invalid value: %v", e.BadValue)
|
||||
case ErrorInvalidObject:
|
||||
errMsg += fmt.Sprintf("Invalid object: %v", e.BadValue)
|
||||
default:
|
||||
errMsg += fmt.Sprintf("Unknown error type: %v", e.BadValue)
|
||||
}
|
||||
|
||||
if len(e.Detail) > 0 {
|
||||
errMsg += fmt.Sprintf(": %v", e.Detail)
|
||||
}
|
||||
|
||||
return errMsg
|
||||
}
|
||||
|
||||
func AggregateValidationErrors(objName string, err error) error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result, err)
|
||||
|
||||
result.ErrorFormat = func(errs []error) string {
|
||||
errMsg := fmt.Sprintf("Invalid fission %v object:\n", objName)
|
||||
for _, err := range errs {
|
||||
errMsg += fmt.Sprintf("* %v\n", err.Error())
|
||||
}
|
||||
return errMsg
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func MakeValidationErr(errType ValidationErrorType, field string, val interface{}, detail ...string) ValidationError {
|
||||
return ValidationError{
|
||||
Type: errType,
|
||||
Field: field,
|
||||
BadValue: fmt.Sprintf("%v", val),
|
||||
Detail: fmt.Sprintf("%v", detail),
|
||||
}
|
||||
}
|
||||
|
||||
func ValidateKubeLabel(field string, labels map[string]string) error {
|
||||
var result *multierror.Error
|
||||
|
||||
for k, v := range labels {
|
||||
// Example: XXX -> YYY
|
||||
// KubernetesWatchTriggerSpec.LabelSelector.Key: Invalid value: XXX
|
||||
// KubernetesWatchTriggerSpec.LabelSelector.Value: Invalid value: YYY
|
||||
result = multierror.Append(result,
|
||||
MakeValidationErr(ErrorInvalidValue, fmt.Sprintf("%v.Key", field), k, validation.IsQualifiedName(k)...),
|
||||
MakeValidationErr(ErrorInvalidValue, fmt.Sprintf("%v.Value", field), v, validation.IsValidLabelValue(v)...))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func ValidateKubePort(field string, port int) error {
|
||||
var result *multierror.Error
|
||||
|
||||
e := validation.IsValidPortNum(port)
|
||||
if len(e) > 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, port, e...))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func ValidateKubeName(field string, val string) error {
|
||||
var result *multierror.Error
|
||||
|
||||
e := validation.IsDNS1123Label(val)
|
||||
if len(e) > 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, val, e...))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func ValidateKubeReference(refName string, name string, namespace string) error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result,
|
||||
ValidateKubeName(fmt.Sprintf("%v.Name", refName), name),
|
||||
ValidateKubeName(fmt.Sprintf("%v.Namespace", refName), namespace))
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func IsTopicValid(mqType MessageQueueType, topic string) bool {
|
||||
switch mqType {
|
||||
case MessageQueueTypeNats:
|
||||
return nsUtil.IsChannelNameValid(topic, false)
|
||||
case MessageQueueTypeASQ:
|
||||
return len(topic) >= 3 && len(topic) <= 63 && validAzureQueueName.MatchString(topic)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsValidCronSpec(spec string) error {
|
||||
_, err := cron.Parse(spec)
|
||||
return err
|
||||
}
|
||||
|
||||
/* Resource validation function */
|
||||
|
||||
func (checksum Checksum) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch checksum.Type {
|
||||
case ChecksumTypeSHA256: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "Checksum.Type", checksum.Type, "not a valid checksum type"))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (archive Archive) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
if len(archive.Type) > 0 {
|
||||
switch archive.Type {
|
||||
case ArchiveTypeLiteral, ArchiveTypeUrl: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "Archive.Type", archive.Type, "not a valid archive type"))
|
||||
}
|
||||
}
|
||||
|
||||
if archive.Checksum != (Checksum{}) {
|
||||
result = multierror.Append(result, archive.Checksum.Validate())
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ref EnvironmentReference) Validate() error {
|
||||
var result *multierror.Error
|
||||
result = multierror.Append(result, ValidateKubeReference("EnvironmentReference", ref.Name, ref.Namespace))
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ref SecretReference) Validate() error {
|
||||
var result *multierror.Error
|
||||
result = multierror.Append(result, ValidateKubeReference("SecretReference", ref.Name, ref.Namespace))
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ref ConfigMapReference) Validate() error {
|
||||
var result *multierror.Error
|
||||
result = multierror.Append(result, ValidateKubeReference("ConfigMapReference", ref.Name, ref.Namespace))
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec PackageSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result, spec.Environment.Validate())
|
||||
|
||||
for _, r := range []Archive{spec.Source, spec.Deployment} {
|
||||
if len(r.URL) > 0 || len(r.Literal) > 0 {
|
||||
result = multierror.Append(result, r.Validate())
|
||||
}
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (sts PackageStatus) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch sts.BuildStatus {
|
||||
case BuildStatusPending, BuildStatusRunning, BuildStatusSucceeded, BuildStatusFailed, BuildStatusNone: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "PackageStatus.BuildStatus", sts.BuildStatus, "not a valid build status"))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ref PackageRef) Validate() error {
|
||||
var result *multierror.Error
|
||||
result = multierror.Append(result, ValidateKubeReference("PackageRef", ref.Name, ref.Namespace))
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ref FunctionPackageRef) Validate() error {
|
||||
var result *multierror.Error
|
||||
result = multierror.Append(result, ref.PackageRef.Validate())
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec FunctionSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
if spec.Environment != (EnvironmentReference{}) {
|
||||
result = multierror.Append(result, spec.Environment.Validate())
|
||||
}
|
||||
|
||||
if spec.Package != (FunctionPackageRef{}) {
|
||||
result = multierror.Append(result, spec.Package.Validate())
|
||||
}
|
||||
|
||||
for _, s := range spec.Secrets {
|
||||
result = multierror.Append(result, s.Validate())
|
||||
}
|
||||
for _, c := range spec.ConfigMaps {
|
||||
result = multierror.Append(result, c.Validate())
|
||||
}
|
||||
|
||||
if spec.InvokeStrategy != (InvokeStrategy{}) {
|
||||
result = multierror.Append(result, spec.InvokeStrategy.Validate())
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (is InvokeStrategy) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch is.StrategyType {
|
||||
case StrategyTypeExecution: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "InvokeStrategy.StrategyType", is.StrategyType, "not a valid valid strategy"))
|
||||
}
|
||||
|
||||
result = multierror.Append(result, is.ExecutionStrategy.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (es ExecutionStrategy) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch es.ExecutorType {
|
||||
case ExecutorTypeNewdeploy, ExecutorTypePoolmgr: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "ExecutionStrategy.ExecutorType", es.ExecutorType, "not a valid executor type"))
|
||||
}
|
||||
|
||||
if es.MinScale < 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MinScale", es.MinScale, "minimum scale must be greater or equal to 0"))
|
||||
}
|
||||
|
||||
if es.MaxScale < es.MinScale {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MaxScale", es.MaxScale, "maximum scale must be greater or equal to minimum scale"))
|
||||
}
|
||||
|
||||
if es.TargetCPUPercent <= 0 || es.TargetCPUPercent > 100 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.TargetCPUPercent", es.TargetCPUPercent, "TargetCPUPercent must be a value between 1 - 100"))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (ref FunctionReference) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch ref.Type {
|
||||
case FunctionReferenceTypeFunctionName: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "FunctionReference.Type", ref.Type, "not a valid function reference type"))
|
||||
}
|
||||
|
||||
result = multierror.Append(result, ValidateKubeName("FunctionReference.Name", ref.Name))
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (runtime Runtime) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
if runtime.LoadEndpointPort > 0 {
|
||||
result = multierror.Append(result, ValidateKubePort("Runtime.LoadEndpointPort", int(runtime.LoadEndpointPort)))
|
||||
}
|
||||
|
||||
if runtime.FunctionEndpointPort > 0 {
|
||||
result = multierror.Append(result, ValidateKubePort("Runtime.FunctionEndpointPort", int(runtime.FunctionEndpointPort)))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (builder Builder) Validate() error {
|
||||
// do nothing for now
|
||||
return nil
|
||||
}
|
||||
|
||||
func (spec EnvironmentSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
if spec.Version < 1 && spec.Version > 3 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.Version", spec.Version, "not a valid environment version"))
|
||||
}
|
||||
|
||||
result = multierror.Append(result, spec.Runtime.Validate())
|
||||
|
||||
if spec.Builder != (Builder{}) {
|
||||
result = multierror.Append(result, spec.Builder.Validate())
|
||||
}
|
||||
|
||||
if len(spec.AllowedFunctionsPerContainer) > 0 {
|
||||
switch spec.AllowedFunctionsPerContainer {
|
||||
case AllowedFunctionsPerContainerSingle, AllowedFunctionsPerContainerInfinite: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "EnvironmentSpec.AllowedFunctionsPerContainer", spec.AllowedFunctionsPerContainer, "not a valid value"))
|
||||
}
|
||||
}
|
||||
|
||||
if spec.Poolsize < 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "EnvironmentSpec.Poolsize", spec.Poolsize, "Poolsize must be greater or equal to 0"))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec HTTPTriggerSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch spec.Method {
|
||||
case http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodPatch,
|
||||
http.MethodDelete, http.MethodConnect, http.MethodOptions, http.MethodTrace: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "HTTPTriggerSpec.Method", spec.Method, "not a valid HTTP method"))
|
||||
}
|
||||
|
||||
result = multierror.Append(result, spec.FunctionReference.Validate())
|
||||
|
||||
if len(spec.Host) > 0 {
|
||||
e := validation.IsDNS1123Subdomain(spec.Host)
|
||||
if len(e) > 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "HTTPTriggerSpec.Host", spec.Host, e...))
|
||||
}
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec KubernetesWatchTriggerSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
switch strings.ToUpper(spec.Type) {
|
||||
case "POD", "SERVICE", "REPLICATIONCONTROLLER", "JOB":
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "KubernetesWatchTriggerSpec.Type", spec.Type, "not a valid supported type"))
|
||||
}
|
||||
|
||||
result = multierror.Append(result,
|
||||
ValidateKubeName("KubernetesWatchTriggerSpec.Namespace", spec.Namespace),
|
||||
ValidateKubeLabel("KubernetesWatchTriggerSpec.LabelSelector", spec.LabelSelector),
|
||||
spec.FunctionReference.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec MessageQueueTriggerSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
result = multierror.Append(result, spec.FunctionReference.Validate())
|
||||
|
||||
switch spec.MessageQueueType {
|
||||
case MessageQueueTypeNats, MessageQueueTypeASQ: // no op
|
||||
default:
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "MessageQueueTriggerSpec.MessageQueueType", spec.MessageQueueType, "not a supported message queue type"))
|
||||
}
|
||||
|
||||
if !IsTopicValid(spec.MessageQueueType, spec.Topic) {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "MessageQueueTriggerSpec.Topic", spec.Topic, "not a valid topic"))
|
||||
}
|
||||
|
||||
if len(spec.ResponseTopic) > 0 && !IsTopicValid(spec.MessageQueueType, spec.ResponseTopic) {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "MessageQueueTriggerSpec.ResponseTopic", spec.ResponseTopic, "not a valid topic"))
|
||||
}
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
|
||||
func (spec TimeTriggerSpec) Validate() error {
|
||||
var result *multierror.Error
|
||||
|
||||
err := IsValidCronSpec(spec.Cron)
|
||||
if err != nil {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "TimeTriggerSpec.Cron", spec.Cron, "not a valid cron spec"))
|
||||
}
|
||||
|
||||
result = multierror.Append(result, spec.FunctionReference.Validate())
|
||||
|
||||
return result.ErrorOrNil()
|
||||
}
|
||||
@@ -0,0 +1,840 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
core_v1 "k8s.io/api/core/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Archive) DeepCopyInto(out *Archive) {
|
||||
*out = *in
|
||||
if in.Literal != nil {
|
||||
in, out := &in.Literal, &out.Literal
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.Checksum = in.Checksum
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Archive.
|
||||
func (in *Archive) DeepCopy() *Archive {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Archive)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Builder) DeepCopyInto(out *Builder) {
|
||||
*out = *in
|
||||
if in.Container != nil {
|
||||
in, out := &in.Container, &out.Container
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(core_v1.Container)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Builder.
|
||||
func (in *Builder) DeepCopy() *Builder {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Builder)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Checksum) DeepCopyInto(out *Checksum) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Checksum.
|
||||
func (in *Checksum) DeepCopy() *Checksum {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Checksum)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ConfigMapReference) DeepCopyInto(out *ConfigMapReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapReference.
|
||||
func (in *ConfigMapReference) DeepCopy() *ConfigMapReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ConfigMapReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Environment) DeepCopyInto(out *Environment) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Environment.
|
||||
func (in *Environment) DeepCopy() *Environment {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Environment)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Environment) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvironmentList) DeepCopyInto(out *EnvironmentList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Environment, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentList.
|
||||
func (in *EnvironmentList) DeepCopy() *EnvironmentList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvironmentList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *EnvironmentList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvironmentReference) DeepCopyInto(out *EnvironmentReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentReference.
|
||||
func (in *EnvironmentReference) DeepCopy() *EnvironmentReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvironmentReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) {
|
||||
*out = *in
|
||||
in.Runtime.DeepCopyInto(&out.Runtime)
|
||||
in.Builder.DeepCopyInto(&out.Builder)
|
||||
in.Resources.DeepCopyInto(&out.Resources)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec.
|
||||
func (in *EnvironmentSpec) DeepCopy() *EnvironmentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvironmentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExecutionStrategy) DeepCopyInto(out *ExecutionStrategy) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionStrategy.
|
||||
func (in *ExecutionStrategy) DeepCopy() *ExecutionStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExecutionStrategy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Function) DeepCopyInto(out *Function) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Function.
|
||||
func (in *Function) DeepCopy() *Function {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Function)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Function) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FunctionList) DeepCopyInto(out *FunctionList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Function, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionList.
|
||||
func (in *FunctionList) DeepCopy() *FunctionList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FunctionList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FunctionList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FunctionPackageRef) DeepCopyInto(out *FunctionPackageRef) {
|
||||
*out = *in
|
||||
out.PackageRef = in.PackageRef
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionPackageRef.
|
||||
func (in *FunctionPackageRef) DeepCopy() *FunctionPackageRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FunctionPackageRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FunctionReference) DeepCopyInto(out *FunctionReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionReference.
|
||||
func (in *FunctionReference) DeepCopy() *FunctionReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FunctionReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FunctionSpec) DeepCopyInto(out *FunctionSpec) {
|
||||
*out = *in
|
||||
out.Environment = in.Environment
|
||||
out.Package = in.Package
|
||||
if in.Secrets != nil {
|
||||
in, out := &in.Secrets, &out.Secrets
|
||||
*out = make([]SecretReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ConfigMaps != nil {
|
||||
in, out := &in.ConfigMaps, &out.ConfigMaps
|
||||
*out = make([]ConfigMapReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
in.Resources.DeepCopyInto(&out.Resources)
|
||||
out.InvokeStrategy = in.InvokeStrategy
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionSpec.
|
||||
func (in *FunctionSpec) DeepCopy() *FunctionSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FunctionSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPTrigger) DeepCopyInto(out *HTTPTrigger) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
out.Spec = in.Spec
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPTrigger.
|
||||
func (in *HTTPTrigger) DeepCopy() *HTTPTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HTTPTrigger) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPTriggerList) DeepCopyInto(out *HTTPTriggerList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]HTTPTrigger, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPTriggerList.
|
||||
func (in *HTTPTriggerList) DeepCopy() *HTTPTriggerList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPTriggerList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *HTTPTriggerList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPTriggerSpec) DeepCopyInto(out *HTTPTriggerSpec) {
|
||||
*out = *in
|
||||
out.FunctionReference = in.FunctionReference
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPTriggerSpec.
|
||||
func (in *HTTPTriggerSpec) DeepCopy() *HTTPTriggerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPTriggerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InvokeStrategy) DeepCopyInto(out *InvokeStrategy) {
|
||||
*out = *in
|
||||
out.ExecutionStrategy = in.ExecutionStrategy
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InvokeStrategy.
|
||||
func (in *InvokeStrategy) DeepCopy() *InvokeStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(InvokeStrategy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KubernetesWatchTrigger) DeepCopyInto(out *KubernetesWatchTrigger) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesWatchTrigger.
|
||||
func (in *KubernetesWatchTrigger) DeepCopy() *KubernetesWatchTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KubernetesWatchTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *KubernetesWatchTrigger) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KubernetesWatchTriggerList) DeepCopyInto(out *KubernetesWatchTriggerList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]KubernetesWatchTrigger, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesWatchTriggerList.
|
||||
func (in *KubernetesWatchTriggerList) DeepCopy() *KubernetesWatchTriggerList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KubernetesWatchTriggerList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *KubernetesWatchTriggerList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KubernetesWatchTriggerSpec) DeepCopyInto(out *KubernetesWatchTriggerSpec) {
|
||||
*out = *in
|
||||
if in.LabelSelector != nil {
|
||||
in, out := &in.LabelSelector, &out.LabelSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
out.FunctionReference = in.FunctionReference
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesWatchTriggerSpec.
|
||||
func (in *KubernetesWatchTriggerSpec) DeepCopy() *KubernetesWatchTriggerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KubernetesWatchTriggerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MessageQueueTrigger) DeepCopyInto(out *MessageQueueTrigger) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
out.Spec = in.Spec
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessageQueueTrigger.
|
||||
func (in *MessageQueueTrigger) DeepCopy() *MessageQueueTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MessageQueueTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *MessageQueueTrigger) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MessageQueueTriggerList) DeepCopyInto(out *MessageQueueTriggerList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]MessageQueueTrigger, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessageQueueTriggerList.
|
||||
func (in *MessageQueueTriggerList) DeepCopy() *MessageQueueTriggerList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MessageQueueTriggerList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *MessageQueueTriggerList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MessageQueueTriggerSpec) DeepCopyInto(out *MessageQueueTriggerSpec) {
|
||||
*out = *in
|
||||
out.FunctionReference = in.FunctionReference
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessageQueueTriggerSpec.
|
||||
func (in *MessageQueueTriggerSpec) DeepCopy() *MessageQueueTriggerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MessageQueueTriggerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Package) DeepCopyInto(out *Package) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Package.
|
||||
func (in *Package) DeepCopy() *Package {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Package)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Package) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PackageList) DeepCopyInto(out *PackageList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Package, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageList.
|
||||
func (in *PackageList) DeepCopy() *PackageList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PackageList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PackageList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PackageRef) DeepCopyInto(out *PackageRef) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageRef.
|
||||
func (in *PackageRef) DeepCopy() *PackageRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PackageRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PackageSpec) DeepCopyInto(out *PackageSpec) {
|
||||
*out = *in
|
||||
out.Environment = in.Environment
|
||||
in.Source.DeepCopyInto(&out.Source)
|
||||
in.Deployment.DeepCopyInto(&out.Deployment)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageSpec.
|
||||
func (in *PackageSpec) DeepCopy() *PackageSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PackageSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PackageStatus) DeepCopyInto(out *PackageStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageStatus.
|
||||
func (in *PackageStatus) DeepCopy() *PackageStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PackageStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Runtime) DeepCopyInto(out *Runtime) {
|
||||
*out = *in
|
||||
if in.Container != nil {
|
||||
in, out := &in.Container, &out.Container
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(core_v1.Container)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Runtime.
|
||||
func (in *Runtime) DeepCopy() *Runtime {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Runtime)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SecretReference) DeepCopyInto(out *SecretReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference.
|
||||
func (in *SecretReference) DeepCopy() *SecretReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SecretReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TimeTrigger) DeepCopyInto(out *TimeTrigger) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.Metadata.DeepCopyInto(&out.Metadata)
|
||||
out.Spec = in.Spec
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeTrigger.
|
||||
func (in *TimeTrigger) DeepCopy() *TimeTrigger {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TimeTrigger)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TimeTrigger) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TimeTriggerList) DeepCopyInto(out *TimeTriggerList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.Metadata = in.Metadata
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]TimeTrigger, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeTriggerList.
|
||||
func (in *TimeTriggerList) DeepCopy() *TimeTriggerList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TimeTriggerList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *TimeTriggerList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TimeTriggerSpec) DeepCopyInto(out *TimeTriggerSpec) {
|
||||
*out = *in
|
||||
out.FunctionReference = in.FunctionReference
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeTriggerSpec.
|
||||
func (in *TimeTriggerSpec) DeepCopy() *TimeTriggerSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TimeTriggerSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ValidationError) DeepCopyInto(out *ValidationError) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidationError.
|
||||
func (in *ValidationError) DeepCopy() *ValidationError {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ValidationError)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user