Skip to content

Instantly share code, notes, and snippets.

@soapergem
Last active November 30, 2023 07:40
Show Gist options
  • Save soapergem/2e54fc150a07ac52765a210e778f9ac6 to your computer and use it in GitHub Desktop.
Save soapergem/2e54fc150a07ac52765a210e778f9ac6 to your computer and use it in GitHub Desktop.
Kubernetes AdmissionReview example
{
"kind": "AdmissionReview",
"apiVersion": "admission.k8s.io/v1beta1",
"request": {
"uid": "2441cee4-352b-11e9-85be-b8975a0ca30c",
"kind": {
"group": "",
"version": "v1",
"kind": "Pod"
},
"resource": {
"group": "",
"version": "v1",
"resource": "pods"
},
"requestKind": {
"group": "",
"version": "v1",
"kind": "Pod"
},
"requestResource": {
"group": "",
"version": "v1",
"resource": "pods"
},
"namespace": "default",
"operation": "CREATE",
"userInfo": {
"username": "system:serviceaccount:kube-system:job-controller",
"uid": "f4568132-04a7-11ea-9c15-12f76ed6f379",
"groups": [
"system:serviceaccounts",
"system:serviceaccounts:kube-system",
"system:authenticated"
]
},
"object": {
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"generateName": "manual-gordon-",
"namespace": "default",
"creationTimestamp": null,
"labels": {
"batch.kubernetes.io/controller-uid": "197bd10f-5165-40d7-b36d-a5c6fc5b5024",
"batch.kubernetes.io/job-name": "manual-gordon",
"controller-uid": "197bd10f-5165-40d7-b36d-a5c6fc5b5024",
"job": "my-job",
"job-name": "manual-gordon"
},
"annotations": {
"consul.myserver.com/kv": "jobs/my_job",
"vault.myserver.com/role": "my-job",
"vault.myserver.com/secret": "jobs/my_job"
},
"ownerReferences": [
{
"apiVersion": "batch/v1",
"kind": "Job",
"name": "manual-gordon",
"uid": "197bd10f-5165-40d7-b36d-a5c6fc5b5024",
"controller": true,
"blockOwnerDeletion": true
}
],
"finalizers": [
"batch.kubernetes.io/job-tracking"
],
"managedFields": [
{
"manager": "kube-controller-manager",
"operation": "Update",
"apiVersion": "v1",
"time": "2023-11-30T06:20:38Z",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:consul.myserver.com/kv": {},
"f:vault.myserver.com/role": {},
"f:vault.myserver.com/secret": {}
},
"f:finalizers": {
".": {},
"v:\"batch.kubernetes.io/job-tracking\"": {}
},
"f:generateName": {},
"f:labels": {
".": {},
"f:batch.kubernetes.io/controller-uid": {},
"f:batch.kubernetes.io/job-name": {},
"f:controller-uid": {},
"f:job": {},
"f:job-name": {}
},
"f:ownerReferences": {
".": {},
"k:{\"uid\":\"197bd10f-5165-40d7-b36d-a5c6fc5b5024\"}": {}
}
},
"f:spec": {
"f:automountServiceAccountToken": {},
"f:containers": {
"k:{\"name\":\"my-job\"}": {
".": {},
"f:image": {},
"f:imagePullPolicy": {},
"f:name": {},
"f:resources": {},
"f:terminationMessagePath": {},
"f:terminationMessagePolicy": {}
}
},
"f:dnsPolicy": {},
"f:enableServiceLinks": {},
"f:restartPolicy": {},
"f:schedulerName": {},
"f:securityContext": {},
"f:serviceAccount": {},
"f:serviceAccountName": {},
"f:shareProcessNamespace": {},
"f:terminationGracePeriodSeconds": {}
}
}
}
]
},
"spec": {
"volumes": [
{
"name": "kube-api-access-svjx6",
"projected": {
"sources": [
{
"serviceAccountToken": {
"expirationSeconds": 3607,
"path": "token"
}
},
{
"configMap": {
"name": "kube-root-ca.crt",
"items": [
{
"key": "ca.crt",
"path": "ca.crt"
}
]
}
},
{
"downwardAPI": {
"items": [
{
"path": "namespace",
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "metadata.namespace"
}
}
]
}
}
],
"defaultMode": 420
}
}
],
"containers": [
{
"name": "my-job",
"image": "artifacts.myserver.com/docker/my-job:0.27.0",
"resources": {},
"volumeMounts": [
{
"name": "kube-api-access-svjx6",
"readOnly": true,
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
}
],
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always"
}
],
"restartPolicy": "OnFailure",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"serviceAccountName": "my-job",
"serviceAccount": "my-job",
"automountServiceAccountToken": true,
"shareProcessNamespace": true,
"securityContext": {},
"schedulerName": "default-scheduler",
"tolerations": [
{
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
},
{
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
}
],
"priority": 0,
"enableServiceLinks": true,
"preemptionPolicy": "PreemptLowerPriority"
},
"status": {}
},
"oldObject": null,
"dryRun": false,
"options": {
"kind": "CreateOptions",
"apiVersion": "meta.k8s.io/v1"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment