Skip to content

Commit

Permalink
#3 - minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianco95 committed Apr 22, 2024
1 parent f8d9fcf commit cf08025
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions pkg/docker/Create.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ func (h *SidecarHandler) CreateHandler(w http.ResponseWriter, r *http.Request) {
log.G(h.Ctx).Info("Container " + containerName + " is not requesting a GPU")
}

log.G(h.Ctx).Info("- Creating container " + containerName)

var envVars string = ""
// add environment variables to the docker command
for _, envVar := range container.Env {
Expand Down
11 changes: 6 additions & 5 deletions pkg/docker/aux.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func prepareMounts(Ctx context.Context, config commonIL.InterLinkConfig, data []
for _, podData := range data {

podUID := string(podData.Pod.UID)
podNamespace := string(podData.Pod.UID)

err := os.MkdirAll(config.DataRootFolder+podData.Pod.Namespace+"-"+podUID, os.ModePerm)
if err != nil {
Expand All @@ -42,15 +43,15 @@ func prepareMounts(Ctx context.Context, config commonIL.InterLinkConfig, data []
log.G(Ctx).Info("-- Created directory " + config.DataRootFolder + podData.Pod.Namespace + "-" + podUID)
}

log.G(Ctx).Info("pod data values: " + fmt.Sprintf("%+v", podData))

for _, cont := range podData.Containers {

containerName := podNamespace + "-" + podUID + "-" + container.Name

log.G(Ctx).Info("cont values: " + fmt.Sprintf("%+v", cont))

log.G(Ctx).Info("-- Inside Preparing mountpoints for " + cont.Name)
for _, cfgMap := range cont.ConfigMaps {
if container.Name == cont.Name {
if containerName == podNamespace + "-" + podUID + "-" + cont.Name {
log.G(Ctx).Info("-- Mounting ConfigMap " + cfgMap.Name)
paths, err := mountData(Ctx, config, podData.Pod, cfgMap, container)
if err != nil {
Expand All @@ -64,7 +65,7 @@ func prepareMounts(Ctx context.Context, config commonIL.InterLinkConfig, data []
}

for _, secret := range cont.Secrets {
if container.Name == cont.Name {
if containerName == podNamespace + "-" + podUID + "-" + cont.Name {
paths, err := mountData(Ctx, config, podData.Pod, secret, container)
if err != nil {
log.G(Ctx).Error("Error mounting Secret " + secret.Name)
Expand All @@ -77,7 +78,7 @@ func prepareMounts(Ctx context.Context, config commonIL.InterLinkConfig, data []
}

for _, emptyDir := range cont.EmptyDirs {
if container.Name == cont.Name {
if containerName == podNamespace + "-" + podUID + "-" + cont.Name {
paths, err := mountData(Ctx, config, podData.Pod, emptyDir, container)
if err != nil {
log.G(Ctx).Error("Error mounting EmptyDir " + emptyDir)
Expand Down

0 comments on commit cf08025

Please sign in to comment.