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

kuadrant gateway controller to annotate gateways #260

Merged
merged 5 commits into from
Oct 2, 2023

Conversation

eguzki
Copy link
Contributor

@eguzki eguzki commented Sep 27, 2023

What

Fixes #259

Custom controller to add the kuadrant annotation to every new gateway deployed after Kuadrant CR has been created.

It does not reconcile the annotation value. If there is an annotation with the expected key kuadrant.io/namespace

Fixed codecov configuration.

❯ cat .github/codecov.yaml | curl --data-binary @- https://codecov.io/validate
Valid!

Verification Steps

  • Setup the environment:
make local-setup         

Checking the annotations of the istio-ingressgateway gateway

❯ k get gateways istio-ingressgateway -n istio-system -o jsonpath='{.metadata.annotations}' | yq e 'keys' -P

It does not have any kuadrant namespace annotation

- kubectl.kubernetes.io/last-applied-configuration

Request an instance of Kuadrant:

kubectl -n kuadrant-system apply -f - <<EOF
apiVersion: kuadrant.io/v1beta1
kind: Kuadrant
metadata:
  name: kuadrant
spec: {}
EOF

The istio istio-ingressgateway gateway, should be annotated with the kuadrant annotation

❯ k get gateways istio-ingressgateway -n istio-system -o jsonpath='{.metadata.annotations}' | yq e 'keys' -P
- kuadrant.io/namespace
- kubectl.kubernetes.io/last-applied-configuration

Create a new gateway

kubectl -n kuadrant-system apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: second
spec:
  gatewayClassName: istio
  listeners:
    - allowedRoutes:
        namespaces:
          from: All
      hostname: '*.example.com'
      name: api
      port: 80
      protocol: HTTP
EOF

Note that the gateway does not have kuadrant annotation

The new gateway second gateway, should be annotated with the kuadrant annotation

❯ k get gateways second -n kuadrant-system -o jsonpath='{.metadata.annotations}' | yq e 'keys' -P
- kuadrant.io/namespace
- kubectl.kubernetes.io/last-applied-configuration

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #260 (833c448) into main (1eb8bdb) will decrease coverage by 0.26%.
The diff coverage is 79.71%.

@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
- Coverage   63.85%   63.60%   -0.26%     
==========================================
  Files          32       33       +1     
  Lines        3135     3204      +69     
==========================================
+ Hits         2002     2038      +36     
- Misses        970      993      +23     
- Partials      163      173      +10     
Flag Coverage Δ
integration 69.99% <79.71%> (-0.83%) ⬇️
unit 57.52% <ø> (ø)

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

Components Coverage Δ
api/v1beta1 (u) ∅ <ø> (∅)
pkg/common (u) 75.90% <ø> (ø)
pkg/istio (u) 30.24% <ø> (ø)
pkg/log (u) 31.81% <ø> (ø)
pkg/reconcilers (u) 33.68% <ø> (ø)
pkg/rlptools (u) 57.63% <ø> (ø)
controllers (i) 69.99% <79.71%> (-0.83%) ⬇️
Files Coverage Δ
controllers/gateway_kuadrant_controller.go 79.71% <79.71%> (ø)

... and 5 files with indirect coverage changes

@eguzki eguzki marked this pull request as ready for review September 28, 2023 13:38
@eguzki eguzki requested a review from a team as a code owner September 28, 2023 13:38
@eguzki eguzki added this to the v0.5.0 milestone Sep 28, 2023
@eguzki eguzki changed the title kuadrant gateway controller kuadrant gateway controller to annotate gateways Sep 28, 2023
Threshold: Allow the coverage to drop by X%, and posting a success status.
status:
project:
default:
threshold: 1%
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @andrewdavidmackenzie

Allow the coverage to drop by X%, and posting a success status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW new patch coverage raised up to 79.71%

Choose a reason for hiding this comment

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

Sounds good. Variability in test sampling can cause the % to vary a little (you can also specify the number of digits of rounding to do before comparing BTW), causing it to drop a little (with same code and tests) and fail - so this guards against that.

Choose a reason for hiding this comment

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

e.g.

coverage:
  round: up
  precision: 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL: codecov target

target

auto | <number>
Choose a minimum coverage ratio that the commit must meet to be considered a success.

    auto will use the coverage from the base commit (pull request base or parent commit) coverage to compare against.
    <number> you can specify a target of an exact coverage number such as 75% or 100% (string, int, or float accepted).

target is the minimum coverage ratio that the commit must meet to be considered a success.
@eguzki eguzki merged commit a012052 into main Oct 2, 2023
@eguzki eguzki deleted the kuadrant-gateway-controller branch October 2, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: To test
Development

Successfully merging this pull request may close these issues.

RateLimitPolicy Gateway needs to be created before Kuadrant resource
3 participants