Change container name for runtime container to environment name in newdeploy (#2044)

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2021-06-02 16:23:53 +05:30
committed by GitHub
parent 5f47a25711
commit e6c13057ce
3 changed files with 11 additions and 4 deletions
+7
View File
@@ -571,6 +571,13 @@ func (e *Environment) Validate() error {
validateMetadata("Environment", e.ObjectMeta),
e.Spec.Validate())
if e.Spec.Runtime.PodSpec != nil {
for _, container := range e.Spec.Runtime.PodSpec.Containers {
if container.Command == nil && container.Image == e.Spec.Runtime.Image && container.Name != e.ObjectMeta.Name {
multierror.Append(result, fmt.Errorf("container with image same as runtime image in podspec, must have name same as environment name"))
}
}
}
return result.ErrorOrNil()
}
@@ -239,7 +239,7 @@ func (deploy *NewDeploy) getDeploymentSpec(fn *fv1.Function, env *fv1.Environmen
}
container, err := util.MergeContainer(&apiv1.Container{
Name: fn.ObjectMeta.Name,
Name: env.ObjectMeta.Name,
Image: env.Spec.Runtime.Image,
ImagePullPolicy: deploy.runtimeImagePullPolicy,
TerminationMessagePath: "/dev/termination-log",
@@ -312,7 +312,7 @@ func (deploy *NewDeploy) getDeploymentSpec(fn *fv1.Function, env *fv1.Environmen
// Order of merging is important here - first fetcher, then containers and lastly pod spec
err = deploy.fetcherConfig.AddSpecializingFetcherToPodSpec(
&deployment.Spec.Template.Spec,
fn.ObjectMeta.Name,
env.ObjectMeta.Name,
fn,
env,
)
@@ -13,7 +13,7 @@ spec:
runtime:
image: fission/node-env
container:
name: nodehellond
name: nodend
volumeMounts:
- name: cvol
mountPath: /etc/cvoldata
@@ -22,7 +22,7 @@ spec:
hostname: foo-bar
# A container which will be merged with for pool manager
containers:
- name: nodehellond
- name: nodend
image: fission/node-env
volumeMounts:
- name: funcvol