-
Notifications
You must be signed in to change notification settings - Fork 880
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
bugfix:argo create command not support namespace in yaml file #962
Conversation
Codecov Report
@@ Coverage Diff @@
## master #962 +/- ##
==========================================
- Coverage 81.60% 81.59% -0.02%
==========================================
Files 99 99
Lines 8732 8738 +6
==========================================
+ Hits 7126 7130 +4
- Misses 1151 1152 +1
- Partials 455 456 +1
Continue to review full report at Codecov.
|
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.
when we use "kubectl create -f xxx -n myns", if the namespace in file is different from flag,kubectl will return not match error.
I think "kubectl argo rollouts create -f" should return like so in that situation.
func (c *CreateOptions) getNamespace(un unstructured.Unstructured) string { | ||
ns := c.ArgoRolloutsOptions.Namespace() | ||
if md, ok := un.Object["metadata"]; ok { | ||
metadata := md.(map[string]interface{}) |
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.
may panic here if metadata is not a map in the resource file.
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.
not write matadata name is invalid resource file,
it's error
modify before: [root@k8s-master-1 argo-rollouts]# grep namespace examples/rollout-canary.yaml namespace: base [root@k8s-master-1 argo-rollouts]# kubectl argo create -f examples/rollout-canary.yaml Error: the namespace of the provided object does not match the namespace sent on the request modify after: [root@k8s-master-1 argo-rollouts]# grep namespace examples/rollout-canary.yaml namespace: base [root@k8s-master-1 argo-rollouts]# kubectl argo create -f examples/rollout-canary.yaml rollout.argoproj.io/rollout-canary created [root@k8s-master-1 argo-rollouts]# Signed-off-by: zhaozhiqiang <[email protected]>
adc9655
to
9da9ab7
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
modify before:
[root@k8s-master-1 argo-rollouts]# grep namespace examples/rollout-canary.yaml
namespace: base
[root@k8s-master-1 argo-rollouts]# kubectl argo create -f examples/rollout-canary.yaml
Error: the namespace of the provided object does not match the namespace sent on the request
modify after:
[root@k8s-master-1 argo-rollouts]# grep namespace examples/rollout-canary.yaml
namespace: base
[root@k8s-master-1 argo-rollouts]# kubectl argo create -f examples/rollout-canary.yaml
rollout.argoproj.io/rollout-canary created
[root@k8s-master-1 argo-rollouts]#
Signed-off-by: zhaozhiqiang [email protected]
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.