apiVersion of template is ignored
Closed this issue · 4 comments
Describe the bug
I'm creating mongodb instances for percona mongodb operator. For the operator it looks like a v1
CRD and things fail because the rest of the setup is made for v1-4-0
.
I'm not 100% sure if the fault lies with couchbase-sb or percona for having weird version names. (I never saw them with dashes).
Here's the code for their finding-out-the-version magic https://github.com/percona/percona-server-mongodb-operator/blob/d8c30cba10f33aea2d6a21b19a78deb8accdc420/pkg/apis/psmdb/v1/psmdb_types.go#L471
To Reproduce
It's a bit complex, but in general you install the psmdb operator and use this service-broker to create a cluster crd.
Expected behavior
CRD in version 1-4-0 is created.
Workaround
Used kubectl edit on the crd to set it to 1-4-0 and then things started to work again.
Environment (please complete the following information):
- Kubernetes Version: 1.17-EKS
- Service Broker Version: master
More info
That's the template configured in the service broker
- name: perconaservermongodb
template:
apiVersion: psmdb.percona.com/v1-4-0
kind: PerconaServerMongoDB
metadata:
name: '{{ registry "instance-name"}}'
spec:
image: percona/percona-server-mongodb-operator:1.4.0-mongod4.2
imagePullPolicy: Always
platform: kubernetes
allowUnsafeConfigurations: true
version: 4.2.8
secrets:
users: '{{ printf "%s-mongodb-users" (registry "instance-name") }}'
pmm:
enabled: true
serverHost: monitoring-service
image: percona/percona-server-mongodb-operator:1.4.0-pmm
replsets:
- name: rs0
size: 3
affinity:
antiAffinityTopologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
expose:
enabled: true
arbiter:
enabled: false
resources:
'{{ snippet (printf "resources-%s" (parameter "/size")) }}'
volumeSpec:
persistentVolumeClaim:
storageClassName: mongodb-xfs
resources:
requests:
'{{ snippet (printf "storage-%s" (parameter "/size")) }}'
mongod:
net:
port: 27017
security:
enableEncryption: true
encryptionKeySecret: '{{ printf "%s-encryption-key" (registry "instance-name") }}'
encryptionCipherMode: 'AES256-CBC'
Wow, that is magnificently crap 😸 In your template try:
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: '{"apiVersion":"psmdb.percona.com/v1-4-0"}'
Obviously they are trying to tell you it can only be installed with kubectl apply
...
Yep, that's really weird to handle CRD. The quickfix with the "behaves-like-kubectl"-annotation works 🥳 - so actually this isn't really a bug here and this can be closed.
If there is a bug, it's that percona should be using v1beta14
to do versioning, that would work.