Bug 1524305 - oc annotate fails if annotation name includes slash when using oc 3.7 VS server 3.9
Summary: oc annotate fails if annotation name includes slash when using oc 3.7 VS serv...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.7.z
Assignee: Juan Vallejo
QA Contact: Xingxing Xia
URL:
Whiteboard:
: 1569095 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-11 08:19 UTC by Hongan Li
Modified: 2021-09-09 12:56 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-15 19:34:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1569095 0 unspecified CLOSED Upgrade to 3.9 fails applying metadata.labels: Invalid value: \"node-role.kubernetes.io~1compute\ 2021-09-09 13:45:40 UTC

Internal Links: 1569095

Description Hongan Li 2017-12-11 08:19:23 UTC
Description of problem:
When using oc 3.7 VS server 3.8, oc annotate fails if:
The resource existing annotations have at least one annotation AND the annotation name in command line includes slash.

It can succeed given the resource existing annotation is empty.

Version-Release number of selected component (if applicable):
oc v3.7.14
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://host-8-245-66.host.centralci.eng.rdu2.redhat.com:8443
openshift v3.8.18
kubernetes v1.8.1+0d5291c

How reproducible:
always

Steps to Reproduce:
1. create pod/svc/route
$ oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/caddy-docker.json
$ oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/edge/service_unsecure.json
$ oc expose svc service-unsecure 

2. check the annotation of the route (ensure the route has one annotation)
$ oc get route -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Route
  metadata:
    annotations:
      openshift.io/host.generated: "true"
<--snip-->

3. add another annotation to route 
oc annotate route service-unsecure router.openshift.io/haproxy.health.check.interval=400ms
The Route "service-unsecure" is invalid: metadata.annotations: Invalid value: "router.openshift.io~1haproxy.health.check.interval": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')


Actual results:
failed and show errors


Expected results:
succeed

Additional info:
no issue when both client and server are 3.8, or both are 3.7.

Comment 1 Juan Vallejo 2018-01-18 20:30:18 UTC
I am no longer able to replicate this in 3.9.

Steps taken:
```
$ oc version
oc v3.9.0-alpha.2+fcbb58a-113-dirty
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443
openshift v3.9.0-alpha.2+d73139f
kubernetes v1.9.0-beta1

$ oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/caddy-docker.json
$ oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/routing/edge/service_unsecure.json
$ oc expose svc service-unsecure

$ oc get route service-unsecure -o jsonpath='{.metadata.annotations}'
map[openshift.io/host.generated:true]%

$ oc annotate route service-unsecure router.openshift.io/haproxy.health.check.interval=400ms

$ oc get route service-unsecure -o jsonpath='{.metadata.annotations}'
map[router.openshift.io/haproxy.health.check.interval:400ms openshift.io/host.generated:true]
```

Comment 2 XiaochuanWang 2018-01-19 03:02:06 UTC
Verified on oc v3.9.0-0.21.0

$ oc annotate route service-unsecure
error: at least one annotation update is required
See 'oc annotate -h' for help and examples.

$ oc annotate route service-unsecure test=abc
route "service-unsecure" annotated

$ oc get route -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Route
  metadata:
    annotations:
      openshift.io/host.generated: "true"
      test: abc
    creationTimestamp: 2018-01-19T02:58:19Z
    labels:
      name: service-unsecure
    name: service-unsecure
...

Comment 3 XiaochuanWang 2018-01-19 03:32:15 UTC
Sorry I have to reassigned this one because:
oc v3.7.23 does not work for the key name with slash (server version: openshift v3.9.0-0.21.0), this should be a compatibility issue.

# oc annotate route route-edge  openshift.io/host.generated=false --overwrite
The Route "route-edge" is invalid: metadata.annotations: Invalid value: "openshift.io~1host.generated": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')


(compared to oc v3.9.0-0.21.0)
$ oc annotate route service-unsecure  openshift.io/host.generated=false --overwrite
route "service-unsecure" annotated
$ oc get route -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Route
  metadata:
    annotations:
      openshift.io/host.generated: "false"

Comment 4 Juan Vallejo 2018-01-19 16:21:19 UTC
> Sorry I have to reassigned this one because:
oc v3.7.23 does not work for the key name with slash (server version: openshift v3.9.0-0.21.0), this should be a compatibility issue.

We have a +1/-1 compatibility support between server and client.
This works with a 3.8 client against a 3.9 server as well.

I will go ahead and backport this fix to 3.7, but it should not block this bugzilla. Moving back to ON_QA

Comment 6 Yanping Zhang 2018-01-22 06:23:19 UTC
Will have a check when the above pr1016 is merged.

Comment 12 XiaochuanWang 2018-03-09 08:48:39 UTC
Test against oc v3.7.36 and it's reproduced:
$ ./oc annotate route service-unsecure router.openshift.io/haproxy.health.check.interval=400ms
The Route "service-unsecure" is invalid: metadata.annotations: Invalid value: "router.openshift.io~1haproxy.health.check.interval": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')

oc v3.9.4 does not reproduced.

Both are tested on openshift v3.9.4
Since this is a compatible issue for client/server sides, it should be fixed on oc 3.7.z instead of oc 3.9

As per comment 10, update the status to MODIFIED.

Comment 14 Jordan Liggitt 2018-05-01 15:47:22 UTC
*** Bug 1569095 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.