Use executor type as a delimiter to prevent deploy name conflict (#1009)
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dchest/uniuri"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/api/extensions/v1beta1"
|
"k8s.io/api/extensions/v1beta1"
|
||||||
@@ -548,8 +547,11 @@ func (deploy *NewDeploy) fnDelete(fn *crd.Function) (*fscache.FuncSvc, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (deploy *NewDeploy) getObjName(fn *crd.Function) string {
|
func (deploy *NewDeploy) getObjName(fn *crd.Function) string {
|
||||||
return strings.ToLower(fmt.Sprintf("newdeploy-%v-%v-%v",
|
// Use executor type as delimiter between function name and namespace to prevent deployment name conflict.
|
||||||
fn.Metadata.Name, fn.Metadata.Namespace, uniuri.NewLen(8)))
|
// For example:
|
||||||
|
// 1. fn-name: a-b fn-namespace: c => a-b-newdeploy-c
|
||||||
|
// 2. fn-name: a fn-namespace: b-c => a-newdeploy-b-c
|
||||||
|
return strings.ToLower(fmt.Sprintf("%v-newdeploy-%v", fn.Metadata.Name, fn.Metadata.Namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (deploy *NewDeploy) getDeployLabels(fn *crd.Function, env *crd.Environment) map[string]string {
|
func (deploy *NewDeploy) getDeployLabels(fn *crd.Function, env *crd.Environment) map[string]string {
|
||||||
|
|||||||
@@ -462,8 +462,11 @@ func (gp *GenericPool) specializePod(pod *apiv1.Pod, metadata *metav1.ObjectMeta
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gp *GenericPool) getPoolName() string {
|
func (gp *GenericPool) getPoolName() string {
|
||||||
return strings.ToLower(fmt.Sprintf("poolmgr-%v-%v-%v",
|
// Use executor type as delimiter between function name and namespace to prevent deployment name conflict.
|
||||||
gp.env.Metadata.Name, gp.env.Metadata.Namespace, uniuri.NewLen(8)))
|
// For example:
|
||||||
|
// 1. fn-name: a-b fn-namespace: c => a-b-poolmgr-c
|
||||||
|
// 2. fn-name: a fn-namespace: b-c => a-poolmgr-b-c
|
||||||
|
return strings.ToLower(fmt.Sprintf("%v-poolmgr-%v", gp.env.Metadata.Name, gp.env.Metadata.Namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
// A pool is a deployment of generic containers for an env. This
|
// A pool is a deployment of generic containers for an env. This
|
||||||
|
|||||||
Reference in New Issue
Block a user