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

Make v1beta2 the stored version #483

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Make v1beta2 the stored version #483

merged 1 commit into from
Aug 28, 2024

Conversation

alexsnaps
Copy link
Member

@alexsnaps alexsnaps commented Aug 28, 2024

Really fixes #479

Signed-off-by: Alex Snaps <alex@wcgw.dev>
@alexsnaps alexsnaps self-assigned this Aug 28, 2024
@alexsnaps alexsnaps linked an issue Aug 28, 2024 that may be closed by this pull request
Copy link
Collaborator

@guicassolato guicassolato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification steps

Deploy without the change:

git checkout main

make local-setup FF=1

kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[0].name}'
# v1beta1
kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[0].storage}'
# true

kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[1].name}'
# v1beta2
kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[1].storage}'
# false

Create an AuthConfig (stored as v1beta1):

kubectl apply -f -<<EOF
apiVersion: authorino.kuadrant.io/v1beta2
kind: AuthConfig
metadata:
  name: talker-api-protection
spec:
  hosts:

  - talker-api.127.0.0.1.nip.io
  authentication:
    "friends":
      apiKey:
        selector:
          matchLabels:
            group: friends
      credentials:
        authorizationHeader:
          prefix: APIKEY
EOF

Watch the logs of the conversion webhook (holds the shell):

kubectl patch deployment/authorino-webhooks -n authorino-operator -p '{"spec":{"template":{"spec":{"containers":[{"name":"webhooks","args":["--log-level=debug"]}]}}}}'   

kubectl logs -f $(kubectl get pods -n authorino-operator -l authorino-component=authorino-webhooks -o name) -n authorino-operator

Request each API version and check the logs of the webhook:

kubectl get authconfigs.v1beta1.authorino.kuadrant.io/talker-api-protection
# no conversion logged by the webhook

kubectl get authconfigs.v1beta2.authorino.kuadrant.io/talker-api-protection
# 1 conversion logged by the webhook

Rollout new version:

git checkout v1beta2_fix

make install

kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[0].name}'
# v1beta1
kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[0].storage}'
# false

kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[1].name}'
# v1beta2
kubectl get crd/authconfigs.authorino.kuadrant.io -o jsonpath='{.spec.versions[1].storage}'
# true

Re-write the resource in etcd (now to be stored as v1beta2):

kubectl get authconfig/talker-api-protection -o yaml > /tmp/talker-api-protection-authconfig.yaml
kubectl apply -f /tmp/talker-api-protection-authconfig.yaml

Request each API version and check the logs of the webhook:

kubectl get authconfigs.v1beta1.authorino.kuadrant.io/talker-api-protection
# 1 conversion logged by the webhook

kubectl get authconfigs.v1beta2.authorino.kuadrant.io/talker-api-protection
# no conversion logged by the webhook

@alexsnaps alexsnaps merged commit e77520e into main Aug 28, 2024
12 checks passed
@alexsnaps alexsnaps deleted the v1beta2_fix branch August 28, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

AuthConfig v1beta2 stored in etcd
2 participants