Update k8s dependencies to 1.10 (#687)
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ branches:
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.8
|
||||
- 1.10.2
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
||||
@@ -23,13 +23,13 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
"k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
@@ -373,13 +373,9 @@ func (envw *environmentWatcher) createBuilder(env *crd.Environment, ns string) (
|
||||
}
|
||||
|
||||
func (envw *environmentWatcher) deleteBuilderServiceByName(name, namespace string) error {
|
||||
falseVal := false
|
||||
delOpt := &metav1.DeleteOptions{
|
||||
OrphanDependents: &falseVal,
|
||||
}
|
||||
err := envw.kubernetesClient.
|
||||
err := envw.kubernetesClient.CoreV1().
|
||||
Services(namespace).
|
||||
Delete(name, delOpt)
|
||||
Delete(name, &delOpt)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error deleting builder service %s.%s: %v", name, namespace, err)
|
||||
}
|
||||
@@ -387,13 +383,9 @@ func (envw *environmentWatcher) deleteBuilderServiceByName(name, namespace strin
|
||||
}
|
||||
|
||||
func (envw *environmentWatcher) deleteBuilderDeploymentByName(name, namespace string) error {
|
||||
falseVal := false
|
||||
delOpt := &metav1.DeleteOptions{
|
||||
OrphanDependents: &falseVal,
|
||||
}
|
||||
err := envw.kubernetesClient.ExtensionsV1beta1().
|
||||
Deployments(namespace).
|
||||
Delete(name, delOpt)
|
||||
Delete(name, &delOpt)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error deleting builder deployment %s.%s: %v", name, namespace, err)
|
||||
}
|
||||
@@ -407,7 +399,7 @@ func (envw *environmentWatcher) deleteBuilderService(sel map[string]string, ns s
|
||||
}
|
||||
for _, svc := range svcList {
|
||||
log.Printf("Removing builder service: %v", svc.ObjectMeta.Name)
|
||||
err = envw.kubernetesClient.
|
||||
err = envw.kubernetesClient.CoreV1().
|
||||
Services(ns).
|
||||
Delete(svc.ObjectMeta.Name, &delOpt)
|
||||
if err != nil {
|
||||
@@ -435,7 +427,7 @@ func (envw *environmentWatcher) deleteBuilderDeployment(sel map[string]string, n
|
||||
}
|
||||
|
||||
func (envw *environmentWatcher) getBuilderServiceList(sel map[string]string, ns string) ([]apiv1.Service, error) {
|
||||
svcList, err := envw.kubernetesClient.Services(ns).List(
|
||||
svcList, err := envw.kubernetesClient.CoreV1().Services(ns).List(
|
||||
metav1.ListOptions{
|
||||
LabelSelector: labels.Set(sel).AsSelector().String(),
|
||||
})
|
||||
@@ -480,7 +472,7 @@ func (envw *environmentWatcher) createBuilderService(env *crd.Environment, ns st
|
||||
},
|
||||
}
|
||||
log.Printf("Creating builder service: %v", name)
|
||||
_, err := envw.kubernetesClient.Services(ns).Create(&service)
|
||||
_, err := envw.kubernetesClient.CoreV1().Services(ns).Create(&service)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
k8sCache "k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/fission/fission"
|
||||
|
||||
@@ -28,8 +28,8 @@ import (
|
||||
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/imdario/mergo"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
func UrlForFunction(name, namespace string) string {
|
||||
|
||||
+5
-5
@@ -17,16 +17,16 @@ limitations under the License.
|
||||
package fission
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"fmt"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
rbac "k8s.io/api/rbac/v1beta1"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
rbac "k8s.io/client-go/pkg/apis/rbac/v1beta1"
|
||||
)
|
||||
|
||||
// This file has util functions needed for setting up and cleaning up RBAC objects.
|
||||
@@ -47,14 +47,14 @@ func MakeSAObj(sa, ns string) *apiv1.ServiceAccount {
|
||||
|
||||
// SetupSA checks if a service account is present in the namespace, if not creates it.
|
||||
func SetupSA(k8sClient *kubernetes.Clientset, sa, ns string) (*apiv1.ServiceAccount, error) {
|
||||
saObj, err := k8sClient.CoreV1Client.ServiceAccounts(ns).Get(sa, metav1.GetOptions{})
|
||||
saObj, err := k8sClient.CoreV1().ServiceAccounts(ns).Get(sa, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
return saObj, nil
|
||||
}
|
||||
|
||||
if k8serrors.IsNotFound(err) {
|
||||
saObj = MakeSAObj(sa, ns)
|
||||
saObj, err = k8sClient.CoreV1Client.ServiceAccounts(ns).Create(saObj)
|
||||
saObj, err = k8sClient.CoreV1().ServiceAccounts(ns).Create(saObj)
|
||||
}
|
||||
|
||||
return saObj, err
|
||||
|
||||
+3
-5
@@ -25,10 +25,10 @@ import (
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
@@ -123,14 +123,14 @@ func (api *API) createNsIfNotExists(ns string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := api.kubernetesClient.CoreV1Client.Namespaces().Get(ns, metav1.GetOptions{})
|
||||
_, err := api.kubernetesClient.CoreV1().Namespaces().Get(ns, metav1.GetOptions{})
|
||||
if err != nil && kerrors.IsNotFound(err) {
|
||||
ns := &apiv1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: ns,
|
||||
},
|
||||
}
|
||||
_, err = api.kubernetesClient.CoreV1Client.Namespaces().Create(ns)
|
||||
_, err = api.kubernetesClient.CoreV1().Namespaces().Create(ns)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -216,8 +216,6 @@ func (api *API) Serve(port int) {
|
||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiUpdate).Methods("PUT")
|
||||
r.HandleFunc("/v2/triggers/messagequeue/{mqTrigger}", api.MessageQueueTriggerApiDelete).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/v2/deleteTpr", api.Tpr2crdApi).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/v2/secrets/{secret}", api.SecretGet).Methods("GET")
|
||||
r.HandleFunc("/v2/configmaps/{configmap}", api.ConfigMapGet).Methods("GET")
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/controller/client"
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
func (c *Client) SecretGet(m *metav1.ObjectMeta) (*apiv1.Secret, error) {
|
||||
|
||||
@@ -24,14 +24,14 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) EnvironmentCreate(env *crd.Environment) (*metav1.ObjectMeta, error) {
|
||||
err := env.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("Environment", err)
|
||||
return nil, fv1.AggregateValidationErrors("Environment", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(env)
|
||||
@@ -86,7 +86,7 @@ func (c *Client) EnvironmentGet(m *metav1.ObjectMeta) (*crd.Environment, error)
|
||||
func (c *Client) EnvironmentUpdate(env *crd.Environment) (*metav1.ObjectMeta, error) {
|
||||
err := env.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("Environment", err)
|
||||
return nil, fv1.AggregateValidationErrors("Environment", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(env)
|
||||
|
||||
@@ -24,14 +24,14 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) FunctionCreate(f *crd.Function) (*metav1.ObjectMeta, error) {
|
||||
err := f.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("Function", err)
|
||||
return nil, fv1.AggregateValidationErrors("Function", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(f)
|
||||
@@ -100,7 +100,7 @@ func (c *Client) FunctionGetRawDeployment(m *metav1.ObjectMeta) ([]byte, error)
|
||||
func (c *Client) FunctionUpdate(f *crd.Function) (*metav1.ObjectMeta, error) {
|
||||
err := f.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("Function", err)
|
||||
return nil, fv1.AggregateValidationErrors("Function", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(f)
|
||||
|
||||
@@ -24,14 +24,14 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) HTTPTriggerCreate(t *crd.HTTPTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := t.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("HTTPTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("HTTPTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(t)
|
||||
@@ -86,7 +86,7 @@ func (c *Client) HTTPTriggerGet(m *metav1.ObjectMeta) (*crd.HTTPTrigger, error)
|
||||
func (c *Client) HTTPTriggerUpdate(t *crd.HTTPTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := t.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("HTTPTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("HTTPTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(t)
|
||||
|
||||
@@ -26,12 +26,13 @@ import (
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) WatchCreate(w *crd.KubernetesWatchTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := w.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("KubernetesWatchTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("KubernetesWatchTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(w)
|
||||
|
||||
@@ -24,14 +24,14 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) MessageQueueTriggerCreate(t *crd.MessageQueueTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := t.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("MessageQueueTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("MessageQueueTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(t)
|
||||
@@ -86,7 +86,7 @@ func (c *Client) MessageQueueTriggerGet(m *metav1.ObjectMeta) (*crd.MessageQueue
|
||||
func (c *Client) MessageQueueTriggerUpdate(mqTrigger *crd.MessageQueueTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := mqTrigger.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("MessageQueueTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("MessageQueueTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(mqTrigger)
|
||||
|
||||
@@ -24,14 +24,14 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) PackageCreate(f *crd.Package) (*metav1.ObjectMeta, error) {
|
||||
err := f.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("Package", err)
|
||||
return nil, fv1.AggregateValidationErrors("Package", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(f)
|
||||
@@ -86,7 +86,7 @@ func (c *Client) PackageGet(m *metav1.ObjectMeta) (*crd.Package, error) {
|
||||
func (c *Client) PackageUpdate(f *crd.Package) (*metav1.ObjectMeta, error) {
|
||||
err := f.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("Package", err)
|
||||
return nil, fv1.AggregateValidationErrors("Package", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(f)
|
||||
|
||||
@@ -24,14 +24,14 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func (c *Client) TimeTriggerCreate(t *crd.TimeTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := t.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("TimeTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("TimeTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(t)
|
||||
@@ -86,7 +86,7 @@ func (c *Client) TimeTriggerGet(m *metav1.ObjectMeta) (*crd.TimeTrigger, error)
|
||||
func (c *Client) TimeTriggerUpdate(t *crd.TimeTrigger) (*metav1.ObjectMeta, error) {
|
||||
err := t.Validate()
|
||||
if err != nil {
|
||||
return nil, fission.AggregateValidationErrors("TimeTrigger", err)
|
||||
return nil, fv1.AggregateValidationErrors("TimeTrigger", err)
|
||||
}
|
||||
|
||||
reqbody, err := json.Marshal(t)
|
||||
|
||||
@@ -33,7 +33,7 @@ func (a *API) ConfigMapGet(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
configMap, err := a.kubernetesClient.ConfigMaps(ns).Get(name, metav1.GetOptions{})
|
||||
configMap, err := a.kubernetesClient.CoreV1().ConfigMaps(ns).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("Error getting config map: %s from ns: %s", name, ns)
|
||||
a.respondWithError(w, err)
|
||||
|
||||
@@ -28,8 +28,8 @@ import (
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
|
||||
"github.com/fission/fission"
|
||||
|
||||
@@ -33,7 +33,7 @@ func (a *API) SecretGet(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
secret, err := a.kubernetesClient.Secrets(ns).Get(name, metav1.GetOptions{})
|
||||
secret, err := a.kubernetesClient.CoreV1().Secrets(ns).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("Error getting secret: %s from ns: %s", name, ns)
|
||||
a.respondWithError(w, err)
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 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 controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission/crd"
|
||||
)
|
||||
|
||||
func (a *API) Tpr2crdApi(w http.ResponseWriter, r *http.Request) {
|
||||
_, kubeClient, _, err := crd.MakeFissionClient()
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
fissionTprs := []string{
|
||||
"function.fission.io",
|
||||
"environment.fission.io",
|
||||
"httptrigger.fission.io",
|
||||
"kuberneteswatchtrigger.fission.io",
|
||||
"timetrigger.fission.io",
|
||||
"messagequeuetrigger.fission.io",
|
||||
"package.fission.io",
|
||||
}
|
||||
|
||||
tprList, err := kubeClient.ThirdPartyResources().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, tpr := range tprList.Items {
|
||||
for _, tprName := range fissionTprs {
|
||||
if tpr.Name == tprName {
|
||||
err := kubeClient.ThirdPartyResources().Delete(tpr.Name, &metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a.respondWithSuccess(w, nil)
|
||||
}
|
||||
+15
-338
@@ -17,345 +17,22 @@ limitations under the License.
|
||||
package crd
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/go-multierror"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/fission/fission"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
//
|
||||
// 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 client.go
|
||||
// 6. Add the type to EnsureFissionCRDs in crd.go
|
||||
// 7. Add tests to crd_test.go
|
||||
// 8. Add a CRUD Interface type (analogous to FunctionInterface in function.go)
|
||||
// 9. Add a getter method for your interface type to FissionClient in client.go
|
||||
//
|
||||
|
||||
type (
|
||||
// Packages. Think of these as function-level images.
|
||||
Package struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.PackageSpec `json:"spec"`
|
||||
|
||||
Status fission.PackageStatus `json:"status"`
|
||||
}
|
||||
PackageList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Package `json:"items"`
|
||||
}
|
||||
|
||||
// Functions.
|
||||
Function struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.FunctionSpec `json:"spec"`
|
||||
}
|
||||
FunctionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Function `json:"items"`
|
||||
}
|
||||
|
||||
// Environments.
|
||||
Environment struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.EnvironmentSpec `json:"spec"`
|
||||
}
|
||||
EnvironmentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []Environment `json:"items"`
|
||||
}
|
||||
|
||||
HTTPTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.HTTPTriggerSpec `json:"spec"`
|
||||
}
|
||||
HTTPTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []HTTPTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Kubernetes Watches as triggers
|
||||
KubernetesWatchTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.KubernetesWatchTriggerSpec `json:"spec"`
|
||||
}
|
||||
KubernetesWatchTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []KubernetesWatchTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Time triggers
|
||||
TimeTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.TimeTriggerSpec `json:"spec"`
|
||||
}
|
||||
TimeTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []TimeTrigger `json:"items"`
|
||||
}
|
||||
|
||||
// Message Queue triggers
|
||||
MessageQueueTrigger struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ObjectMeta `json:"metadata"`
|
||||
Spec fission.MessageQueueTriggerSpec `json:"spec"`
|
||||
}
|
||||
MessageQueueTriggerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
Metadata metav1.ListMeta `json:"metadata"`
|
||||
|
||||
Items []MessageQueueTrigger `json:"items"`
|
||||
}
|
||||
Package = fv1.Package
|
||||
PackageList = fv1.PackageList
|
||||
Function = fv1.Function
|
||||
FunctionList = fv1.FunctionList
|
||||
Environment = fv1.Environment
|
||||
EnvironmentList = fv1.EnvironmentList
|
||||
HTTPTrigger = fv1.HTTPTrigger
|
||||
HTTPTriggerList = fv1.HTTPTriggerList
|
||||
KubernetesWatchTrigger = fv1.KubernetesWatchTrigger
|
||||
KubernetesWatchTriggerList = fv1.KubernetesWatchTriggerList
|
||||
TimeTrigger = fv1.TimeTrigger
|
||||
TimeTriggerList = fv1.TimeTriggerList
|
||||
MessageQueueTrigger = fv1.MessageQueueTrigger
|
||||
MessageQueueTriggerList = fv1.MessageQueueTriggerList
|
||||
)
|
||||
|
||||
// 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.List {
|
||||
return &fl.Metadata
|
||||
}
|
||||
func (el *EnvironmentList) GetListMeta() metav1.List {
|
||||
return &el.Metadata
|
||||
}
|
||||
func (hl *HTTPTriggerList) GetListMeta() metav1.List {
|
||||
return &hl.Metadata
|
||||
}
|
||||
func (wl *KubernetesWatchTriggerList) GetListMeta() metav1.List {
|
||||
return &wl.Metadata
|
||||
}
|
||||
func (wl *TimeTriggerList) GetListMeta() metav1.List {
|
||||
return &wl.Metadata
|
||||
}
|
||||
func (ml *MessageQueueTriggerList) GetListMeta() metav1.List {
|
||||
return &ml.Metadata
|
||||
}
|
||||
func (pl *PackageList) GetListMeta() metav1.List {
|
||||
return &pl.Metadata
|
||||
}
|
||||
|
||||
func validateMetadata(field string, m metav1.ObjectMeta) error {
|
||||
return fission.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()
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
@@ -146,7 +146,7 @@ func idleObjectReaper(kubeClient *kubernetes.Clientset,
|
||||
}
|
||||
}
|
||||
|
||||
func deleteKubeobject(kubeClient *kubernetes.Clientset, kubeobj *api.ObjectReference) {
|
||||
func deleteKubeobject(kubeClient *kubernetes.Clientset, kubeobj *apiv1.ObjectReference) {
|
||||
switch strings.ToLower(kubeobj.Kind) {
|
||||
case "pod":
|
||||
err := kubeClient.CoreV1().Pods(kubeobj.Namespace).Delete(kubeobj.Name, nil)
|
||||
|
||||
@@ -32,11 +32,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
|
||||
@@ -20,9 +20,9 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/cache"
|
||||
@@ -45,11 +45,11 @@ const (
|
||||
|
||||
type (
|
||||
FuncSvc struct {
|
||||
Name string // Name of object
|
||||
Function *metav1.ObjectMeta // function this pod/service is for
|
||||
Environment *crd.Environment // function's environment
|
||||
Address string // Host:Port or IP:Port that the function's service can be reached at.
|
||||
KubernetesObjects []api.ObjectReference // Kubernetes Objects (within the function namespace)
|
||||
Name string // Name of object
|
||||
Function *metav1.ObjectMeta // function this pod/service is for
|
||||
Environment *crd.Environment // function's environment
|
||||
Address string // Host:Port or IP:Port that the function's service can be reached at.
|
||||
KubernetesObjects []apiv1.ObjectReference // Kubernetes Objects (within the function namespace)
|
||||
Executor executorType
|
||||
|
||||
Ctime time.Time
|
||||
@@ -66,7 +66,7 @@ type (
|
||||
fscRequest struct {
|
||||
requestType fscRequestType
|
||||
address string
|
||||
kubernetesObjects []api.ObjectReference
|
||||
kubernetesObjects []apiv1.ObjectReference
|
||||
age time.Duration
|
||||
responseChannel chan *fscResponse
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
@@ -21,7 +21,7 @@ func TestFunctionServiceCache(t *testing.T) {
|
||||
var fsvc *FuncSvc
|
||||
now := time.Now()
|
||||
|
||||
objects := []api.ObjectReference{
|
||||
objects := []apiv1.ObjectReference{
|
||||
{
|
||||
Kind: "pod",
|
||||
Name: "xxx",
|
||||
|
||||
@@ -25,14 +25,13 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
asv1 "k8s.io/api/autoscaling/v1"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
"k8s.io/api/extensions/v1beta1"
|
||||
k8s_err "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
asv1 "k8s.io/client-go/pkg/apis/autoscaling/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
@@ -342,33 +341,33 @@ func (deploy *NewDeploy) getDeploymentSpec(fn *crd.Function, env *crd.Environmen
|
||||
|
||||
// getResources overrides only the resources which are overridden at function level otherwise
|
||||
// default to resources specified at environment level
|
||||
func (deploy *NewDeploy) getResources(env *crd.Environment, fn *crd.Function) v1.ResourceRequirements {
|
||||
func (deploy *NewDeploy) getResources(env *crd.Environment, fn *crd.Function) apiv1.ResourceRequirements {
|
||||
resources := env.Spec.Resources
|
||||
if resources.Requests == nil {
|
||||
resources.Requests = make(map[v1.ResourceName]resource.Quantity)
|
||||
resources.Requests = make(map[apiv1.ResourceName]resource.Quantity)
|
||||
}
|
||||
if resources.Limits == nil {
|
||||
resources.Limits = make(map[v1.ResourceName]resource.Quantity)
|
||||
resources.Limits = make(map[apiv1.ResourceName]resource.Quantity)
|
||||
}
|
||||
// Only override the once specified at function, rest default to values from env.
|
||||
_, ok := fn.Spec.Resources.Requests[v1.ResourceCPU]
|
||||
_, ok := fn.Spec.Resources.Requests[apiv1.ResourceCPU]
|
||||
if ok {
|
||||
resources.Requests[v1.ResourceCPU] = fn.Spec.Resources.Requests[v1.ResourceCPU]
|
||||
resources.Requests[apiv1.ResourceCPU] = fn.Spec.Resources.Requests[apiv1.ResourceCPU]
|
||||
}
|
||||
|
||||
_, ok = fn.Spec.Resources.Requests[v1.ResourceMemory]
|
||||
_, ok = fn.Spec.Resources.Requests[apiv1.ResourceMemory]
|
||||
if ok {
|
||||
resources.Requests[v1.ResourceMemory] = fn.Spec.Resources.Requests[v1.ResourceMemory]
|
||||
resources.Requests[apiv1.ResourceMemory] = fn.Spec.Resources.Requests[apiv1.ResourceMemory]
|
||||
}
|
||||
|
||||
_, ok = fn.Spec.Resources.Limits[v1.ResourceCPU]
|
||||
_, ok = fn.Spec.Resources.Limits[apiv1.ResourceCPU]
|
||||
if ok {
|
||||
resources.Limits[v1.ResourceCPU] = fn.Spec.Resources.Limits[v1.ResourceCPU]
|
||||
resources.Limits[apiv1.ResourceCPU] = fn.Spec.Resources.Limits[apiv1.ResourceCPU]
|
||||
}
|
||||
|
||||
_, ok = fn.Spec.Resources.Limits[v1.ResourceMemory]
|
||||
_, ok = fn.Spec.Resources.Limits[apiv1.ResourceMemory]
|
||||
if ok {
|
||||
resources.Limits[v1.ResourceMemory] = fn.Spec.Resources.Limits[v1.ResourceMemory]
|
||||
resources.Limits[apiv1.ResourceMemory] = fn.Spec.Resources.Limits[apiv1.ResourceMemory]
|
||||
}
|
||||
|
||||
return resources
|
||||
|
||||
@@ -26,11 +26,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/rest"
|
||||
k8sCache "k8s.io/client-go/tools/cache"
|
||||
|
||||
@@ -317,7 +316,7 @@ func (deploy *NewDeploy) fnCreate(fn *crd.Function) (*fscache.FuncSvc, error) {
|
||||
return fsvc, errors.Wrap(err, fmt.Sprintf("error creating the HPA %v:", objName))
|
||||
}
|
||||
|
||||
kubeObjRefs := []api.ObjectReference{
|
||||
kubeObjRefs := []apiv1.ObjectReference{
|
||||
{
|
||||
//obj.TypeMeta.Kind does not work hence this, needs investigationa and a fix
|
||||
Kind: "deployment",
|
||||
|
||||
@@ -20,12 +20,12 @@ import (
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
k8sCache "k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/fission/fission"
|
||||
|
||||
@@ -32,13 +32,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
"k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
@@ -781,7 +781,7 @@ func (gp *GenericPool) GetFuncSvc(m *metav1.ObjectMeta) (*fscache.FuncSvc, error
|
||||
svcHost = fmt.Sprintf("%v:8888", pod.Status.PodIP)
|
||||
}
|
||||
|
||||
kubeObjRefs := []api.ObjectReference{
|
||||
kubeObjRefs := []apiv1.ObjectReference{
|
||||
{
|
||||
Kind: "pod",
|
||||
Name: pod.ObjectMeta.Name,
|
||||
|
||||
@@ -24,9 +24,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
k8sCache "k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/fission/fission"
|
||||
@@ -229,7 +229,7 @@ func (gpm *GenericPoolManager) getEnvPoolsize(env *crd.Environment) int32 {
|
||||
|
||||
// IsValidPod checks if pod is not deleted and that it has the address passed as the argument. Also checks that all the
|
||||
// containers in it are reporting a ready status for the healthCheck.
|
||||
func (gpm *GenericPoolManager) IsValidPod(kubeObjects []api.ObjectReference, podAddress string) bool {
|
||||
func (gpm *GenericPoolManager) IsValidPod(kubeObjects []apiv1.ObjectReference, podAddress string) bool {
|
||||
for _, obj := range kubeObjects {
|
||||
if obj.Kind == "pod" {
|
||||
pod, err := gpm.kubernetesClient.CoreV1().Pods(obj.Namespace).Get(obj.Name, metav1.GetOptions{})
|
||||
|
||||
@@ -17,8 +17,8 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
)
|
||||
|
||||
var resources map[string]resource.Quantity
|
||||
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/controller/client"
|
||||
|
||||
+1
-1
@@ -30,9 +30,9 @@ import (
|
||||
|
||||
"github.com/satori/go.uuid"
|
||||
"github.com/urfave/cli"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
|
||||
@@ -259,13 +259,6 @@ func main() {
|
||||
{Name: "restore", Usage: "Restore state dumped from a v0.1 install into a v0.2+ install", Flags: []cli.Flag{upgradeFileFlag}, Action: upgradeRestoreState},
|
||||
}
|
||||
|
||||
migrateFileFlag := cli.StringFlag{Name: "file", Usage: "JSON file containing all CRDs"}
|
||||
migrateSubCommands := []cli.Command{
|
||||
{Name: "dump", Usage: "Dump all state from a pre-0.4 Fission installation (which used ThirdPartyResources) into a JSON file", Flags: []cli.Flag{migrateFileFlag}, Action: migrateDumpTPR},
|
||||
{Name: "delete", Usage: "Delete all TPRs", Flags: []cli.Flag{}, Action: migrateDeleteTPR},
|
||||
{Name: "restore", Usage: "Restore state dumped from a pre-0.4 Fission cluster. Requires Fission 0.4, which uses Kubernetes CustomResources.", Flags: []cli.Flag{migrateFileFlag}, Action: migrateRestoreCRD},
|
||||
}
|
||||
|
||||
// specs
|
||||
specDirFlag := cli.StringFlag{Name: "specdir", Usage: "Directory to store specs, defaults to ./specs"}
|
||||
specNameFlag := cli.StringFlag{Name: "name", Usage: "(optional) Name for the app, applied to resources as a Kubernetes annotation"}
|
||||
@@ -290,7 +283,6 @@ func main() {
|
||||
{Name: "package", Aliases: []string{"pkg"}, Usage: "Manage packages", Subcommands: pkgSubCommands},
|
||||
{Name: "spec", Aliases: []string{"specs"}, Usage: "Manage a declarative app specification", Subcommands: specSubCommands},
|
||||
{Name: "upgrade", Aliases: []string{}, Usage: "Upgrade tool from fission v0.1", Subcommands: upgradeSubCommands},
|
||||
{Name: "tpr2crd", Aliases: []string{}, Usage: "Migrate tool for TPR to CRD", Subcommands: migrateSubCommands},
|
||||
}
|
||||
|
||||
app.Before = cliHook
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 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 main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/controller/client"
|
||||
"github.com/fission/fission/crd"
|
||||
)
|
||||
|
||||
type (
|
||||
TPRResource struct {
|
||||
Packages []crd.Package `json:"packages"`
|
||||
Functions []crd.Function `json:"functions"`
|
||||
Environments []crd.Environment `json:"environments"`
|
||||
HTTPTriggers []crd.HTTPTrigger `json:"httptriggers"`
|
||||
Mqtriggers []crd.MessageQueueTrigger `json:"mqtriggers"`
|
||||
TimeTriggers []crd.TimeTrigger `json:"timetriggers"`
|
||||
Watches []crd.KubernetesWatchTrigger `json:"watches"`
|
||||
}
|
||||
)
|
||||
|
||||
func migrateDumpTPRResource(client *client.Client, filename string) {
|
||||
pkgs, err := client.PackageList(metav1.NamespaceAll)
|
||||
checkErr(err, "dump packages")
|
||||
fns, err := client.FunctionList(metav1.NamespaceAll)
|
||||
checkErr(err, "dump functions")
|
||||
httpTriggers, err := client.HTTPTriggerList(metav1.NamespaceAll)
|
||||
checkErr(err, "dump http triggers")
|
||||
envs, err := client.EnvironmentList(metav1.NamespaceAll)
|
||||
checkErr(err, "dump environments")
|
||||
watches, err := client.WatchList(metav1.NamespaceAll)
|
||||
checkErr(err, "dump watches")
|
||||
timeTriggers, err := client.TimeTriggerList(metav1.NamespaceAll)
|
||||
checkErr(err, "dump time triggers")
|
||||
mqTriggers, err := client.MessageQueueTriggerList(fission.MessageQueueTypeNats, metav1.NamespaceAll)
|
||||
checkErr(err, "dump message queue triggers")
|
||||
|
||||
tprResource := TPRResource{
|
||||
Packages: pkgs,
|
||||
Functions: fns,
|
||||
HTTPTriggers: httpTriggers,
|
||||
Environments: envs,
|
||||
Watches: watches,
|
||||
TimeTriggers: timeTriggers,
|
||||
Mqtriggers: mqTriggers,
|
||||
}
|
||||
|
||||
// serialize tprResource
|
||||
out, err := json.MarshalIndent(tprResource, "", " ")
|
||||
checkErr(err, "serialize tpr state")
|
||||
|
||||
// dump to file fission-tpr.json
|
||||
if len(filename) == 0 {
|
||||
filename = "fission-tpr.json"
|
||||
}
|
||||
err = ioutil.WriteFile(filename, out, 0644)
|
||||
checkErr(err, "write file")
|
||||
|
||||
fmt.Printf("Done: Saved %v packages, %v functions, %v HTTP triggers, %v watches, %v message queue triggers, %v time triggers.\n",
|
||||
len(tprResource.Packages), len(tprResource.Functions), len(tprResource.HTTPTriggers), len(tprResource.Watches), len(tprResource.Mqtriggers),
|
||||
len(tprResource.TimeTriggers))
|
||||
}
|
||||
|
||||
func migrateDumpTPR(c *cli.Context) error {
|
||||
filename := c.String("file")
|
||||
client := getClient(c.GlobalString("server"))
|
||||
migrateDumpTPRResource(client, filename)
|
||||
return nil
|
||||
}
|
||||
|
||||
func migrateDeleteTPR(c *cli.Context) error {
|
||||
server := c.GlobalString("server")
|
||||
relativeUrl := fmt.Sprintf("%v/%v", server, "v2/deleteTpr")
|
||||
req, err := http.NewRequest("DELETE", relativeUrl, nil)
|
||||
checkErr(err, "connect to fission server")
|
||||
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
checkErr(err, "delete tpr resources")
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
msg := fmt.Sprintf("Server %v isn't support deleteTpr method. Use --server to point at a 0.4.0+ Fission server.", server)
|
||||
fatal(msg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkAlreadyExistsError helps to check whether the error is AlreadyExists error or not.
|
||||
func checkAlreadyExistsError(err error, msg string) {
|
||||
fe, ok := err.(fission.Error)
|
||||
// ignore AlreadyExists error, since a resource may exist.
|
||||
if !ok || fe.Code != fission.ErrorNameExists {
|
||||
checkErr(err, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func migrateRestoreCRD(c *cli.Context) error {
|
||||
filename := c.String("file")
|
||||
if len(filename) == 0 {
|
||||
filename = "fission-tpr.json"
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadFile(filename)
|
||||
checkErr(err, fmt.Sprintf("open file %v", filename))
|
||||
|
||||
var tprResource TPRResource
|
||||
err = json.Unmarshal(contents, &tprResource)
|
||||
checkErr(err, "parse dumped tpr")
|
||||
|
||||
client := getClient(c.GlobalString("server"))
|
||||
|
||||
// Though Kubernetes will migrate TPRs to CRDs automatically when TPR definition is
|
||||
// deleted if the same name CRD exists. We still need to make sure that there is no
|
||||
// resource gets lost during the migration. Also, since we changed the capitalization
|
||||
// of some CRDs to CamelCase (e.g. Httptrigger -> HTTPTrigger), we need to recreate
|
||||
// those resources by ourselves.
|
||||
|
||||
// create envs
|
||||
for _, e := range tprResource.Environments {
|
||||
e.Metadata.ResourceVersion = ""
|
||||
_, err = client.EnvironmentCreate(&crd.Environment{
|
||||
Metadata: e.Metadata,
|
||||
Spec: e.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create environment %v", e.Metadata.Name))
|
||||
}
|
||||
|
||||
// create httptriggers
|
||||
for _, t := range tprResource.HTTPTriggers {
|
||||
t.Metadata.ResourceVersion = ""
|
||||
_, err = client.HTTPTriggerCreate(&crd.HTTPTrigger{
|
||||
Metadata: t.Metadata,
|
||||
Spec: t.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create http trigger %v", t.Metadata.Name))
|
||||
}
|
||||
|
||||
// create mqtriggers
|
||||
for _, t := range tprResource.Mqtriggers {
|
||||
t.Metadata.ResourceVersion = ""
|
||||
_, err = client.MessageQueueTriggerCreate(&crd.MessageQueueTrigger{
|
||||
Metadata: t.Metadata,
|
||||
Spec: t.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create http trigger %v", t.Metadata.Name))
|
||||
}
|
||||
|
||||
// create time triggers
|
||||
for _, t := range tprResource.TimeTriggers {
|
||||
t.Metadata.ResourceVersion = ""
|
||||
_, err = client.TimeTriggerCreate(&crd.TimeTrigger{
|
||||
Metadata: t.Metadata,
|
||||
Spec: t.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create time trigger %v", t.Metadata.Name))
|
||||
}
|
||||
|
||||
// create watches
|
||||
for _, t := range tprResource.Watches {
|
||||
t.Metadata.ResourceVersion = ""
|
||||
_, err = client.WatchCreate(&crd.KubernetesWatchTrigger{
|
||||
Metadata: t.Metadata,
|
||||
Spec: t.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create kubernetes watch trigger %v", t.Metadata.Name))
|
||||
}
|
||||
|
||||
// create packages
|
||||
for _, p := range tprResource.Packages {
|
||||
p.Metadata.ResourceVersion = ""
|
||||
_, err = client.PackageCreate(&crd.Package{
|
||||
Metadata: p.Metadata,
|
||||
Spec: p.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create function %v", p.Metadata.Name))
|
||||
}
|
||||
|
||||
// create functions
|
||||
for _, f := range tprResource.Functions {
|
||||
f.Metadata.ResourceVersion = ""
|
||||
_, err = client.FunctionCreate(&crd.Function{
|
||||
Metadata: f.Metadata,
|
||||
Spec: f.Spec,
|
||||
})
|
||||
checkAlreadyExistsError(err, fmt.Sprintf("create function %v", f.Metadata.Name))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/crd"
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
)
|
||||
|
||||
func mqtCreate(c *cli.Context) error {
|
||||
@@ -202,7 +203,7 @@ func mqtList(c *cli.Context) error {
|
||||
|
||||
func checkMQTopicAvailability(mqType fission.MessageQueueType, topics ...string) {
|
||||
for _, t := range topics {
|
||||
if len(t) > 0 && !fission.IsTopicValid(mqType, t) {
|
||||
if len(t) > 0 && !fv1.IsTopicValid(mqType, t) {
|
||||
fatal(fmt.Sprintf("Invalid topic for %s: %s", mqType, t))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/client-go/tools/portforward"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
"k8s.io/client-go/transport/spdy"
|
||||
)
|
||||
|
||||
func findFreePort() (string, error) {
|
||||
@@ -101,7 +102,7 @@ func runPortForward(kubeConfig string, labelSelector string, localPort string, f
|
||||
readyChannel := make(chan struct{})
|
||||
|
||||
// create request URL
|
||||
req := clientset.CoreV1Client.RESTClient().Post().Resource("pods").
|
||||
req := clientset.CoreV1().RESTClient().Post().Resource("pods").
|
||||
Namespace(podNameSpace).Name(podName).SubResource("portforward")
|
||||
url := req.URL()
|
||||
|
||||
@@ -110,11 +111,12 @@ func runPortForward(kubeConfig string, labelSelector string, localPort string, f
|
||||
ports := []string{portCombo}
|
||||
|
||||
// actually start the port-forwarding process here
|
||||
dialer, err := remotecommand.NewExecutor(config, "POST", url)
|
||||
transport, upgrader, err := spdy.RoundTripperFor(config)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("newexecutor errored out :%v", err.Error())
|
||||
msg := fmt.Sprintf("Failed to connect to Fission service on Kubernetes: %v", err.Error())
|
||||
fatal(msg)
|
||||
}
|
||||
dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, "POST", url)
|
||||
|
||||
outStream := os.Stdout
|
||||
if verbosity < 2 {
|
||||
|
||||
Generated
+130
-126
@@ -1,14 +1,8 @@
|
||||
hash: d77d204547318863d07beea96b4e29a90f0d6c106a957dd0ba40eb0345a77e42
|
||||
updated: 2018-03-23T17:49:04.748453691-07:00
|
||||
hash: 1f595f5cdf8dc629d9046f82869cb77811dac21ce5f58e4f81e89d21181f6c34
|
||||
updated: 2018-05-24T22:39:34.860206+08:00
|
||||
imports:
|
||||
- name: cloud.google.com/go
|
||||
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
||||
- name: github.com/beorn7/perks
|
||||
version: 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
|
||||
subpackages:
|
||||
- quantile
|
||||
- name: github.com/blang/semver
|
||||
version: 60ec3488bfea7cca02b021d106d9911120d25fe9
|
||||
subpackages:
|
||||
- compute/metadata
|
||||
- internal
|
||||
@@ -23,6 +17,10 @@ imports:
|
||||
- autorest/adal
|
||||
- autorest/azure
|
||||
- autorest/date
|
||||
- name: github.com/beorn7/perks
|
||||
version: 3ac7bf7a47d159a033b107610db8a1b6575507a4
|
||||
subpackages:
|
||||
- quantile
|
||||
- name: github.com/coreos/etcd
|
||||
version: 6a265731e10a5137b991c1aa3a83ecefdd149d50
|
||||
subpackages:
|
||||
@@ -35,11 +33,6 @@ imports:
|
||||
version: 8902c56451e9b58ff940bbe5fec35d5f9c04584a
|
||||
- name: github.com/dgrijalva/jwt-go
|
||||
version: 01aeca54ebda6e0fbfafd0a524d234159c05ec20
|
||||
- name: github.com/docker/distribution
|
||||
version: db713e127ba35bd15595113df56ee964de24637a
|
||||
subpackages:
|
||||
- digest
|
||||
- reference
|
||||
- name: github.com/docker/spdystream
|
||||
version: 449fdfce4d962303d702fec724ef0ad181c92528
|
||||
subpackages:
|
||||
@@ -54,28 +47,10 @@ imports:
|
||||
- internal
|
||||
- internal/errors
|
||||
- internal/prefix
|
||||
- name: github.com/emicklei/go-restful
|
||||
version: ff4f55a206334ef123e4f79bbf348980da81ca46
|
||||
subpackages:
|
||||
- log
|
||||
- name: github.com/emicklei/go-restful-swagger12
|
||||
version: dcef7f55730566d41eae5db10e7d6981829720f6
|
||||
- name: github.com/fsnotify/fsnotify
|
||||
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
|
||||
- name: github.com/ghodss/yaml
|
||||
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
||||
- name: github.com/go-openapi/analysis
|
||||
version: b44dc874b601d9e4e2f6e19140e794ba24bead3b
|
||||
- name: github.com/go-openapi/jsonpointer
|
||||
version: 46af16f9f7b149af66e5d1bd010e3574dc06de98
|
||||
- name: github.com/go-openapi/jsonreference
|
||||
version: 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272
|
||||
- name: github.com/go-openapi/loads
|
||||
version: 18441dfa706d924a39a030ee2c3b1d8d81917b38
|
||||
- name: github.com/go-openapi/spec
|
||||
version: 6aced65f8501fe1217321abf0749d354824ba2ff
|
||||
- name: github.com/go-openapi/swag
|
||||
version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72
|
||||
- name: github.com/gogo/protobuf
|
||||
version: c0656edd0d9eab7c66d1eb0c568f9039345796f7
|
||||
subpackages:
|
||||
@@ -83,22 +58,46 @@ imports:
|
||||
- proto
|
||||
- protoc-gen-gogo/descriptor
|
||||
- sortkeys
|
||||
- name: github.com/golang/freetype
|
||||
version: e2365dfdc4a05e4b8299a783240d4a7d5a65d4e4
|
||||
subpackages:
|
||||
- raster
|
||||
- truetype
|
||||
- name: github.com/golang/glog
|
||||
version: 44145f04b68cf362d9c4df2182967c2275eaefed
|
||||
- name: github.com/golang/protobuf
|
||||
version: 4bd1920723d7b7c925de087aa32e2187708897f7
|
||||
version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9
|
||||
subpackages:
|
||||
- proto
|
||||
- ptypes
|
||||
- ptypes/any
|
||||
- ptypes/duration
|
||||
- ptypes/timestamp
|
||||
- name: github.com/golang/snappy
|
||||
version: 553a641470496b2327abcac10b36396bd98e45c9
|
||||
- name: github.com/google/gofuzz
|
||||
version: 44d81051d367757e1c7c6a5a86423ece9afcf63c
|
||||
- name: github.com/googleapis/gnostic
|
||||
version: 0c5108395e2debce0d731cf0287ddf7242066aba
|
||||
subpackages:
|
||||
- OpenAPIv2
|
||||
- compiler
|
||||
- extensions
|
||||
- name: github.com/gophercloud/gophercloud
|
||||
version: 6da026c32e2d622cc242d32984259c77237aefe1
|
||||
subpackages:
|
||||
- openstack
|
||||
- openstack/identity/v2/tenants
|
||||
- openstack/identity/v2/tokens
|
||||
- openstack/identity/v3/tokens
|
||||
- openstack/utils
|
||||
- pagination
|
||||
- name: github.com/gorilla/context
|
||||
version: 08b5f424b9271eedf6f9f0ce86cb9396ed337a42
|
||||
- name: github.com/gorilla/handlers
|
||||
version: 90663712d74cb411cbef281bc1e08c19d1a76145
|
||||
- name: github.com/gorilla/mux
|
||||
version: 53c1911da2b537f792e7cafcb446b05ffe33b996
|
||||
version: e3702bed27f0d39777b0b37b664b6280e8ef8fbf
|
||||
- name: github.com/graymeta/stow
|
||||
version: abb68c488872b06c5453865fa59f4818b4ea13a4
|
||||
subpackages:
|
||||
@@ -114,27 +113,25 @@ imports:
|
||||
- name: github.com/howeyc/gopass
|
||||
version: bf9dde6d0d2c004a008c27aaee91170c786f6db8
|
||||
- name: github.com/imdario/mergo
|
||||
version: 163f41321a19dd09362d4c63cc2489db2015f1f4
|
||||
version: 9d5f1277e9a8ed20c3684bda8fde67c05628518c
|
||||
- name: github.com/influxdata/influxdb
|
||||
version: b7bb7e8359642b6e071735b50ae41f5eb343fd42
|
||||
subpackages:
|
||||
- client/v2
|
||||
- models
|
||||
- pkg/escape
|
||||
- name: github.com/juju/ratelimit
|
||||
version: 5b9ff866471762aa2ab2dced63c9fb6f53921342
|
||||
- name: github.com/mailru/easyjson
|
||||
version: d5b7844b561a7bc640052f1b935f7b800330d7e0
|
||||
subpackages:
|
||||
- buffer
|
||||
- jlexer
|
||||
- jwriter
|
||||
- name: github.com/json-iterator/go
|
||||
version: 13f86432b882000a51c6e610c620974462691a97
|
||||
- name: github.com/marstr/guid
|
||||
version: 8bdf7d1a087ccc975cf37dd6507da50698fd19ca
|
||||
- name: github.com/matttproud/golang_protobuf_extensions
|
||||
version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a
|
||||
subpackages:
|
||||
- pbutil
|
||||
- name: github.com/mholt/archiver
|
||||
version: 26cf5bb32d07aa4e8d0de15f56ce516f4641d7df
|
||||
- name: github.com/nats-io/go-nats
|
||||
version: 78ec4b93936d7a00e59b7f3939d8116955916d1b
|
||||
version: 2485387d6ede89c1c8c3445cd1935fd41a2e9ee9
|
||||
subpackages:
|
||||
- encoders/builtin
|
||||
- util
|
||||
@@ -143,7 +140,7 @@ imports:
|
||||
subpackages:
|
||||
- pb
|
||||
- name: github.com/nats-io/nats-streaming-server
|
||||
version: 7889f37a10062ff8eb9ac11855ed51cddeaf4469
|
||||
version: 6026da1b7c444bf9f1d1b1d3ed14e435aabf02bc
|
||||
subpackages:
|
||||
- spb
|
||||
- util
|
||||
@@ -159,19 +156,13 @@ imports:
|
||||
- xxHash32
|
||||
- name: github.com/pkg/errors
|
||||
version: f15c970de5b76fac0b59abb32d62c17cc7bed265
|
||||
- name: github.com/matttproud/golang_protobuf_extensions
|
||||
version: c12348ce28de40eed0136aa2b644d0ee0650e56c
|
||||
subpackages:
|
||||
- pbutil
|
||||
- name: github.com/pborman/uuid
|
||||
version: 3d4f2ba23642d3cfd06bd4b54cf03d99d95c0f1b
|
||||
- name: github.com/prometheus/client_golang
|
||||
version: c5b7fccd204277076155f10851dad72b76a49317
|
||||
subpackages:
|
||||
- prometheus
|
||||
- prometheus/promhttp
|
||||
- name: github.com/prometheus/client_model
|
||||
version: 6f3806018612930941127f2a7c6c453ba2c527d2
|
||||
version: fa8ad6fec33561be4280a8f0514318c79d7f6cb6
|
||||
subpackages:
|
||||
- go
|
||||
- name: github.com/prometheus/common
|
||||
@@ -184,10 +175,6 @@ imports:
|
||||
version: 65c1f6f8f0fc1e2185eb9863a3bc751496404259
|
||||
subpackages:
|
||||
- xfs
|
||||
- name: github.com/PuerkitoBio/purell
|
||||
version: 8a290539e2e8629dbc4e6bad948158f790ec31f4
|
||||
- name: github.com/PuerkitoBio/urlesc
|
||||
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
||||
- name: github.com/robfig/cron
|
||||
version: 2315d5715e36303a941d907f038da7f7c44c773b
|
||||
- name: github.com/satori/go.uuid
|
||||
@@ -195,17 +182,13 @@ imports:
|
||||
- name: github.com/sirupsen/logrus
|
||||
version: 68cec9f21fbf3ea8d8f98c044bc6ce05f17b267a
|
||||
- name: github.com/spf13/pflag
|
||||
version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7
|
||||
version: 4c012f6dcd9546820e378d0bdda4d8fc772cdfea
|
||||
- name: github.com/stretchr/testify
|
||||
version: 12b6f73e6084dad08a7c6e575284b177ecafbc71
|
||||
subpackages:
|
||||
- assert
|
||||
- mock
|
||||
- require
|
||||
- name: github.com/ugorji/go
|
||||
version: ded73eae5db7e7a0ef6f55aace87a2873c5d2b74
|
||||
subpackages:
|
||||
- codec
|
||||
- name: github.com/ulikunitz/xz
|
||||
version: 0c6b41e72360850ca4f98dc341fd999726ea007f
|
||||
subpackages:
|
||||
@@ -214,12 +197,27 @@ imports:
|
||||
- lzma
|
||||
- name: github.com/urfave/cli
|
||||
version: cfb38830724cc34fedffe9a2a29fb54fa9169cd1
|
||||
- name: github.com/wcharczuk/go-chart
|
||||
version: 9e3a080aa3e7573281cf8d65a55305e1148d857d
|
||||
subpackages:
|
||||
- drawing
|
||||
- matrix
|
||||
- roboto
|
||||
- seq
|
||||
- util
|
||||
- name: golang.org/x/crypto
|
||||
version: d172538b2cfce0c13cee31e647d0367aa8cd2486
|
||||
version: 81e90905daefcd6fd217b62423c0908922eadb30
|
||||
subpackages:
|
||||
- ssh/terminal
|
||||
- name: golang.org/x/image
|
||||
version: f315e440302883054d0c2bd85486878cb4f8572c
|
||||
subpackages:
|
||||
- draw
|
||||
- font
|
||||
- math/f64
|
||||
- math/fixed
|
||||
- name: golang.org/x/net
|
||||
version: f2499483f923065a842d38eb4c7f1927e6fc6e6d
|
||||
version: 1c05540f6879653db88113bc4a2b70aec4bd491f
|
||||
subpackages:
|
||||
- context
|
||||
- context/ctxhttp
|
||||
@@ -235,22 +233,25 @@ imports:
|
||||
- jws
|
||||
- jwt
|
||||
- name: golang.org/x/sys
|
||||
version: 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9
|
||||
version: 95c6576299259db960f6c5b9b69ea52422860fce
|
||||
subpackages:
|
||||
- unix
|
||||
- windows
|
||||
- name: golang.org/x/text
|
||||
version: 2910a502d2bf9e43193af9d68ca516529614eed3
|
||||
version: b19bf474d317b857955b12035d2c5acb57ce8b01
|
||||
subpackages:
|
||||
- cases
|
||||
- internal/tag
|
||||
- language
|
||||
- runes
|
||||
- secure/bidirule
|
||||
- secure/precis
|
||||
- transform
|
||||
- unicode/bidi
|
||||
- unicode/norm
|
||||
- width
|
||||
- name: golang.org/x/time
|
||||
version: f51c12702a4d776e4c1fa9b0fabab841babae631
|
||||
subpackages:
|
||||
- rate
|
||||
- name: golang.org/x/tools
|
||||
version: 1937f90a1bb43667aff4059b1bab13eb15121e8e
|
||||
subpackages:
|
||||
- imports
|
||||
- name: google.golang.org/appengine
|
||||
version: 9d8544a6b2c7df9cff240fcf92d7b2f59bc13416
|
||||
repo: https://github.com/golang/appengine
|
||||
@@ -268,11 +269,40 @@ imports:
|
||||
- name: gopkg.in/inf.v0
|
||||
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
||||
- name: gopkg.in/yaml.v2
|
||||
version: 53feefa2559fb8dfa8d81baad31be332c97d6c77
|
||||
version: 670d4cfef0544295bc27a114dbac37980d83185a
|
||||
- name: k8s.io/api
|
||||
version: 4b8fc5be9b77d91bbb6525d18591c43699a2b4e5
|
||||
version: 590a9173e3b65d74e907fcfd94b78465cf314760
|
||||
subpackages:
|
||||
- admissionregistration/v1alpha1
|
||||
- admissionregistration/v1beta1
|
||||
- apps/v1
|
||||
- apps/v1beta1
|
||||
- apps/v1beta2
|
||||
- authentication/v1
|
||||
- authentication/v1beta1
|
||||
- authorization/v1
|
||||
- authorization/v1beta1
|
||||
- autoscaling/v1
|
||||
- autoscaling/v2beta1
|
||||
- batch/v1
|
||||
- batch/v1beta1
|
||||
- batch/v2alpha1
|
||||
- certificates/v1beta1
|
||||
- core/v1
|
||||
- events/v1beta1
|
||||
- extensions/v1beta1
|
||||
- networking/v1
|
||||
- policy/v1beta1
|
||||
- rbac/v1
|
||||
- rbac/v1alpha1
|
||||
- rbac/v1beta1
|
||||
- scheduling/v1alpha1
|
||||
- settings/v1alpha1
|
||||
- storage/v1
|
||||
- storage/v1alpha1
|
||||
- storage/v1beta1
|
||||
- name: k8s.io/apiextensions-apiserver
|
||||
version: 19d3c0f1ccfb3e4180400ff7c22fe3c879771807
|
||||
version: 7fbced0db3c3378efac13578ef9d75512c582b03
|
||||
subpackages:
|
||||
- pkg/apis/apiextensions
|
||||
- pkg/apis/apiextensions/v1beta1
|
||||
@@ -280,24 +310,19 @@ imports:
|
||||
- pkg/client/clientset/clientset/scheme
|
||||
- pkg/client/clientset/clientset/typed/apiextensions/v1beta1
|
||||
- name: k8s.io/apimachinery
|
||||
version: 208a6980b14bbb263f29482482eabdbcfff9f7bb
|
||||
version: 31dade610c053669d8054bfd847da657251e8c1a
|
||||
subpackages:
|
||||
- pkg/api/equality
|
||||
- pkg/api/errors
|
||||
- pkg/api/meta
|
||||
- pkg/api/resource
|
||||
- pkg/apimachinery
|
||||
- pkg/apimachinery/announced
|
||||
- pkg/apimachinery/registered
|
||||
- pkg/apis/meta/internalversion
|
||||
- pkg/apis/meta/v1
|
||||
- pkg/apis/meta/v1/unstructured
|
||||
- pkg/apis/meta/v1alpha1
|
||||
- pkg/apis/meta/v1beta1
|
||||
- pkg/conversion
|
||||
- pkg/conversion/queryparams
|
||||
- pkg/conversion/unstructured
|
||||
- pkg/fields
|
||||
- pkg/labels
|
||||
- pkg/openapi
|
||||
- pkg/runtime
|
||||
- pkg/runtime/schema
|
||||
- pkg/runtime/serializer
|
||||
@@ -318,8 +343,6 @@ imports:
|
||||
- pkg/util/intstr
|
||||
- pkg/util/json
|
||||
- pkg/util/net
|
||||
- pkg/util/rand
|
||||
- pkg/util/remotecommand
|
||||
- pkg/util/runtime
|
||||
- pkg/util/sets
|
||||
- pkg/util/validation
|
||||
@@ -331,75 +354,48 @@ imports:
|
||||
- third_party/forked/golang/netutil
|
||||
- third_party/forked/golang/reflect
|
||||
- name: k8s.io/client-go
|
||||
version: d92e8497f71b7b4e0494e5bd204b48d34bd6f254
|
||||
version: 23781f4d6632d88e869066eaebb743857aa1ef9b
|
||||
subpackages:
|
||||
- discovery
|
||||
- kubernetes
|
||||
- kubernetes/scheme
|
||||
- kubernetes/typed/admissionregistration/v1alpha1
|
||||
- kubernetes/typed/admissionregistration/v1beta1
|
||||
- kubernetes/typed/apps/v1
|
||||
- kubernetes/typed/apps/v1beta1
|
||||
- kubernetes/typed/apps/v1beta2
|
||||
- kubernetes/typed/authentication/v1
|
||||
- kubernetes/typed/authentication/v1beta1
|
||||
- kubernetes/typed/authorization/v1
|
||||
- kubernetes/typed/authorization/v1beta1
|
||||
- kubernetes/typed/autoscaling/v1
|
||||
- kubernetes/typed/autoscaling/v2alpha1
|
||||
- kubernetes/typed/autoscaling/v2beta1
|
||||
- kubernetes/typed/batch/v1
|
||||
- kubernetes/typed/batch/v1beta1
|
||||
- kubernetes/typed/batch/v2alpha1
|
||||
- kubernetes/typed/certificates/v1beta1
|
||||
- kubernetes/typed/core/v1
|
||||
- kubernetes/typed/events/v1beta1
|
||||
- kubernetes/typed/extensions/v1beta1
|
||||
- kubernetes/typed/networking/v1
|
||||
- kubernetes/typed/policy/v1beta1
|
||||
- kubernetes/typed/rbac/v1
|
||||
- kubernetes/typed/rbac/v1alpha1
|
||||
- kubernetes/typed/rbac/v1beta1
|
||||
- kubernetes/typed/scheduling/v1alpha1
|
||||
- kubernetes/typed/settings/v1alpha1
|
||||
- kubernetes/typed/storage/v1
|
||||
- kubernetes/typed/storage/v1alpha1
|
||||
- kubernetes/typed/storage/v1beta1
|
||||
- pkg/api
|
||||
- pkg/api/v1
|
||||
- pkg/api/v1/ref
|
||||
- pkg/apis/admissionregistration
|
||||
- pkg/apis/admissionregistration/v1alpha1
|
||||
- pkg/apis/apps
|
||||
- pkg/apis/apps/v1beta1
|
||||
- pkg/apis/authentication
|
||||
- pkg/apis/authentication/v1
|
||||
- pkg/apis/authentication/v1beta1
|
||||
- pkg/apis/authorization
|
||||
- pkg/apis/authorization/v1
|
||||
- pkg/apis/authorization/v1beta1
|
||||
- pkg/apis/autoscaling
|
||||
- pkg/apis/autoscaling/v1
|
||||
- pkg/apis/autoscaling/v2alpha1
|
||||
- pkg/apis/batch
|
||||
- pkg/apis/batch/v1
|
||||
- pkg/apis/batch/v2alpha1
|
||||
- pkg/apis/certificates
|
||||
- pkg/apis/certificates/v1beta1
|
||||
- pkg/apis/extensions
|
||||
- pkg/apis/extensions/v1beta1
|
||||
- pkg/apis/networking
|
||||
- pkg/apis/networking/v1
|
||||
- pkg/apis/policy
|
||||
- pkg/apis/policy/v1beta1
|
||||
- pkg/apis/rbac
|
||||
- pkg/apis/rbac/v1alpha1
|
||||
- pkg/apis/rbac/v1beta1
|
||||
- pkg/apis/settings
|
||||
- pkg/apis/settings/v1alpha1
|
||||
- pkg/apis/storage
|
||||
- pkg/apis/storage/v1
|
||||
- pkg/apis/storage/v1beta1
|
||||
- pkg/labels
|
||||
- pkg/util
|
||||
- pkg/util/intstr
|
||||
- pkg/util/parsers
|
||||
- pkg/apis/clientauthentication
|
||||
- pkg/apis/clientauthentication/v1alpha1
|
||||
- pkg/version
|
||||
- plugin/pkg/client/auth
|
||||
- plugin/pkg/client/auth/azure
|
||||
- plugin/pkg/client/auth/exec
|
||||
- plugin/pkg/client/auth/gcp
|
||||
- plugin/pkg/client/auth/oidc
|
||||
- plugin/pkg/client/auth/openstack
|
||||
- rest
|
||||
- rest/watch
|
||||
- third_party/forked/golang/template
|
||||
@@ -410,15 +406,23 @@ imports:
|
||||
- tools/clientcmd/api/latest
|
||||
- tools/clientcmd/api/v1
|
||||
- tools/metrics
|
||||
- tools/pager
|
||||
- tools/portforward
|
||||
- tools/remotecommand
|
||||
- tools/reference
|
||||
- transport
|
||||
- transport/spdy
|
||||
- util/buffer
|
||||
- util/cert
|
||||
- util/exec
|
||||
- util/flowcontrol
|
||||
- util/homedir
|
||||
- util/integer
|
||||
- util/intstr
|
||||
- util/jsonpath
|
||||
- util/retry
|
||||
- name: k8s.io/code-generator
|
||||
version: d9b16e114e8c31761e26efcdee0a42cf066fbf58
|
||||
- name: k8s.io/gengo
|
||||
version: 01a732e01d00cb9a81bb0ca050d3e6d2b947927b
|
||||
testImports:
|
||||
- name: github.com/pmezard/go-difflib
|
||||
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
|
||||
|
||||
+8
-9
@@ -16,27 +16,26 @@ import:
|
||||
version: ^1.1.0
|
||||
- package: github.com/urfave/cli
|
||||
version: ^1.18.1
|
||||
- package: golang.org/x/tools/imports
|
||||
- package: golang.org/x/net
|
||||
subpackages:
|
||||
- context
|
||||
- package: k8s.io/client-go
|
||||
version: v4.0.0
|
||||
version: v7.0.0
|
||||
subpackages:
|
||||
- kubernetes
|
||||
- pkg/api
|
||||
- pkg/api/v1
|
||||
- pkg/apis/extensions/v1beta1
|
||||
- pkg/labels
|
||||
- pkg/util/intstr
|
||||
- util/intstr
|
||||
- rest
|
||||
- package: k8s.io/api
|
||||
version: 4b8fc5be9b77d91bbb6525d18591c43699a2b4e5
|
||||
version: release-1.10
|
||||
- package: k8s.io/apiextensions-apiserver
|
||||
version: release-1.7
|
||||
version: release-1.10
|
||||
subpackages:
|
||||
- pkg/apis/apiextensions/v1beta1
|
||||
- package: k8s.io/apimachinery
|
||||
version: release-1.7
|
||||
version: release-1.10
|
||||
- package: k8s.io/code-generator
|
||||
- package: k8s.io/gengo
|
||||
- package: github.com/influxdata/influxdb
|
||||
version: v1.2.0
|
||||
subpackages:
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
func TestMergeContainerSpecs(t *testing.T) {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package fission
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -38,26 +38,28 @@ var (
|
||||
validAzureQueueName = regexp.MustCompile("^[a-z0-9][a-z0-9\\-]*[a-z0-9]$")
|
||||
)
|
||||
|
||||
type ValidationErrorType int
|
||||
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.
|
||||
type ValidationError struct {
|
||||
// Type of validation error.
|
||||
// It indicates what kind of error of field in error output.
|
||||
Type ValidationErrorType
|
||||
// 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
|
||||
// Name of error field.
|
||||
// Example: FunctionReference.Name
|
||||
Field string
|
||||
|
||||
// Error field value.
|
||||
BadValue interface{}
|
||||
// Error field value.
|
||||
BadValue string
|
||||
|
||||
// Detail error message
|
||||
Detail string
|
||||
}
|
||||
// Detail error message
|
||||
Detail string
|
||||
}
|
||||
)
|
||||
|
||||
func (e ValidationError) Error() string {
|
||||
// Example error message
|
||||
@@ -104,7 +106,7 @@ func MakeValidationErr(errType ValidationErrorType, field string, val interface{
|
||||
return ValidationError{
|
||||
Type: errType,
|
||||
Field: field,
|
||||
BadValue: val,
|
||||
BadValue: fmt.Sprintf("%v", val),
|
||||
Detail: fmt.Sprintf("%v", detail),
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
+1
-1
@@ -20,11 +20,11 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"k8s.io/api/extensions/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
"github.com/fission/fission/crd"
|
||||
)
|
||||
|
||||
@@ -18,298 +18,42 @@ package fission
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/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"`
|
||||
}
|
||||
ChecksumType = fv1.ChecksumType
|
||||
Checksum = fv1.Checksum
|
||||
ArchiveType = fv1.ArchiveType
|
||||
Archive = fv1.Archive
|
||||
EnvironmentReference = fv1.EnvironmentReference
|
||||
SecretReference = fv1.SecretReference
|
||||
ConfigMapReference = fv1.ConfigMapReference
|
||||
BuildStatus = fv1.BuildStatus
|
||||
PackageSpec = fv1.PackageSpec
|
||||
PackageStatus = fv1.PackageStatus
|
||||
PackageRef = fv1.PackageRef
|
||||
FunctionPackageRef = fv1.FunctionPackageRef
|
||||
ExecutorType = fv1.ExecutorType
|
||||
StrategyType = fv1.StrategyType
|
||||
FunctionSpec = fv1.FunctionSpec
|
||||
InvokeStrategy = fv1.InvokeStrategy
|
||||
ExecutionStrategy = fv1.ExecutionStrategy
|
||||
FunctionReferenceType = fv1.FunctionReferenceType
|
||||
FunctionReference = fv1.FunctionReference
|
||||
Runtime = fv1.Runtime
|
||||
Builder = fv1.Builder
|
||||
EnvironmentSpec = fv1.EnvironmentSpec
|
||||
AllowedFunctionsPerContainer = fv1.AllowedFunctionsPerContainer
|
||||
HTTPTriggerSpec = fv1.HTTPTriggerSpec
|
||||
KubernetesWatchTriggerSpec = fv1.KubernetesWatchTriggerSpec
|
||||
MessageQueueType = fv1.MessageQueueType
|
||||
MessageQueueTriggerSpec = fv1.MessageQueueTriggerSpec
|
||||
TimeTriggerSpec = fv1.TimeTriggerSpec
|
||||
)
|
||||
|
||||
type (
|
||||
// Errors returned by the Fission API.
|
||||
Error struct {
|
||||
Code errorCode `json:"code"`
|
||||
@@ -346,60 +90,60 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
const EXECUTOR_INSTANCEID_LABEL string = "executorInstanceId"
|
||||
const POOLMGR_INSTANCEID_LABEL string = "poolmgrInstanceId"
|
||||
const EXECUTOR_INSTANCEID_LABEL = fv1.EXECUTOR_INSTANCEID_LABEL
|
||||
const POOLMGR_INSTANCEID_LABEL = fv1.POOLMGR_INSTANCEID_LABEL
|
||||
|
||||
const (
|
||||
ChecksumTypeSHA256 ChecksumType = "sha256"
|
||||
ChecksumTypeSHA256 = fv1.ChecksumTypeSHA256
|
||||
)
|
||||
|
||||
const (
|
||||
// ArchiveTypeLiteral means the package contents are specified in the Literal field of
|
||||
// resource itself.
|
||||
ArchiveTypeLiteral ArchiveType = "literal"
|
||||
ArchiveTypeLiteral = fv1.ArchiveTypeLiteral
|
||||
|
||||
// ArchiveTypeUrl means the package contents are at the specified URL.
|
||||
ArchiveTypeUrl ArchiveType = "url"
|
||||
ArchiveTypeUrl = fv1.ArchiveTypeUrl
|
||||
)
|
||||
|
||||
const (
|
||||
BuildStatusPending = "pending"
|
||||
BuildStatusRunning = "running"
|
||||
BuildStatusSucceeded = "succeeded"
|
||||
BuildStatusFailed = "failed"
|
||||
BuildStatusNone = "none"
|
||||
BuildStatusPending = fv1.BuildStatusPending
|
||||
BuildStatusRunning = fv1.BuildStatusRunning
|
||||
BuildStatusSucceeded = fv1.BuildStatusSucceeded
|
||||
BuildStatusFailed = fv1.BuildStatusFailed
|
||||
BuildStatusNone = fv1.BuildStatusNone
|
||||
)
|
||||
|
||||
const (
|
||||
AllowedFunctionsPerContainerSingle = "single"
|
||||
AllowedFunctionsPerContainerInfinite = "infinite"
|
||||
AllowedFunctionsPerContainerSingle = fv1.AllowedFunctionsPerContainerSingle
|
||||
AllowedFunctionsPerContainerInfinite = fv1.AllowedFunctionsPerContainerInfinite
|
||||
)
|
||||
|
||||
const (
|
||||
ExecutorTypePoolmgr = "poolmgr"
|
||||
ExecutorTypeNewdeploy = "newdeploy"
|
||||
ExecutorTypePoolmgr = fv1.ExecutorTypePoolmgr
|
||||
ExecutorTypeNewdeploy = fv1.ExecutorTypeNewdeploy
|
||||
)
|
||||
|
||||
const (
|
||||
StrategyTypeExecution = "execution"
|
||||
StrategyTypeExecution = fv1.StrategyTypeExecution
|
||||
)
|
||||
|
||||
const (
|
||||
SharedVolumeUserfunc = "userfunc"
|
||||
SharedVolumePackages = "packages"
|
||||
SharedVolumeSecrets = "secrets"
|
||||
SharedVolumeConfigmaps = "configmaps"
|
||||
SharedVolumeUserfunc = fv1.SharedVolumeUserfunc
|
||||
SharedVolumePackages = fv1.SharedVolumePackages
|
||||
SharedVolumeSecrets = fv1.SharedVolumeSecrets
|
||||
SharedVolumeConfigmaps = fv1.SharedVolumeConfigmaps
|
||||
)
|
||||
|
||||
const (
|
||||
MessageQueueTypeNats = "nats-streaming"
|
||||
MessageQueueTypeASQ = "azure-storage-queue"
|
||||
MessageQueueTypeNats = fv1.MessageQueueTypeNats
|
||||
MessageQueueTypeASQ = fv1.MessageQueueTypeASQ
|
||||
)
|
||||
|
||||
const (
|
||||
// FunctionReferenceFunctionName means that the function
|
||||
// reference is simply by function name.
|
||||
FunctionReferenceTypeFunctionName = "name"
|
||||
FunctionReferenceTypeFunctionName = fv1.FunctionReferenceTypeFunctionName
|
||||
|
||||
// Other function reference types we'd like to support:
|
||||
// Versioned function, latest version
|
||||
|
||||
Reference in New Issue
Block a user