Bug 1358257
Summary: | Container auto-tagging from labels breaks refresh on labels with empty value | |||
---|---|---|---|---|
Product: | Red Hat CloudForms Management Engine | Reporter: | Beni Paskin-Cherniavsky <cben> | |
Component: | Providers | Assignee: | Beni Paskin-Cherniavsky <cben> | |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Einat Pacifici <epacific> | |
Severity: | high | Docs Contact: | ||
Priority: | high | |||
Version: | 5.6.0 | CC: | cpelland, dron, fsimonce, jfrey, jhardy, obarenbo, simaishi | |
Target Milestone: | GA | Keywords: | TestOnly, ZStream | |
Target Release: | 5.7.0 | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | container | |||
Fixed In Version: | 5.7.0.0 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1358303 (view as bug list) | Environment: | ||
Last Closed: | 2017-01-11 19:58:44 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1358303 |
Description
Beni Paskin-Cherniavsky
2016-07-20 11:42:21 UTC
Update: after discussion on PR #9747, we switched to behavior 2 (create `Foo : <emtpy value>` tags). New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/90155b96186a036c5e406ee5308921521c524535 commit 90155b96186a036c5e406ee5308921521c524535 Author: Beni Cherniavsky-Paskin <cben> AuthorDate: Mon Jul 25 20:00:51 2016 +0300 Commit: Beni Cherniavsky-Paskin <cben> CommitDate: Mon Jul 25 20:02:05 2016 +0300 Fix auto-tagging to handle empty-value labels Given any-value mapping `foo` -> "Foo" category, `foo=` label will create "Foo : <empty value>" tag. Fixes #9713, https://bugzilla.redhat.com/show_bug.cgi?id=1358257 https://bugzilla.redhat.com/show_bug.cgi?id=1358303 app/models/container_label_tag_mapping.rb | 11 +++++++++-- spec/models/container_label_tag_mapping_spec.rb | 7 ++++--- 2 files changed, 13 insertions(+), 5 deletions(-) Forgot to mention in description: after using `rails console` to create the mapping in the DB, should restart CFME to reload it. (it's cached in memory indefinitely; the `ContainerLabelTagMapping.drop_cache` line above affects the rails console process but not an already running instance). New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/593a0cd8930e3ceb093da1fe4d44301a0e448f9d commit 593a0cd8930e3ceb093da1fe4d44301a0e448f9d Author: Beni Cherniavsky-Paskin <cben> AuthorDate: Thu Oct 13 21:43:40 2016 +0300 Commit: Beni Cherniavsky-Paskin <cben> CommitDate: Wed Oct 26 20:04:51 2016 +0300 Do not create tags for empty-value labels This reverts decision on https://github.com/ManageIQ/manageiq/issues/9713#issuecomment-233929144 https://bugzilla.redhat.com/show_bug.cgi?id=1358257 back to "behavior 1" of ignoring labels with empty value. This only affects any-value mappings. A specific value='' mapping would still be honored. app/models/container_label_tag_mapping.rb | 14 ++++++-------- spec/models/container_label_tag_mapping_spec.rb | 6 ++---- 2 files changed, 8 insertions(+), 12 deletions(-) `oc label`, `oc edit` apparently gives error on empty label value in newer openshift (v3.3). Found a different way using curl. And there is now UI to configure mappings (https://github.com/ManageIQ/manageiq/pull/11591). And expected behavior changed to no tag. ==> UPDATED INSTRUCTIONS: (Steps 2 & 3 below could be skipped but then it's hard to know step 5 worked.) 1. Top right menu -> Configuration -> Region 0 in explorer -> Map Tags tab. Add a mapping rule from Entity type <ALL>, Label "foo" to category "Foo Whatever". 2. Create `foo=bar` label on some entity, let's say a pod: $ oc label pod --namespace=default router-1-l67gi foo=bar 3. Refresh the provider. Expected results: - Provider screen shows Last Refresh Status "successful" with recent time (e.g. 1 minute ago). - The entity's screen shows "foo | bar" label in Labels table AND "Foo Whatever : bar" tag in "Smart Management" table. 4. Change the label to empty value: $ oc proxy --port=9443 & [1] Starting to serve on 127.0.0.1:9443 $ curl -XPATCH -H "Content-Type: application/strategic-merge-patch+son" http://localhost:8080/api/v1/namespaces/default/pods/router-1-l67gi -d '{"metadata":{"labels":{"foo":""}}}' | grep --after=5 labels $ fg oc proxy --port=9443 ^C 5. Refresh the provider. Expected results: - Provider screen shows Last Refresh Status "successful" with recent time (e.g. 0 minute ago). - The entity's screen shows "foo |" empty label in Labels table AND NO TAG in "Smart Management" table. [If you want to label other entity types, the URL structure differs, search "PATCH" in http://kubernetes.io/docs/api-reference/v1/operations/. To label a Project, use `oc label namespace NAME` and /api/v1/namespaces/NAME.] Corrections to step 4: - the oc proxy port should match port used in curl - s/+son/+json/ 4. Change the label to empty value: $ oc proxy --port=8080 & [1] Starting to serve on 127.0.0.1:9443 $ curl -XPATCH -H "Content-Type: application/strategic-merge-patch+json" http://localhost:8080/api/v1/namespaces/default/pods/router-1-l67gi -d '{"metadata":{"labels":{"foo":""}}}' | grep --after=5 labels $ fg oc proxy --port=8080 ^C P.S. To label projects, use url of the form http://localhost:8080/api/v1/namespaces/NAME Verified. Followed steps in comment 7 and comment 8 As below: $ oc proxy --port=9443 & $curl -XPATCH -H "Content-Type: application/strategic-merge-patch+json" http://localhost:9443/api/v1/namespaces/hello4 -d '{"metadata":{"labels":{"dept":""}}}' | grep --after=5 labels % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed Viewing Project in CFME, for Project=hello4, Labels table has empty values for dept. |