Use executor type as a delimiter to prevent deploy name conflict (#1009)
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/pkg/errors"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
"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 {
|
||||
return strings.ToLower(fmt.Sprintf("newdeploy-%v-%v-%v",
|
||||
fn.Metadata.Name, fn.Metadata.Namespace, uniuri.NewLen(8)))
|
||||
// Use executor type as delimiter between function name and namespace to prevent deployment name conflict.
|
||||
// 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 {
|
||||
|
||||
@@ -462,8 +462,11 @@ func (gp *GenericPool) specializePod(pod *apiv1.Pod, metadata *metav1.ObjectMeta
|
||||
}
|
||||
|
||||
func (gp *GenericPool) getPoolName() string {
|
||||
return strings.ToLower(fmt.Sprintf("poolmgr-%v-%v-%v",
|
||||
gp.env.Metadata.Name, gp.env.Metadata.Namespace, uniuri.NewLen(8)))
|
||||
// Use executor type as delimiter between function name and namespace to prevent deployment name conflict.
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user