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

Limitador CRD new field: image #133

Merged
merged 2 commits into from
May 13, 2024
Merged

Limitador CRD new field: image #133

merged 2 commits into from
May 13, 2024

Conversation

eguzki
Copy link
Contributor

@eguzki eguzki commented May 3, 2024

What

Currently, the limitador image being used in the deployment is read from different sources with some order of precedence:

  • If Limtador CR's spec.version is set -> image = quay.io/kuadrant/limitador:${spec.version} (note the repo is hardcoded)
  • if RELATED_IMAGE_LIMITADOR env var is set -> image = $RELATED_IMAGE_LIMITADOR
  • else: hardcoded to quay.io/kuadrant/limitador:latest

This PR introduces a new CRD field, spec.image that deprecates spec.version where you can set the full docker image URL. Allowing using custom docker image repos. Using private repos is not supported yet, we need to implement the pullSecret, another field where you can specify credentials to access private repos.

The spec.image field is not meant to be used in production environments. It is meant to be used for dev/testing purposes. The main drawback of the spec.image usage is that upgrades cannot be supported as the limitador operator cannot ensure the operation to be safe.

New order of precedence:

  • If Limtador CR's spec.image is set -> image = ${spec.image}
  • If Limtador CR's spec.version is set -> image = quay.io/kuadrant/limitador:${spec.version} (note the repo is hardcoded)
  • if RELATED_IMAGE_LIMITADOR env var is set -> image = $RELATED_IMAGE_LIMITADOR
  • else: hardcoded to quay.io/kuadrant/limitador:latest

Verification Steps

dev setup

make local-setup

Deploy the limitador CR with custom image URL (not from quay.io/kuadrant/limitador)

k apply -f - <<EOF
---
apiVersion: limitador.kuadrant.io/v1alpha1
kind: Limitador
metadata:
  name: limitador
spec:
  image: quay.io/eastizle/limitador:custom-image-v1
EOF

Check deployment is correct

kubectl wait --timeout=300s --for=condition=Ready limitador limitador

Should return

limitador.limitador.kuadrant.io/limitador condition met

Check command line

kubectl get deployment/limitador-limitador  -o yaml | yq '.spec.template.spec.containers[0].image'

should look like this

quay.io/eastizle/limitador:custom-image-v1

@eguzki eguzki requested a review from a team May 3, 2024 10:32
@codecov-commenter
Copy link

codecov-commenter commented May 3, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 85.18%. Comparing base (0713794) to head (10eab26).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
+ Coverage   84.94%   85.18%   +0.23%     
==========================================
  Files          19       19              
  Lines         990      992       +2     
==========================================
+ Hits          841      845       +4     
+ Misses         97       96       -1     
+ Partials       52       51       -1     
Flag Coverage Δ
integration 79.13% <60.00%> (+0.24%) ⬆️
unit 66.61% <60.00%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1alpha1 (u) 100.00% <ø> (ø)
pkg/helpers (u) 83.87% <ø> (ø)
pkg/log (u) 94.73% <ø> (ø)
pkg/reconcilers (u) 74.67% <ø> (ø)
pkg/limitador (u) 98.12% <60.00%> (-0.62%) ⬇️
controllers (i) 75.67% <ø> (+1.35%) ⬆️
pkg/upgrades 88.88% <ø> (ø)
Files Coverage Δ
api/v1alpha1/limitador_types.go 100.00% <ø> (ø)
pkg/limitador/image.go 100.00% <100.00%> (ø)
pkg/limitador/k8s_objects.go 96.85% <33.33%> (-1.03%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Contributor

@KevFan KevFan left a comment

Choose a reason for hiding this comment

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

Verified, code looks good to me 👍

@eguzki eguzki merged commit 190eea1 into main May 13, 2024
12 checks passed
@eguzki eguzki deleted the image branch May 13, 2024 18:01
@eguzki eguzki added enhancement kind/enhancement New feature or request and removed enhancement labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants