consul-k8s: Problem with copyAnnotations for apiGateway.
It appears that copyAnnotations does not work as described in the documentation.
I have tried every combination I can think of, and nothing seems to add anything to configuration.
apiGateway:
enabled: true
image: "hashicorp/consul-api-gateway:0.1.0"
logLevel: debug
managedGatewayClass:
enabled: true
serviceType: LoadBalancer
useHostPorts: true
copyAnnotations:
service: |
"key1": 'value1'
"key2": 'value2'
Following the recommendations from https://www.consul.io/docs/k8s/helm#v-apigateway-managedgatewayclass-copyannotations
The lines beginning “key1” an “key2” should begin with a hyphen, but this fails to convert YAML to JSON
If I put spaces before the hyphens I get the following error:
can't evaluate field annotations in type interface {}
Looking at the code, it’s expecting something more like the following, but again, this doesn’t work
apiGateway:
managedGatewayClass:
copyAnnotations:
service:
annotations:
"key1": 'value1'
"key2": 'value2'
So either the problem is with the documentation not showing clearly how to add annotations, or the code for the copyAnnotations isn’t working as expected.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (8 by maintainers)
OK @andrewstucki , I obviously misunderstood slightly how it was supposed to work, your description is much clearer and easier to understand.
One quick note for anyone else having problems, when I follow the example you’ve shown:
Then I get the following error:
Error: failed to parse consul-values.yaml: error converting YAML to JSON: yaml: line 66: did not find expected keyI need to add indentation before the annotations, the following parses without problem:
I will experiment and let you know if I have any other issues, but thank you for your help.
That does sound like it would resolve my problem in a much neater way. I will watch with interest to see if it gets accepted into a release.