Helm chartv1.4.2App 0.10.2

Open source, general-purpose policy engine. Enforce fine-grained invariants over arbitrary Kubernetes resources.

About this chart

OPA

OPA is an open source general-purpose policy engine designed for cloud-native environments.

Prerequisites

  • Kubernetes 1.9 (or newer) for validating and mutating webhook admission controller support.
  • Optional, cert-manager (https://docs.cert-manager.io/en/latest/)

Overview

This helm chart installs OPA as a Kubernetes admission controller. Using OPA, you can enforce fine-grained invariants over arbitrary resources in your Kubernetes cluster.

Kick the tires

If you just want to see something run, install the chart without any configuration.

helm install <helm-repo>/opa

helm install stable/opa Once installed, the OPA will download a sample bundle from https://www.openpolicyagent.org. The sample bundle contains a simple policy that restricts the hostnames that can be specified on Ingress objects created in the opa-example namespace. You can download the bundle and inspect it yourself:

mkdir example && cd example
curl -s -L https://www.openpolicyagent.org/bundles/kubernetes/admission | tar xzv

See the NOTES.txt file for examples of how to exercise the admission controller.

Configuration

All configuration settings are contained and described in values.yaml.

You should set the URL and credentials for the OPA to use to download policies. The URL should identify an HTTP endpoint that implements the OPA Bundle API.

  • opa.services.controller.url specifies the base URL of the OPA control plane.

  • opa.services.controller.credentials.bearer.token specifies a bearer token for the OPA to use to authenticate with the control plane.

For more information on OPA-specific configuration see the OPA Configuration Reference.

ParameterDescriptionDefault
certManager.enabledSetup the Webhook using cert-managerfalse
admissionControllerKindType of admission controller to install.ValidatingWebhookConfiguration
admissionControllerFailurePolicyFail-open (Ignore) or fail-closed (Fail)?Ignore
admissionControllerRulesTypes of operations resources to check.*
generateAdmissionControllerCertsAuto-generate TLS certificates for admission controller.true
admissionControllerCAManually set admission controller certificate CA.Unset
admissionControllerCertManually set admission controller certificate.Unset
admissionControllerKeyManually set admission controller key.Unset
podDisruptionBudget.enabledEnables creation of a PodDisruptionBudget for OPA.false
podDisruptionBudget.minAvailableSets the minimum number of pods to be available. Cannot be set at the same time as maxUnavailable.1
podDisruptionBudget.maxUnavailableSets the maximum number of pods to be unavailable. Cannot be set at the same time as minAvailable.Unset
imageOPA image to deploy.openpolicyagent/opa
imageTagOPA image tag to deploy.See values.yaml
portPort in the pod to which OPA will bind itself.443
logLevelLog level that OPA outputs at, (debug, info or error)info
logFormatLog format that OPA produces (text or json)text
replicasNumber of admission controller replicas to deploy.1
tolerationsList of node taint tolerations.[]
nodeSelectorNode labels for pod assignment.{}
resourcesCPU and memory limits for OPA container.{}
readinessProbeHTTP readiness probe for OPA container.See values.yaml
livenessProbeHTTP liveness probe for OPA container.See values.yaml
opaOPA configuration.See values.yaml
mgmt.resourcesCPU and memory limits for the kube-mgmt container.{}
sar.resourcesCPU and memory limits for the sar container.{}

Deploy opa with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has opa on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartopa is pinned at v1.4.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply