curl --request PUT \
--url https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"drift_prevention": true
}
'import requests
url = "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission"
payload = {
"enabled": True,
"drift_prevention": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true, drift_prevention: true})
};
fetch('https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission"
payload := strings.NewReader("{\n \"enabled\": true,\n \"drift_prevention\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Configure a cluster's admission control
Two independent settings, and they are deliberately not one.
mode is what a workload that FAILS its checks gets. TRUSTIVAN reads
the pod spec the request would create and the open findings of every
image it runs. The pod spec goes through the same decoder and the
same catalogue a cluster collection uses (its workload and container
checks; namespace and RBAC checks have no subject at admission).
audit: admitted, and recorded. Nothing reaches the developer.warn: admitted, with every problem shown as a warning in the developer’skubectloutput. The default, so a cluster that enables admission gains visibility rather than an outage.deny: REFUSED, naming the blocking problems. A check of medium severity or above blocks, as does an image with an open critical or high finding; low-severity checks (a mutable tag, a missing limit, a writable root filesystem) and an image TRUSTIVAN has never scanned are shown and never block.
An unrecognised mode is REFUSED rather than defaulted, for the same
reason an unrecognised failure_mode is.
failure_mode decides what happens to your cluster when TRUSTIVAN
cannot answer at all.
closed (the default for a newly connected cluster) REFUSES a
workload when TRUSTIVAN cannot adjudicate. The shipped webhook
configuration (infra/helm/trustivan-admission) uses
failurePolicy: Fail to match and exempts kube-system and its own
namespace, so the control plane and the fix for an outage can still
deploy. Clusters connected before this default changed keep the mode
they had.
open is the documented opt-out: it ADMITS a workload when TRUSTIVAN
cannot adjudicate, records it and logs it at error level. Set the
chart’s failurePolicy: Ignore to match.
A review for a cluster TRUSTIVAN does not know is admitted with a warning whatever the default: there is no tenant setting to apply.
An unrecognised failure_mode is REFUSED rather than silently
defaulted.
drift_prevention (boolean, optional; absent leaves it unchanged)
adds a BLOCKING violation for every container whose
securityContext.readOnlyRootFilesystem is not true, so in deny
mode nothing can be written into an image’s filesystem after it
starts. Volumes (an emptyDir) stay writable; the runtime rules for
execution from temporary directories and of binaries not in the image
cover them.
Behind credentials:manage, because choosing fail-closed is the same
class of decision as choosing what a tenant’s scans authenticate to.
curl --request PUT \
--url https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"drift_prevention": true
}
'import requests
url = "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission"
payload = {
"enabled": True,
"drift_prevention": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true, drift_prevention: true})
};
fetch('https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/kubernetes/clusters/{id}/admission"
payload := strings.NewReader("{\n \"enabled\": true,\n \"drift_prevention\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Body
Response
The settings now in force, with a note restating what the failure mode means.