Code Monkey home page Code Monkey logo

Comments (8)

xxx7xxxx avatar xxx7xxxx commented on June 12, 2024

Can you post the log of the ingress controller pod, and is there any error that occurred?

from easegress.

suchen-sci avatar suchen-sci commented on June 12, 2024

Hi, easegress ingress controller implements the standard of k8s ingress controller. So, the globalFilter is not support yet.

But i have just checked the code and find it seems simple to add this feature.

func newHTTPServerSpecBuilder(template *httpserver.Spec) *httpServerSpecBuilder {
	return &httpServerSpecBuilder{
		Kind: httpserver.Kind,
		Name: "http-server-ingress-controller",
		Spec: httpserver.Spec{
			Port:             template.Port,
			KeepAlive:        template.KeepAlive,
			HTTPS:            template.HTTPS,
			KeepAliveTimeout: template.KeepAliveTimeout,
			MaxConnections:   template.MaxConnections,
		},
	}
}

the problem is when create builder for httpserver in ingress controller, template.GlobalFilter is not copied. And since GlobalFilter is a business controller, httpserver in ingress controller namespace can get it.

What do you think @xxx7xxxx? I can't see why we not support this feature?

from easegress.

tjqc0512 avatar tjqc0512 commented on June 12, 2024

Can you post the log of the ingress controller pod, and is there any error that occurred?

The logs do not show any exceptions, but the traffic is not passing through the global filter.
2024-03-13T09:38:46.998Z DEBUG httpserver/mux.go:395 http-server-ingress-controller: the matched backend(Pipeline) for [POST /WF_BEIJING] is "pipeline-ingress-easegress-hello-service-60001"
[2024-03-13T09:38:46.998Z] [10.42.0.1:63350 10.42.0.1 POST /WF_BEIJING HTTP/1.1 200] [8.92ms rx:640B tx:186B] [status code: 200 | pipeline(pipeline-ingress-easegress-hello-service-60001): proxy(6.868ms) | proxy#proxy#main#duration: 8.383ms]

from easegress.

xxx7xxxx avatar xxx7xxxx commented on June 12, 2024

Sure, we could support it by adding the copy line, and a profound solution would be adding a general HTTPServerSpeBuilder for all of them. @tjqc0512 Do you want to address this issue?

➜  easegress  rg newHTTPServerSpecBuilder
pkg/object/gatewaycontroller/translator.go
289:func newHTTPServerSpecBuilder(name string) *httpServerSpecBuilder {
590:    sb := newHTTPServerSpecBuilder(fmt.Sprintf("http-server-%s-%s", g.Name, l.Name))

pkg/object/meshcontroller/worker/egress.go
101:func newHTTPServerSpecBuilder(httpServerName string, spec *httpserver.Spec) *httpServerSpecBuilder {
526:    builder := newHTTPServerSpecBuilder(egs.egressServerName, httpServerSpec)

pkg/object/function/worker/ingress.go
99:func newHTTPServerSpecBuilder(controllerName string) *httpServerSpecBuilder {
194:    builder := newHTTPServerSpecBuilder(ings.superSpec.Name())
212:    builder := newHTTPServerSpecBuilder(ings.superSpec.Name())

pkg/object/ingresscontroller/translator.go
174:func newHTTPServerSpecBuilder(template *httpserver.Spec) *httpServerSpecBuilder {
482:    b := newHTTPServerSpecBuilder(st.httpSvrCfg)

from easegress.

tjqc0512 avatar tjqc0512 commented on June 12, 2024

Hi, easegress ingress controller implements the standard of k8s ingress controller. So, the is not support yet.globalFilter

But i have just checked the code and find it seems simple to add this feature.

func newHTTPServerSpecBuilder(template *httpserver.Spec) *httpServerSpecBuilder {
	return &httpServerSpecBuilder{
		Kind: httpserver.Kind,
		Name: "http-server-ingress-controller",
		Spec: httpserver.Spec{
			Port:             template.Port,
			KeepAlive:        template.KeepAlive,
			HTTPS:            template.HTTPS,
			KeepAliveTimeout: template.KeepAliveTimeout,
			MaxConnections:   template.MaxConnections,
		},
	}
}

the problem is when create builder for httpserver in ingress controller, is not copied. And since is a business controller, httpserver in ingress controller namespace can get it.template.GlobalFilter``GlobalFilter

What do you think @xxx7xxxx? I can't see why we not support this feature?

Sure, I appreciate your guidance. I'll try modifying this feature and rebuild the easegress-server for testing. Additionally, I have a question regarding how to print logs or output logs to a file for a custom-developed filter. Currently, I'm using the github.com/megaease/easegress/pkg/logger library for logging, but it's not outputting logs as expected, for example, logger.Warnf("RsaAuthFilter: 'X-Custom-WF-Name' header is not a string"). I've also tried solutions I found through searching, but none have been successful.

from easegress.

xxx7xxxx avatar xxx7xxxx commented on June 12, 2024

but it's not outputting logs as expected

What's the detail? Does it print all logs except for the log you added? It can't be.

from easegress.

tjqc0512 avatar tjqc0512 commented on June 12, 2024

but it's not outputting logs as expected

What's the detail? Does it print all logs except for the log you added? It can't be.

I am unable to print and output logs for all operations within my custom filter. I don't know how to implement printing and outputting logs for debugging purposes.

from easegress.

xxx7xxxx avatar xxx7xxxx commented on June 12, 2024

I don't know the reason. If other filters can print logs, yours can not be the exception. Do you register your filter in source code and make it sure that it has run? Or Just panic in your code to assert that your code has been executed.

from easegress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.