acorn-io / runtime

A simple application deployment framework built on Kubernetes
https://docs.acorn.io/
Apache License 2.0
1.14k stars 102 forks source link

Resolved offerings not generated for containers when there are containers with same name as a sidecar container or multiple containers with same sidecar name #2469

Open sangee2004 opened 5 months ago

sangee2004 commented 5 months ago

acorn version - v0.10.1-rc1-18-g523ede04+523ede04 Steps to reproduce the problem:

  1. Deploy app with following Acornfile where 2 containers have the side cars with same name
    
    containers: {
    nginx: {
        sidecars: ubuntu:
        {
            image: "ubuntu:latest"
            cmd: ["bash", "-c", "sleep infinity"]
        }
        image: "nginx:latest"
        ports: "80/http"
    }
    nginx1: {
        sidecars: ubuntu:
        {
            image: "ubuntu:latest"
            cmd: ["bash", "-c", "sleep infinity"]
        }
        image: "nginx:latest"
        ports: "80/http"
    }
    }
Once app is deployed, notice that `resolvedOfferings` is reported only for 1 of the sidecars.
           "resolvedOfferings": {
                "containers": {
                    "": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    },
                    "nginx": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    },
                    "nginx1": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    },
                    "ubuntu": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    }
                },

2. Deploy app with following Acornfile where there is a container with same name as a sidecar container 

containers: nginx: { sidecars: ubuntu: { image: "ubuntu:latest" cmd: ["bash", "-c", "sleep infinity"] } image: "nginx:latest" ports: "80/http" }

containers: ubuntu: { image: "ubuntu:latest" cmd: ["bash", "-c", "sleep infinity"] }

Once app is deployed, notice that `resolvedOfferings` is reported only for 2 containers:
          "resolvedOfferings": {
                "containers": {
                    "": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    },
                    "nginx": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    },
                    "ubuntu": {
                        "class": "free",
                        "memory": 536870912,
                        "cpuScaler": 0.25
                    }
                },


**Expected  Behavior:**
1. In both cases, we expect `resolvedOfferings` to be reported for all containers.