mirror of
https://github.com/hanzoai/ingress.git
synced 2026-10-26 02:47:15 +00:00
- CRD API group: traefik.io -> hanzo.ai (GroupName, apiVersion, RBAC)
- Docker/provider label prefix: traefik.* -> ingress.* (all providers)
- CRD kind: TraefikService -> IngressService
- Directory renames: traefikio/ -> hanzoai/ (types, generated code, listers, informers, clientset)
- Config root name: traefik -> ingress (KV stores, file paths, env prefix)
- Metrics prefix: traefik_ -> ingress_
- Kubernetes annotations: traefik.ingress.kubernetes.io/ -> ingress.kubernetes.io/
- Gateway annotations: traefik.io/ -> hanzo.ai/
- Internal provider package: provider/traefik -> provider/builtins
- Type renames: TraefikLog -> IngressLog, TraefikCmdConfiguration -> IngressCmdConfiguration
- Generated client methods: TraefikV1alpha1() -> HanzoV1alpha1(), Traefik() -> Hanzo()
- Sample configs: traefik.sample.{toml,yml} -> ingress.sample.{toml,yml}
- Config paths: /etc/traefik/ -> /etc/ingress/, ~/.config/traefik -> ~/.config/ingress
- Default cert CN: TRAEFIK DEFAULT CERT -> INGRESS DEFAULT CERT
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package ping
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
// Handler expose ping routes.
|
|
type Handler struct {
|
|
EntryPoint string `description:"EntryPoint" json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"`
|
|
ManualRouting bool `description:"Manual routing" json:"manualRouting,omitempty" toml:"manualRouting,omitempty" yaml:"manualRouting,omitempty" export:"true"`
|
|
TerminatingStatusCode int `description:"Terminating status code" json:"terminatingStatusCode,omitempty" toml:"terminatingStatusCode,omitempty" yaml:"terminatingStatusCode,omitempty" export:"true"`
|
|
terminating bool
|
|
}
|
|
|
|
// SetDefaults sets the default values.
|
|
func (h *Handler) SetDefaults() {
|
|
h.EntryPoint = "ingress"
|
|
h.TerminatingStatusCode = http.StatusServiceUnavailable
|
|
}
|
|
|
|
// WithContext causes the ping endpoint to serve non 200 responses.
|
|
func (h *Handler) WithContext(ctx context.Context) {
|
|
go func() {
|
|
<-ctx.Done()
|
|
h.terminating = true
|
|
}()
|
|
}
|
|
|
|
func (h *Handler) ServeHTTP(response http.ResponseWriter, request *http.Request) {
|
|
statusCode := http.StatusOK
|
|
if h.terminating {
|
|
statusCode = h.TerminatingStatusCode
|
|
}
|
|
response.WriteHeader(statusCode)
|
|
fmt.Fprint(response, http.StatusText(statusCode))
|
|
}
|