server: standardize on naming
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
774c47d00c
commit
6035cff9e4
5 changed files with 93 additions and 40 deletions
|
@ -13,7 +13,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/pkg/symlink"
|
||||
"github.com/kubernetes-incubator/cri-o/oci"
|
||||
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
||||
|
@ -258,8 +257,7 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
|
|||
return nil, fmt.Errorf("CreateContainerRequest.ContainerConfig.Name is empty")
|
||||
}
|
||||
|
||||
attempt := containerConfig.GetMetadata().Attempt
|
||||
containerID, containerName, err := s.generateContainerIDandName(sb.name, name, attempt)
|
||||
containerID, containerName, err := s.generateContainerIDandName(sb.metadata, containerConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -720,21 +718,6 @@ func (s *Server) setupSeccomp(specgen *generate.Generator, cname string, sbAnnot
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) generateContainerIDandName(podName string, name string, attempt uint32) (string, string, error) {
|
||||
var (
|
||||
err error
|
||||
id = stringid.GenerateNonCryptoID()
|
||||
)
|
||||
nameStr := fmt.Sprintf("%s-%s-%v", podName, name, attempt)
|
||||
if name == "infra" {
|
||||
nameStr = fmt.Sprintf("%s-%s", podName, name)
|
||||
}
|
||||
if name, err = s.reserveContainerName(id, nameStr); err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return id, name, err
|
||||
}
|
||||
|
||||
// getAppArmorProfileName gets the profile name for the given container.
|
||||
func (s *Server) getAppArmorProfileName(annotations map[string]string, ctrName string) string {
|
||||
profile := apparmor.GetProfileNameFromPodAnnotations(annotations, ctrName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue