Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
KubernetesNamespace string `json:"namespace,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
}
func CreateConfig ¶
func CreateConfig() *Config
type K8sBalancer ¶ added in v1.2.5
type K8sBalancer struct {
// contains filtered or unexported fields
}
K8sBalancer is the middleware struct It ensures sticky sessions by routing requests to the same pod using a custom header (pod-id)
func (*K8sBalancer) ServeHTTP ¶ added in v1.2.5
func (b *K8sBalancer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP handles the request and selects a pod based on the pod-id header If the pod-id is missing, it picks a random pod and assigns a new pod-id If the pod-id exists but the pod is unavailable, it selects a new one
type K8sClient ¶ added in v1.2.5
type K8sClient struct {
// contains filtered or unexported fields
}
K8sClient interacts with Kubernetes API using HTTP requests.
func NewK8sClient ¶ added in v1.2.5
NewK8sClient initializes the Kubernetes client, loads initial pod list, and starts watching changes.
func (*K8sClient) GetRandomPod ¶ added in v1.2.5
GetRandomPod returns a random pod IP.
Click to show internal directories.
Click to hide internal directories.