controller

package module
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 23 Imported by: 0

README

parapet-ingress-controller

Build Status codecov Go Report Card

Parapet Ingress Controller use parapet framework to create Kubernetes ingress controller.

Deploy

See deploy config at deploy directory.

Usage

Create ingress with ingressClassName: parapet

Example
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    parapet.moonrhythm.io/hsts: preload
    parapet.moonrhythm.io/redirect: |
      example.com: https://www.example.com
    parapet.moonrhythm.io/redirect-https: "true"
  name: ingress
spec:
  ingressClassName: parapet
  rules:
  - host: www.example.com
    http:
      paths:
      - backend:
          service:
            name: example
            port:
              name: http
      - path: /assets/
        backend:
          service:
            name: gcs
            port:
              name: https
  - host: api.example.com
    http:
      paths:
      - backend:
          service:
            name: api-example
            port:
              name: http
  tls:
  - secretName: tls-www
  - secretName: tls-api

Plugins

Plugins use annotation in ingress to config.

See supported annotations in plugin directory.

Metrics

Parapet ingress controller support prometheus metrics by add prometheus annotations to pod template.

annotations:
  prometheus.io/port: "9187"
  prometheus.io/scrape: "true"
Supported Metrics
Ingress Metrics
  • parapet_requests{host, status, method, ingress_name, ingress_namespace, service_type, service_name}
  • parapet_backend_connections{addr}
  • parapet_backend_network_read_bytes{addr}
  • parapet_backend_network_write_bytes{addr}
  • parapet_reload{success}
  • parapet_host_ratelimit_requests{host}
  • parapet_host_active_requests{host, upgrade}
Metrics directly use from parapet
  • parapet_connections{state}
  • parapet_network_request_bytes{}
  • parapet_network_response_bytes{}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IngressClass = "parapet"

IngressClass to load ingresses

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the parapet ingress controller

func New

func New(watchNamespace string, proxy *proxy.Proxy) *Controller

New creates new ingress controller

func (*Controller) GetCertificate

func (ctrl *Controller) GetCertificate(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error)

func (*Controller) Healthz

func (ctrl *Controller) Healthz() parapet.Middleware

Healthz returns health check middleware

func (*Controller) ServeHandler

func (ctrl *Controller) ServeHandler(_ http.Handler) http.Handler

ServeHandler implements parapet.Middleware

func (*Controller) Use

func (ctrl *Controller) Use(m plugin.Plugin)

Use appends a plugin

func (*Controller) Watch

func (ctrl *Controller) Watch()

Watch starts watch k8s resource

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL