Closed cben closed 8 years ago
@cben cben is an invalid user, ignoring...
Correction: Container can't be labeled. kubectl's (and oc's) smallest unit is a pod. (I did somehow manage to auto-tag containers based on labels it in my work on #7605 but that appears to be a bug.)
- ContainerImage labels are not fetched on refresh and not shown. AFAICT we're not directly fetching any data on images, only parsing image references that we encounter elsewhere. kubeclient doesn't even have any get_images API...
I believe that container images are still derived from a single string meaning they arent a kubernetes recognized entity. So I dont see how they could have labels. The parsing is done here
@zeari you are right about our current parsing. Images are an openshift entity that was recently added to openshift_client, though we do not fetch it currently.
ContainerImage labels are not fetched on refresh and not shown. AFAICT we're not directly fetching any data on images, only parsing image references that we encounter elsewhere. kubeclient doesn't even have any get_images API...
That is right, see above
@zeari @cben @moolitayer is this fixed? (by #7771 ?)
If so, @blomquisg can close this.
@simon3z I believe so but @cben should verify. We might want to add fetching of Images(the openshift entity) to our backlog
@cben as far as I can see routes persist and show labels, but projects do not persist them:
2.2.2 :019 > client.get_namespace('default').metadata.annotations.to_h
=> {:key=>"value", :"openshift.io/sa.initialized-roles"=>"true", :"openshift.io/sa.scc.mcs"=>"s0:c1,c0", :"openshift.io/sa.scc.supplemental-groups"=>"1000000000/10000", :"openshift.io/sa.scc.uid-range"=>"1000000000/10000"}
2.2.2 :026 > ContainerProject.find_by(:name => 'default').custom_attributes
ContainerProject Load (0.3ms) SELECT "container_projects".* FROM "container_projects" WHERE "container_projects"."name" = $1 LIMIT $2 [["name", "default"], ["LIMIT", 1]]
ContainerProject Inst Including Associations (0.1ms - 1rows)
CustomAttribute Load (0.3ms) SELECT "custom_attributes".* FROM "custom_attributes" WHERE "custom_attributes"."resource_id" = $1 AND "custom_attributes"."resource_type" = $2 [["resource_id", 1], ["resource_type", "ContainerProject"]]
CustomAttribute Inst Including Associations (0.0ms - 0rows)
=> #<ActiveRecord::Associations::CollectionProxy []>
2.2.2 :027 > ContainerProject.find_by(:name => 'default').labels
ContainerProject Load (0.4ms) SELECT "container_projects".* FROM "container_projects" WHERE "container_projects"."name" = $1 LIMIT $2 [["name", "default"], ["LIMIT", 1]]
ContainerProject Inst Including Associations (0.1ms - 1rows)
CustomAttribute Load (0.2ms) SELECT "custom_attributes".* FROM "custom_attributes" WHERE "custom_attributes"."resource_id" = $1 AND "custom_attributes"."resource_type" = $2 AND "custom_attributes"."section" = $3 [["resource_id", 1], ["resource_type", "ContainerProject"], ["section", "labels"]]
CustomAttribute Inst Including Associations (0.0ms - 0rows)
=> #<ActiveRecord::Associations::CollectionProxy []>
Am I missing anything?
I think typically projects have no labels, unless explicitly assigned by oc label namespace ...
.
I have assigned such a label for testing on my local cluster, and it works (just checked on master):
I'm gonna open a Trello for images. => Yes, this can be closed (@moolitayer correct me if you disagree)
Ah, what you looked up was annotations, which is independent of labels. I do have a label persisted:
irb(main):006:0> ContainerProject.find_by(:name => 'proj2').labels
ContainerProject Load (0.2ms) SELECT "container_projects".* FROM "container_projects" WHERE "container_projects"."name" = $1 LIMIT $2 [["name", "proj2"], ["LIMIT", 1]]
ContainerProject Inst Including Associations (0.1ms - 1rows)
CustomAttribute Load (0.4ms) SELECT "custom_attributes".* FROM "custom_attributes" WHERE "custom_attributes"."resource_id" = $1 AND "custom_attributes"."resource_type" = $2 AND "custom_attributes"."section" = $3 [["resource_id", 6], ["resource_type", "ContainerProject"], ["section", "labels"]]
CustomAttribute Inst Including Associations (0.1ms - 1rows)
=> #<ActiveRecord::Associations::CollectionProxy [#<CustomAttribute id: 1, section: "labels", name: "department", value: "warp-drive", resource_type: "ContainerProject", resource_id: 6, source: "kubernetes", description: nil, value_interpolated: nil, unique_name: nil>]>
EDIT2:
[root@vm-test-02 ~]# oc get project proj2 -o yaml
apiVersion: v1
kind: Project
metadata:
annotations:
destination: Alpha Centauri
openshift.io/description: ""
openshift.io/display-name: Project 2
openshift.io/requester: foo
openshift.io/sa.scc.mcs: s0:c7,c4
openshift.io/sa.scc.supplemental-groups: 1000050000/10000
openshift.io/sa.scc.uid-range: 1000050000/10000
creationTimestamp: 2016-03-28T15:04:13Z
labels:
department: warp-drive
name: proj2
resourceVersion: "150569"
selfLink: /oapi/v1/projects/proj2
uid: 554c1eaa-f4f6-11e5-b943-525400c7c086
spec:
finalizers:
- openshift.io/origin
- kubernetes
status:
phase: Active
(where "department: warp-drive" label and "destination: Alpha Centauri" annotation were both added by me using oc
.)
oc get namespace proj2 -o yaml
gives nearly identical results, but you can't oc label project
, only oc label namespace
.
Ah, what you looked up was annotations, which is independent of labels.
Oh right, I tested on labels this time, and I can see the label in the screen after refresh. Thanks @cben
client.patch_namespace('default', {:metadata => {:labels => {:key => 'value'}}})
:+1: for closing this @blomquisg
Working on fix for (1), (2). (3) I'm not gonna fix currently, both because it's harder and because what's really interesting for images is not their kubernetes labels but the image's "docker labels". These contain metadata how and what they were built from (at least for STI builds). See https://github.com/ManageIQ/manageiq/pull/7605#issuecomment-206320939 for an example.
@miq-bot add_label providers/containers, ui, bug @miq-bot assign cben