Skip to content

AppWrappers with same name with generic items that also have the same name but are deployed in different namespaces fail #383

Open
@metalcycling

Description

@metalcycling

This is a very obscure bug, and potentially not worth fixing. The issue can be replicated with the following code. The only difference between the two AppWrappers is the fact that one is deployed to namespace-1 and the other to namespace-2, everything else is the same, including the names for the AppWrappers and the generic items. This deployment fails for one of the AppWrappers as MCAD thinks there is already a dispatched AppWrapper but its generic items are non existent in its corresponding namespace. Changing the names of either the AppWrapper or the generic items fixes the issue. It is very unlikely anyone would have the exact same names across two namespaces, so no need to worry about this for now.

apiVersion: mcad.ibm.com/v1beta1
kind: AppWrapper
metadata:
    namespace: namespace-1
    name: my-aw
spec:
    resources:
        GenericItems:
            - replicas: 1
              custompodresources:
              - replicas: 1
                requests:
                    cpu: 500m
                    nvidia.com/gpu: 0
                    memory: 500Mi
                limits:
                    cpu: 500m
                    nvidia.com/gpu: 0
                    memory: 500Mi
              generictemplate:
                  apiVersion: v1
                  kind: Pod
                  metadata:
                      namespace: namespace-1
                      name: my-pod
                  spec:
                      containers:
                          - name: my-pod
                            image: ubuntu:latest
                            imagePullPolicy: IfNotPresent
                            command:
                                - sh
                                - -c
                                - |
                                  sleep infinity
                            resources:
                                requests:
                                    cpu: 500m
                                    nvidia.com/gpu: 0
                                    memory: 500Mi
                                limits:
                                    cpu: 500m
                                    nvidia.com/gpu: 0
                                    memory: 500Mi
---
apiVersion: mcad.ibm.com/v1beta1
kind: AppWrapper
metadata:
    namespace: namespace-2
    name: my-aw
spec:
    resources:
        GenericItems:
            - replicas: 1
              custompodresources:
              - replicas: 1
                requests:
                    cpu: 500m
                    nvidia.com/gpu: 0
                    memory: 500Mi
                limits:
                    cpu: 500m
                    nvidia.com/gpu: 0
                    memory: 500Mi
              generictemplate:
                  apiVersion: v1
                  kind: Pod
                  metadata:
                      namespace: namespace-2
                      name: my-pod
                  spec:
                      containers:
                          - name: my-pod
                            image: ubuntu:latest
                            imagePullPolicy: IfNotPresent
                            command:
                                - sh
                                - -c
                                - |
                                  sleep infinity
                            resources:
                                requests:
                                    cpu: 500m
                                    nvidia.com/gpu: 0
                                    memory: 500Mi
                                limits:
                                    cpu: 500m
                                    nvidia.com/gpu: 0
                                    memory: 500Mi

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

Ready For Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions