jsonnet-libs/k8s

Using multiple specs ( for multiple versions ) in a single CRD based library fail

primeroz opened this issue · 3 comments

a config.sonnet like this

local config = import 'jsonnet/config.jsonnet';

config.new(
  name='jaeger-operator',
  specs=[
    {
      output: '1.24',
      openapi: 'http://localhost:8001/openapi/v2',
      prefix: '^io\\.jaegertracing\\..*',
      crds: ['https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.24.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml'],
      localName: 'jaeger-operator',
    },
    {
      output: '1.25',
      openapi: 'http://localhost:8001/openapi/v2',
      prefix: '^io\\.jaegertracing\\..*',
      crds: ['https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.25.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml'],
      localName: 'jaeger-operator',
    },
  ]
)

when rendered will cause the last version to be loaded and used to render both of the 1.24 and the 1.25 output

log example

++ mktemp                                                                                                                                                                                                            
+ CRDFILE=/tmp/tmp.pEeEjA                                                                                                                                                                                            
++ mktemp                                                                                                                                                                                                            
+ API_LOGFILE=/tmp/tmp.LCafij                                                                                                                                                                                        
+ '[' -n 'https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.24.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml                                                                                      
https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.25.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml' ']'                                                                                           
+ echo ''                                                                                                                                                                                                            
+ ./bare-k3s                                                                                                                                                                                                         
+ for URL in ${CRDS}                                                                                                                                                                                                 
+ echo ---                                                                                                                                                                                                           
+ echo 'Downloading https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.24.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml...'                                                                        
+ curl -sL https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.24.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml                                                                                     
Downloading https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.24.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml...                                                                                 
+ for URL in ${CRDS}                                                                                                                                                                                                 
+ echo ---                                                                                                                                                                                                           
+ echo 'Downloading https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.25.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml...'
Downloading https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.25.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml...
+ curl -sL https://raw.githubusercontent.com/jaegertracing/jaeger-operator/v1.25.0/deploy/crds/jaegertracing.io_jaegers_crd.yaml
+ server_up                                                                                               
+ local i                                                                                                 
++ seq 1 10                                                                                               
+ for i in $(seq 1 10)                                                                                    
+ local out
++ kubectl get --raw /healthz                                                                             
+ out=
+ sleep 1
+ for i in $(seq 1 10)
+ local out
++ kubectl get --raw /healthz
+ out=
+ sleep 1
+ for i in $(seq 1 10)
+ local out
++ kubectl get --raw /healthz
+ out=
+ sleep 1
+ for i in $(seq 1 10)
+ local out
++ kubectl get --raw /healthz
+ out=ok
+ echo 'On try 4: ok'
+ return 0
On try 4: ok
+ kubectl apply -f /tmp/tmp.pEeEjA
customresourcedefinition.apiextensions.k8s.io/jaegers.jaegertracing.io created
customresourcedefinition.apiextensions.k8s.io/jaegers.jaegertracing.io configured
+ sleep 120
+ kubectl proxy
Starting to serve on 127.0.0.1:8001
+ shopt -s dotglob
+ cp -r /config/skel/.github /config/skel/LICENSE /config/skel/README.md /config/skel/docs /config/skel/mkdocs.yml /config/skel/requirements.txt /output/github.com/jsonnet-libs/jaeger-operator-libsonnet
+ k8s-gen -o /output/github.com/jsonnet-libs/jaeger-operator-libsonnet -c /config/config.yml
Generating '1.24' from 'http://localhost:8001/openapi/v2, ^io\.jaegertracing\..*'
Generating '1.25' from 'http://localhost:8001/openapi/v2, ^io\.jaegertracing\..*'

You are right, that is a bug.

👍 i was planning to have a look at it but had no time so i just created this for reference. If anyone gets to it before me cool otherwise i will give it a shot as soon as i can