-
Notifications
You must be signed in to change notification settings - Fork 276
fix(cli): osm namespace add should fail when adding osm-system NS #1499
Conversation
This has changes to return an error when a user tries to add a ns which has osm control plane installed to the mesh. This will fix openservicemesh#1196.
cmd/cli/namespace_add.go
Outdated
if err != nil { | ||
return errors.Errorf("Could not label namespace [%s]: %v", ns, err) | ||
deploymentsClient := a.clientSet.AppsV1().Deployments(ns) | ||
labelSelector := metav1.LabelSelector{MatchLabels: map[string]string{"app": "osm-controller"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably make this a constant
@Sheshagiri, thanks for the change, would you mind adding tests prior to merging? |
Sure, I have a todo. I'll add those and mark this as ready for review. |
This has changes to return an error when a user tries to add a ns which has osm control plane installed to the mesh. This will fix openservicemesh#1196.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
fakeClientSet.AppsV1().Deployments(testNamespace).Create(context.TODO(), deploymentSpec, metav1.CreateOptions{}) | ||
|
||
nsSpec := createNamespaceSpec(testNamespace, "") | ||
fakeClientSet.CoreV1().Namespaces().Create(context.TODO(), nsSpec, metav1.CreateOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised to see that we're creating the namespace after creating the deployment in the namespace. Does this work because we're using fakeClientSet
so it is not validating that the value of testNamespace
exists before creating the Deployment with that Namespace?
fixes: #1196
This has changes to return an error when a user tries to add a namespace which has osm control plane running in it.
Please mark with X for applicable areas.
Please answer the following questions with yes/no.
todo: