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

chore(tools): improve resource-gen by auto generating ws code #2466

Merged
merged 5 commits into from
Aug 3, 2021

Conversation

lahabana
Copy link
Contributor

This code was systematically created.
We generate code to make this code auto generated from protobuf annotations. It avoids users adding this code manually and ensure it's coherent.

Signed-off-by: Charly Molter charly.molter@konghq.com

@lahabana lahabana requested a review from jpeach July 30, 2021 10:13
@lahabana lahabana requested a review from a team as a code owner July 30, 2021 10:13
@lahabana lahabana force-pushed the chore/generate_definitions branch 2 times, most recently from 2887ac3 to 3558ec0 Compare July 30, 2021 11:11
This code was systematically created.
We generate code to make this code auto generated from protobuf annotations

This adds boilerplate code for the validator and tests if they don't exist already.
The goal is to make creating a new policy less cumbersome.

Signed-off-by: Charly Molter <charly.molter@konghq.com>
tools/resource-gen.go Outdated Show resolved Hide resolved
api/mesh/options.proto Outdated Show resolved Hide resolved
tools/resource-gen.go Outdated Show resolved Hide resolved
tools/resource-gen.go Outdated Show resolved Hide resolved
tools/resource-gen.go Outdated Show resolved Hide resolved
tools/resource-gen.go Outdated Show resolved Hide resolved
…efinitions

Signed-off-by: Charly Molter <charly.molter@konghq.com>
Signed-off-by: Charly Molter <charly.molter@konghq.com>
@lahabana lahabana requested a review from jpeach August 2, 2021 10:54
@lahabana
Copy link
Contributor Author

lahabana commented Aug 2, 2021

@jpeach I added what you were suggesting. It almost feels that instead of having 2 extensions there should be one with different options.

@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2021

Codecov Report

Merging #2466 (c5c75e4) into master (b2f88d7) will decrease coverage by 0.04%.
The diff coverage is 15.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2466      +/-   ##
==========================================
- Coverage   52.47%   52.43%   -0.05%     
==========================================
  Files         868      866       -2     
  Lines       48198    48249      +51     
==========================================
+ Hits        25294    25299       +5     
- Misses      20868    20912      +44     
- Partials     2036     2038       +2     
Impacted Files Coverage Δ
api/mesh/v1alpha1/circuit_breaker.pb.go 46.08% <ø> (ø)
api/mesh/v1alpha1/dataplane.pb.go 37.85% <ø> (ø)
api/mesh/v1alpha1/dataplane_insight.pb.go 41.66% <ø> (ø)
api/mesh/v1alpha1/externalservice.pb.go 51.65% <ø> (ø)
api/mesh/v1alpha1/fault_injection.pb.go 47.29% <ø> (ø)
api/mesh/v1alpha1/gateway.pb.go 33.57% <ø> (ø)
api/mesh/v1alpha1/health_check.pb.go 30.54% <ø> (ø)
api/mesh/v1alpha1/mesh.pb.go 32.60% <ø> (ø)
api/mesh/v1alpha1/mesh_insight.pb.go 33.51% <ø> (ø)
api/mesh/v1alpha1/proxy_template.pb.go 33.37% <ø> (ø)
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2f88d7...c5c75e4. Read the comment docs.

Copy link
Contributor

@jpeach jpeach left a comment

Choose a reason for hiding this comment

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

A few nit-picking comments on style. I'm find if you disagree and prefer to leave the code as is though.

Nice improvement!

api/mesh/options.proto Show resolved Hide resolved
api/mesh/options.proto Outdated Show resolved Hide resolved
api/mesh/options.proto Outdated Show resolved Hide resolved
pkg/api-server/definitions/api.go Outdated Show resolved Hide resolved
tools/resource-gen.go Show resolved Hide resolved
@jpeach
Copy link
Contributor

jpeach commented Aug 3, 2021

@jpeach I added what you were suggesting. It almost feels that instead of having 2 extensions there should be one with different options.

What did you have in mind?

…efinitions

Signed-off-by: Charly Molter <charly.molter@konghq.com>
Signed-off-by: Charly Molter <charly.molter@konghq.com>
@lahabana
Copy link
Contributor Author

lahabana commented Aug 3, 2021

Instead of having:

extend google.protobuf.MessageOptions {
  KumaResourceOptions resource = 43534533; // 'kuma'
  KumaWsOptions ws = 43534534;
  ...
}

Have:


extend google.protobuf.MessageOptions {
  KumaResourceOptions resource = 43534533; // 'kuma'
  ...
}

message KumaResourceOptions {
    Definitions defs = 1;
    Ws ws = 2;
    Kds kds = 3;
}

It seems a little simpler than have a lot of options.

@lahabana lahabana merged commit ac839aa into kumahq:master Aug 3, 2021
mergify bot pushed a commit that referenced this pull request Aug 3, 2021
This code was systematically created.
We generate code for webservices to make this code auto generated from protobuf annotations

The goal is to make creating a new policy less cumbersome.

Signed-off-by: Charly Molter <charly.molter@konghq.com>
(cherry picked from commit ac839aa)

# Conflicts:
#	pkg/api-server/definitions/all.go
#	pkg/api-server/definitions/api.go
#	pkg/api-server/definitions/circuit_breaker.go
#	pkg/api-server/definitions/dataplane.go
#	pkg/api-server/definitions/dataplane_insight.go
#	pkg/api-server/definitions/definition.go
#	pkg/api-server/definitions/external_service.go
#	pkg/api-server/definitions/fault_injection.go
#	pkg/api-server/definitions/global_secret.go
#	pkg/api-server/definitions/health_check.go
#	pkg/api-server/definitions/mesh.go
#	pkg/api-server/definitions/mesh_insight.go
#	pkg/api-server/definitions/proxytemplate.go
#	pkg/api-server/definitions/rate_limit.go
#	pkg/api-server/definitions/retry.go
#	pkg/api-server/definitions/secret.go
#	pkg/api-server/definitions/service_insight.go
#	pkg/api-server/definitions/timeout.go
#	pkg/api-server/definitions/traffic_log.go
#	pkg/api-server/definitions/traffic_permission.go
#	pkg/api-server/definitions/traffic_route.go
#	pkg/api-server/definitions/traffic_trace.go
#	pkg/api-server/definitions/zone-ingress.go
#	pkg/api-server/definitions/zone.go
#	pkg/api-server/definitions/zone_insight.go
#	pkg/api-server/server.go
lahabana added a commit that referenced this pull request Aug 4, 2021
This code was systematically created.
We generate code for webservices to make this code auto generated from protobuf annotations

The goal is to make creating a new policy less cumbersome.

Signed-off-by: Charly Molter <charly.molter@konghq.com>
(cherry picked from commit ac839aa)
lahabana pushed a commit that referenced this pull request Aug 4, 2021
…#2485)

This code was systematically created.
We generate code for webservices to make this code auto generated from protobuf annotations

The goal is to make creating a new policy less cumbersome.

Signed-off-by: Charly Molter <charly.molter@konghq.com>
(cherry picked from commit ac839aa)

Co-authored-by: Charly Molter <charly.molter@konhq.com>
@lahabana lahabana deleted the chore/generate_definitions branch March 29, 2024 12:38
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.

None yet

3 participants