k8s-ingress

module
v0.0.0-...-cc11b02 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: BSD-2-Clause

README

Varnish Ingress Controller

This is an implementation of a Kubernetes Ingress controller based on Varnish, with haproxy for TLS termination.

The present documentation presupposes familiarity with both Kubernetes and Varnish. For more information, see:

The Ingress controller currently supports Kubernetes version 1.16. The Varnish container runs version 6.3.2, and the haproxy sidecar runs 2.0.14. See the source code repository for branches and tags that support other versions.

WORK IN PROGRESS

The Ingress controller implementation is presently in development and is undergoing initial testing. Features are subject to change on short notice. Testing and feedback are nevertheless welcome, and very valuable at this early stage.

Installation

Varnish and haproxy for the purposes of Ingress run together in a Pod, and the controller that manages them runs in a separate Pod -- one controller can be used to manage a group of Pods implementing Ingress. The Dockerfiles and other files needed to build the three images are in the container/ folder, together with a Makefile that encapsulates the commands for the build.

The resulting images must then be pushed to a registry available to the Kubernetes cluster.

The Ingress can then be deployed by any of the means that are customary for Kubernetes. The deploy/ folder contains manifests (YAMLs) for some of the ways to deploy an Ingress, using tools such as kubectl. The charts/ folder contains charts for Helm deployments.

The deployment described in deploy/ targets a default setup in which the controller runs in the kube-system namespace and watches in all namespaces of the cluster for Ingresses, Services and so on that are intended for the Varnish implementation. See the instructions for single-namespace deployments if you need to limit the deployment to one namespace.

The examples/ folder contains YAMLs for Services and Ingresses to test and demonstrate the Varnish implementation and its features. You might want to begin with the "cafe" example inspired by other projects (a kind of "hello world" for Ingress).

This implementation requires that the Ingress definition includes an ingress.class Annotation specifying that its rules are to be implemented by Varnish:

kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "varnish"
[...]

The controller ignores all Ingress definitions that do not include the annotation. So you can work with other Ingress controllers that are based on other technologies in the same Kubernetes cluster.

Development

The source code for the controller, which listens to the k8s cluster API and issues commands to Varnish instances to realize Ingress definitions, is in the pkg/ and cmd/ folders. The root folder of the repo contains a Makefile defining targets that encapsulate the build process for the controller executable. See the developer doc for details.

Documentation

See the docs/ folder for technical references and more detailed discussions of various topics.

Repositories

Directories

Path Synopsis
pkg
apis
Package varnishingress is the client API for the API group ingress.varnish-cache.org, used to define Custom Resources for the Varnish ingress project.
Package varnishingress is the client API for the API group ingress.varnish-cache.org, used to define Custom Resources for the Varnish ingress project.
apis/varnishingress
Package varnishingress is the client API for the API group ingress.varnish-cache.org, used to define Custom Resources for the Varnish ingress project.
Package varnishingress is the client API for the API group ingress.varnish-cache.org, used to define Custom Resources for the Varnish ingress project.
apis/varnishingress/v1alpha1
Package v1alpha1 is a version of the client API for CustomResource types defined for the Varnish Ingress project.
Package v1alpha1 is a version of the client API for CustomResource types defined for the Varnish Ingress project.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/varnishingress/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/varnishingress/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
controller
Package controller provides access to the k8s server API and drives the main loops of the Ingress controller.
Package controller provides access to the k8s server API and drives the main loops of the Ingress controller.
interfaces
Package interfaces defines interfaces that allow pkg/controller and pkg/varnish to access code from one another without introducing import cycles.
Package interfaces defines interfaces that allow pkg/controller and pkg/varnish to access code from one another without introducing import cycles.
update
Package update defines the Status type, which classifies the result of a synchronization operation by the controller.
Package update defines the Status type, which classifies the result of a synchronization operation by the controller.
varnish
Package varnish encapsulates interaction with Varnish instances to transform desired states from Ingress and VarnishConfig configs to the actual state of the cluster.
Package varnish encapsulates interaction with Varnish instances to transform desired states from Ingress and VarnishConfig configs to the actual state of the cluster.
varnish/vcl
Package vcl encapsulates representations of a VCL configuration derived from Ingress and VarnishConfig specifications, and checking the representations for equivalence (to check if new syncs are necessary).
Package vcl encapsulates representations of a VCL configuration derived from Ingress and VarnishConfig specifications, and checking the representations for equivalence (to check if new syncs are necessary).

Jump to

Keyboard shortcuts

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