Skip to content

Instantly share code, notes, and snippets.

@danehans
Last active December 17, 2020 19:22
Show Gist options
  • Save danehans/647e9dd22d503c0b6192eb2b24cfffb1 to your computer and use it in GitHub Desktop.
Save danehans/647e9dd22d503c0b6192eb2b24cfffb1 to your computer and use it in GitHub Desktop.
contour_operator_blog_content

Contour Operator

FEATURE STATE: Contour v1.11.0 alpha

Contour Operator provides a method for packaging, deploying, and managing Contour. The operator extends the functionality of the Kubernetes API to create, configure, and manage instances of Contour on behalf of users. It builds upon the basic Kubernetes resource and controller concepts, but includes domain-specific knowledge to automate the entire lifecycle of Contour.

In Kubernetes, controllers of the control-plane implement control loops that repeatedly compare the desired state of the cluster to its actual state. If the cluster's actual state doesn’t match the desired state, then the controller takes action to fix the problem. Contour Operator is a custom Kubernetes controller that uses the Contour custom resource (CR) to manage Contour and its dependent components, i.e. the Envoy DaemonSet. The contours.operator.projectcontour.io Custom Resource Definition (CRD) defines the Contour CR. A Contour is handled by the Kubernetes API just like built-in objects, including interaction via kubectl and inclusion in role-based access control (RBAC) policies. The following example runs an instance of Contour in namespace projectcontour with 2 Deployment replicas:

cat <<EOF | kubectl apply -f -
apiVersion: operator.projectcontour.io/v1alpha1
kind: Contour
metadata:
  name: contour-sample
spec: {}
EOF

No configuration, i.e. spec, is provided since projectcontour is the default namespace and 2 is the default number of replicas for a Contour. The default parameters of the Contour can be verified in the same way as any other Kubernetes resource:

$ kubectl get contour/contour-sample -o yaml
apiVersion: operator.projectcontour.io/v1alpha1
kind: Contour
metadata:
  name: contour-sample
  namespace: default
...
spec:
  namespace:
    name: projectcontour
    removeOnDeletion: false
  replicas: 2
...

Contour Operator continues to monitor the Contour CR and provides status on whether the actual state matches the desired state. The following example indicates the Contour is available:

$ kubectl get contour/contour-sample
NAME             READY   REASON
contour-sample   True    ContourAvailable

The Contour is now ready to start serving Ingress and HTTPProxy resources.

Check out the Getting Started guide to learn how to start managing Contour using the operator. Learn more about the planned features of Contour Operator by reviewing the GitHub Issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment