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

support invalid limits configmap #54

Merged
merged 1 commit into from
Oct 14, 2022
Merged

support invalid limits configmap #54

merged 1 commit into from
Oct 14, 2022

Conversation

eguzki
Copy link
Contributor

@eguzki eguzki commented Oct 10, 2022

what

If the limits config map, for whatever reason, does not have a valid content to be parsed into a limits array, the operator fails to reconcile and cannot recover. This fix, is to handle that error. So if a invalid content is found, revert to desired content.

verification steps

dev setup

make local-setup

Deploy the limitador CR

k apply -f - <<EOF
---
apiVersion: limitador.kuadrant.io/v1alpha1
kind: Limitador
metadata:
  name: limitador-sample
spec:
  limits:
    - conditions: ["get_toy == 'yes'"]
      max_value: 2
      namespace: toystore-app
      seconds: 30
      variables: []
EOF

Check that the limits config map content

k get configmaps limits-config-limitador-sample -o jsonpath='{.data}' | yq e -P
limitador-config.yaml: |
  - conditions:
    - get_toy == 'yes'
    max_value: 2
    namespace: toystore-app
    seconds: 30
    variables: []

Now, try to change it manually. Add some invalid content

k patch configmaps limits-config-limitador-sample --type merge --patch '{"data":{"limitador-config.yaml": "my own stuff"}}'

The operator should read the invalid content, and revert the changes back to the desired limits.

k get configmaps limits-config-limitador-sample -o jsonpath='{.data}' | yq e -P
limitador-config.yaml: |
  - conditions:
    - get_toy == 'yes'
    max_value: 2
    namespace: toystore-app
    seconds: 30
    variables: []

@eguzki eguzki force-pushed the fix-owner-reference-type branch from 3ab6302 to 7acc5e8 Compare October 10, 2022 14:51
@eguzki eguzki force-pushed the support-invalid-configmap branch from 14ad42a to 804ab42 Compare October 10, 2022 14:55
@eguzki eguzki changed the base branch from fix-owner-reference-type to replica-reconciliation October 10, 2022 14:55
@eguzki eguzki force-pushed the replica-reconciliation branch from f98da94 to 56042a5 Compare October 13, 2022 08:37
@eguzki eguzki force-pushed the support-invalid-configmap branch from 804ab42 to 43b01b4 Compare October 13, 2022 08:37
@eguzki eguzki force-pushed the replica-reconciliation branch from 56042a5 to 9a9a293 Compare October 13, 2022 13:11
@eguzki eguzki force-pushed the support-invalid-configmap branch from 43b01b4 to 6fc127c Compare October 13, 2022 13:13
@eguzki eguzki marked this pull request as ready for review October 13, 2022 13:13
@eguzki eguzki force-pushed the replica-reconciliation branch from 9a9a293 to e093a63 Compare October 14, 2022 13:49
Base automatically changed from replica-reconciliation to main October 14, 2022 14:27
@eguzki eguzki force-pushed the support-invalid-configmap branch from 6fc127c to d1f6241 Compare October 14, 2022 14:28
@eguzki eguzki merged commit f929e31 into main Oct 14, 2022
@eguzki eguzki deleted the support-invalid-configmap branch October 14, 2022 14:35
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

Successfully merging this pull request may close these issues.

2 participants