Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRDs v3alpha1 are stored as v2 even for new installations #5724

Open
sharkymcdongles opened this issue Jul 18, 2024 · 2 comments
Open

CRDs v3alpha1 are stored as v2 even for new installations #5724

sharkymcdongles opened this issue Jul 18, 2024 · 2 comments

Comments

@sharkymcdongles
Copy link

It is quite confusing to need to have a pod to translate between the versions then when you do get on anything it is v2 despite applying v3alpha1. Any idea what can be done?

@cindymullins-dw
Copy link
Contributor

Hi @sharkymcdongles , We recently released a video on this topic, which is available here.

Kubernetes allows us only one storage version so all the CRDs are stored as v2 in the API server and apiext handles the translation between v2 and v3alpha1. This was done to enable a zero downtime migration between Emissary v1.x and v2.x and allow us to make more drastic CRD changes to improve the user experience writing manifests without having to worry about users not being able to migrate without manually updating all of their manifests. Please note that even if you are using v3alpha1 CRDs exclusively, apiext must always be running for all versions of Edge-Stack 2.2+.  It is not possible to disable ‘apiext’.

Here are some notes on how to check for your applied CRD version.

If you run kubectl get mapping/host -o yaml you should see that the api server returns a v2 CRD even if you applied it as a v3alpha1.

If you applied a Mapping/etc. as v3alpha1 it should look like this:
apiVersion: getambassador.io/v2
kind: Mapping
metadata:
  name: grafana
  namespace: defaulta
spec:
  ambassador_id:
  - --apiVersion-v3alpha1-only--default
  prefix: /grafana/
  service: grafana
The designation --apiVersion-v3alpha1-only is automatically added whenever the CRD is being retrieved in v2 format like above.

If you run kubectl get mappings.v3alpha1.getambassador.io grafana -o yaml to ask the API server for the v3alpha1 version of the above CRD (it has to convert it up from v2 since that is how it is stored), then you can see it automatically notices the --apiVersion-v3alpha1-only and removes it:

apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
  name: grafana
  namespace: default
spec:
  ambassador_id:
  - default
  hostname: '*'
  prefix: /grafana/
  service: grafana

If you applied the CRD as a v2 then it won't have the apiVersion-v3alpha1 in the Ambassador ID

@kflynn
Copy link
Member

kflynn commented Jul 22, 2024

Actually we should probably back up a moment. @sharkymcdongles, are you running Emissary or Edge Stack?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants