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

feat: make multiple controllers handle different ApisixRoute CRDs #593

Merged
merged 28 commits into from Mar 22, 2023

Conversation

Donghui0
Copy link
Contributor

@Donghui0 Donghui0 commented Jul 15, 2021

Please answer these questions before submitting a pull request



New feature or improvement

make multiple controllers handle different ApisixRoute CRDs


Backport patches

  • Why need to backport?

  • Source branch

  • Related commits and pull requests

  • Target branch

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2021

Codecov Report

Merging #593 (1ca7df9) into master (6e22838) will not change coverage.
The diff coverage is n/a.

❗ Current head 1ca7df9 differs from pull request most recent head c8456e2. Consider uploading reports for the commit c8456e2 to get more accurate results

@@           Coverage Diff           @@
##           master     #593   +/-   ##
=======================================
  Coverage   41.69%   41.69%           
=======================================
  Files          90       90           
  Lines        7702     7702           
=======================================
  Hits         3211     3211           
  Misses       4127     4127           
  Partials      364      364           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

cmd/ingress/ingress.go Outdated Show resolved Hide resolved
@gxthrj
Copy link
Contributor

gxthrj commented Jul 16, 2021

Here is an issue related

@Donghui0 Donghui0 requested a review from tokers July 30, 2021 09:23
@@ -143,8 +143,7 @@ the apisix cluster and others are created`,
cmd.PersistentFlags().StringVar(&cfg.Kubernetes.Kubeconfig, "kubeconfig", "", "Kubernetes configuration file (by default in-cluster configuration will be used)")
cmd.PersistentFlags().DurationVar(&cfg.Kubernetes.ResyncInterval.Duration, "resync-interval", time.Minute, "the controller resync (with Kubernetes) interval, the minimum resync interval is 30s")
cmd.PersistentFlags().StringSliceVar(&cfg.Kubernetes.AppNamespaces, "app-namespace", []string{config.NamespaceAll}, "namespaces that controller will watch for resources")
cmd.PersistentFlags().StringVar(&cfg.Kubernetes.IngressClass, "ingress-class", config.IngressClass, "the class of an Ingress object is set using the field IngressClassName in Kubernetes clusters version v1.18.0 or higher or the annotation \"kubernetes.io/ingress.class\" (deprecated)")
cmd.PersistentFlags().StringVar(&cfg.Kubernetes.ApisixRouteClass, "apisix-route-class", config.ApisixRouteClass, "the class of an ApisixRoute object is set using the field ApisixRouteClassName in Kubernetes")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a big broken change, we need some discussions in the mailing list.

@@ -39,7 +39,8 @@ type ApisixRoute struct {

// ApisixRouteSpec is the spec definition for ApisixRouteSpec.
type ApisixRouteSpec struct {
Rules []Rule `json:"rules,omitempty" yaml:"rules,omitempty"`
IngressClass string `json:"ingressClass,omitempty" yaml:"ingressClass,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

} else if ar.GroupVersion() == kube.ApisixRouteV2beta1 {
class = ar.V2beta1().Spec.IngressClassName
} else {
class = c.controller.cfg.Kubernetes.IngressClass
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually the else won't be entered, once the logic here was executed, then there are some programming faults occurred, we may just:

  1. Panic, or
  2. log the error and just return false.

@tao12345666333 tao12345666333 added this to In progress in roadmap Mar 4, 2022
@tao12345666333
Copy link
Member

Thanks for your contribution,
Please resolve the conflict if you have time,
let's move forward.

@tao12345666333
Copy link
Member

Yesterday I had an online meeting with @Donghui0 and @Gallardot.
After discussion, we will use this PR instead of #1523, and @Donghui0 will complete this PR.

I've just resolved the code merge conflict in this PR.

For some basic technical solutions can refer to #1523 (comment)

I will also submit a more complete description at #592 later

Thank you all!

@tao12345666333 tao12345666333 changed the title feat: make multiple controllers handle different ApisixRoute CRDs #578 feat: make multiple controllers handle different ApisixRoute CRDs Feb 20, 2023
@tao12345666333 tao12345666333 added this to the v1.7.0 milestone Feb 20, 2023
@tao12345666333 tao12345666333 requested review from tokers and removed request for tokers February 24, 2023 09:17
@tao12345666333
Copy link
Member

@Donghui0 Please see #592 (comment)
I have added more details.

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

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

And please add e2e test cases to cover this change. Thanks

Comment on lines 47 to 49
IngressClassName string `json:"ingressClassName,omitempty" yaml:"ingressClassName,omitempty"`
HTTP []ApisixRouteHTTP `json:"http,omitempty" yaml:"http,omitempty"`
Stream []ApisixRouteStream `json:"stream,omitempty" yaml:"stream,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to change the v2beta3 resource.

Comment on lines 541 to 542
case config.ApisixV2beta3:
icn = ar.V2beta3().Spec.IngressClassName
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

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

Please resolve the conflicts, thanks

go.mod Outdated
Comment on lines 31 to 35
require (
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
)

Copy link
Member

Choose a reason for hiding this comment

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

you don't need to change this one. right?

@tao12345666333
Copy link
Member

CI fails, I think @AlinsRan can help. PTAL

Copy link
Member

@Gallardot Gallardot left a comment

Choose a reason for hiding this comment

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

LGTM

go.mod Outdated
@@ -67,6 +67,8 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.9.0 // indirect
github.com/onsi/gomega v1.27.1 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

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

These two dependencies are redundant and will only be used in e2e. Let me remove them.

@tao12345666333 tao12345666333 merged commit c6dd810 into apache:master Mar 22, 2023
53 checks passed
@Donghui0 Donghui0 deleted the feat-routeclass branch April 3, 2023 08:24
@tao12345666333 tao12345666333 moved this from In progress to Done in roadmap Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

8 participants