Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
metalcycling opened this issue May 17, 2023 · 3 comments · May be fixed by #652
Assignees
Labels
bug Something isn't working

Comments

@metalcycling
Copy link
Collaborator

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
@asm582
Copy link
Member

asm582 commented May 17, 2023

May be this is an anti-pattern, users in one namespace submit AW to another namespace

@metalcycling
Copy link
Collaborator Author

Well, I'm thinking the case where a user has access to two namespaces and decides to submit the exact same job to both of them, for some reason. Then it would fail. But that may be a very very unlikely scenario.

@z103cb
Copy link
Contributor

z103cb commented May 18, 2023

I think this valid use case and we should support it. I think is a real issue that needs to be addressed. We should also add a validation that says that the namespace of the app wrapper should be the same as the name in the generic item. IMHO, mismatched namespaces is the only invalid uses case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready For Review
4 participants