AdmissionConfiguration v1 (#17548)
This commit is contained in:
committed by
Bob Killen
parent
1bdaa20400
commit
a8020b6275
@@ -172,7 +172,20 @@ event requests. The cluster admin can specify event rate limits by:
|
|||||||
* Referencing an `EventRateLimit` configuration file from the file provided to the API
|
* Referencing an `EventRateLimit` configuration file from the file provided to the API
|
||||||
server's command line flag `--admission-control-config-file`:
|
server's command line flag `--admission-control-config-file`:
|
||||||
|
|
||||||
|
{{< tabs name="eventratelimit_example" >}}
|
||||||
|
{{% tab name="apiserver.config.k8s.io/v1" %}}
|
||||||
```yaml
|
```yaml
|
||||||
|
apiVersion: apiserver.config.k8s.io/v1
|
||||||
|
kind: AdmissionConfiguration
|
||||||
|
plugins:
|
||||||
|
- name: EventRateLimit
|
||||||
|
path: eventconfig.yaml
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab name="apiserver.k8s.io/v1alpha1" %}}
|
||||||
|
```yaml
|
||||||
|
# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1
|
||||||
apiVersion: apiserver.k8s.io/v1alpha1
|
apiVersion: apiserver.k8s.io/v1alpha1
|
||||||
kind: AdmissionConfiguration
|
kind: AdmissionConfiguration
|
||||||
plugins:
|
plugins:
|
||||||
@@ -180,6 +193,8 @@ plugins:
|
|||||||
path: eventconfig.yaml
|
path: eventconfig.yaml
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
There are four types of limits that can be specified in the configuration:
|
There are four types of limits that can be specified in the configuration:
|
||||||
|
|
||||||
@@ -240,7 +255,20 @@ imagePolicy:
|
|||||||
|
|
||||||
Reference the ImagePolicyWebhook configuration file from the file provided to the API server's command line flag `--admission-control-config-file`:
|
Reference the ImagePolicyWebhook configuration file from the file provided to the API server's command line flag `--admission-control-config-file`:
|
||||||
|
|
||||||
|
{{< tabs name="imagepolicywebhook_example1" >}}
|
||||||
|
{{% tab name="apiserver.config.k8s.io/v1" %}}
|
||||||
```yaml
|
```yaml
|
||||||
|
apiVersion: apiserver.config.k8s.io/v1
|
||||||
|
kind: AdmissionConfiguration
|
||||||
|
plugins:
|
||||||
|
- name: ImagePolicyWebhook
|
||||||
|
path: imagepolicyconfig.yaml
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab name="apiserver.k8s.io/v1alpha1" %}}
|
||||||
|
```yaml
|
||||||
|
# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1
|
||||||
apiVersion: apiserver.k8s.io/v1alpha1
|
apiVersion: apiserver.k8s.io/v1alpha1
|
||||||
kind: AdmissionConfiguration
|
kind: AdmissionConfiguration
|
||||||
plugins:
|
plugins:
|
||||||
@@ -248,22 +276,44 @@ plugins:
|
|||||||
path: imagepolicyconfig.yaml
|
path: imagepolicyconfig.yaml
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
Alternatively, you can embed the configuration directly in the file:
|
Alternatively, you can embed the configuration directly in the file:
|
||||||
|
|
||||||
|
{{< tabs name="imagepolicywebhook_example2" >}}
|
||||||
|
{{% tab name="apiserver.config.k8s.io/v1" %}}
|
||||||
```yaml
|
```yaml
|
||||||
|
apiVersion: apiserver.config.k8s.io/v1
|
||||||
|
kind: AdmissionConfiguration
|
||||||
|
plugins:
|
||||||
|
- name: ImagePolicyWebhook
|
||||||
|
configuration:
|
||||||
|
imagePolicy:
|
||||||
|
kubeConfigFile: <path-to-kubeconfig-file>
|
||||||
|
allowTTL: 50
|
||||||
|
denyTTL: 50
|
||||||
|
retryBackoff: 500
|
||||||
|
defaultAllow: true
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab name="apiserver.k8s.io/v1alpha1" %}}
|
||||||
|
```yaml
|
||||||
|
# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1
|
||||||
apiVersion: apiserver.k8s.io/v1alpha1
|
apiVersion: apiserver.k8s.io/v1alpha1
|
||||||
kind: AdmissionConfiguration
|
kind: AdmissionConfiguration
|
||||||
plugins:
|
plugins:
|
||||||
- name: ImagePolicyWebhook
|
- name: ImagePolicyWebhook
|
||||||
configuration:
|
configuration:
|
||||||
imagePolicy:
|
imagePolicy:
|
||||||
kubeConfigFile: /path/to/file
|
kubeConfigFile: <path-to-kubeconfig-file>
|
||||||
allowTTL: 50
|
allowTTL: 50
|
||||||
denyTTL: 50
|
denyTTL: 50
|
||||||
retryBackoff: 500
|
retryBackoff: 500
|
||||||
defaultAllow: true
|
defaultAllow: true
|
||||||
```
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
The ImagePolicyWebhook config file must reference a [kubeconfig](/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/) formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.
|
The ImagePolicyWebhook config file must reference a [kubeconfig](/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/) formatted file which sets up the connection to the backend. It is required that the backend communicate over TLS.
|
||||||
|
|
||||||
@@ -492,7 +542,20 @@ podNodeSelectorPluginConfig:
|
|||||||
|
|
||||||
Reference the `PodNodeSelector` configuration file from the file provided to the API server's command line flag `--admission-control-config-file`:
|
Reference the `PodNodeSelector` configuration file from the file provided to the API server's command line flag `--admission-control-config-file`:
|
||||||
|
|
||||||
|
{{< tabs name="podnodeselector_example1" >}}
|
||||||
|
{{% tab name="apiserver.config.k8s.io/v1" %}}
|
||||||
```yaml
|
```yaml
|
||||||
|
apiVersion: apiserver.config.k8s.io/v1
|
||||||
|
kind: AdmissionConfiguration
|
||||||
|
plugins:
|
||||||
|
- name: PodNodeSelector
|
||||||
|
path: podnodeselector.yaml
|
||||||
|
...
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab name="apiserver.k8s.io/v1alpha1" %}}
|
||||||
|
```yaml
|
||||||
|
# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1
|
||||||
apiVersion: apiserver.k8s.io/v1alpha1
|
apiVersion: apiserver.k8s.io/v1alpha1
|
||||||
kind: AdmissionConfiguration
|
kind: AdmissionConfiguration
|
||||||
plugins:
|
plugins:
|
||||||
@@ -500,6 +563,8 @@ plugins:
|
|||||||
path: podnodeselector.yaml
|
path: podnodeselector.yaml
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
#### Configuration Annotation Format
|
#### Configuration Annotation Format
|
||||||
`PodNodeSelector` uses the annotation key `scheduler.alpha.kubernetes.io/node-selector` to assign node selectors to namespaces.
|
`PodNodeSelector` uses the annotation key `scheduler.alpha.kubernetes.io/node-selector` to assign node selectors to namespaces.
|
||||||
|
|||||||
@@ -184,24 +184,46 @@ the webhooks. There are three steps to complete the configuration.
|
|||||||
(yes, the same schema that's used by kubectl), so the field name is
|
(yes, the same schema that's used by kubectl), so the field name is
|
||||||
`kubeConfigFile`. Here is an example admission control configuration file:
|
`kubeConfigFile`. Here is an example admission control configuration file:
|
||||||
|
|
||||||
```yaml
|
{{< tabs name="admissionconfiguration_example1" >}}
|
||||||
apiVersion: apiserver.k8s.io/v1alpha1
|
{{% tab name="apiserver.config.k8s.io/v1" %}}
|
||||||
kind: AdmissionConfiguration
|
```yaml
|
||||||
plugins:
|
apiVersion: apiserver.config.k8s.io/v1
|
||||||
- name: ValidatingAdmissionWebhook
|
kind: AdmissionConfiguration
|
||||||
configuration:
|
plugins:
|
||||||
apiVersion: apiserver.config.k8s.io/v1alpha1
|
- name: ValidatingAdmissionWebhook
|
||||||
kind: WebhookAdmission
|
configuration:
|
||||||
kubeConfigFile: "<path-to-kubeconfig-file>"
|
apiVersion: apiserver.config.k8s.io/v1alpha1
|
||||||
- name: MutatingAdmissionWebhook
|
kind: WebhookAdmission
|
||||||
configuration:
|
kubeConfigFile: "<path-to-kubeconfig-file>"
|
||||||
apiVersion: apiserver.config.k8s.io/v1alpha1
|
- name: MutatingAdmissionWebhook
|
||||||
kind: WebhookAdmission
|
configuration:
|
||||||
kubeConfigFile: "<path-to-kubeconfig-file>"
|
apiVersion: apiserver.config.k8s.io/v1alpha1
|
||||||
```
|
kind: WebhookAdmission
|
||||||
|
kubeConfigFile: "<path-to-kubeconfig-file>"
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab name="apiserver.k8s.io/v1alpha1" %}}
|
||||||
|
```yaml
|
||||||
|
# Deprecated in v1.17 in favor of apiserver.config.k8s.io/v1
|
||||||
|
apiVersion: apiserver.k8s.io/v1alpha1
|
||||||
|
kind: AdmissionConfiguration
|
||||||
|
plugins:
|
||||||
|
- name: ValidatingAdmissionWebhook
|
||||||
|
configuration:
|
||||||
|
apiVersion: apiserver.config.k8s.io/v1alpha1
|
||||||
|
kind: WebhookAdmission
|
||||||
|
kubeConfigFile: "<path-to-kubeconfig-file>"
|
||||||
|
- name: MutatingAdmissionWebhook
|
||||||
|
configuration:
|
||||||
|
apiVersion: apiserver.config.k8s.io/v1alpha1
|
||||||
|
kind: WebhookAdmission
|
||||||
|
kubeConfigFile: "<path-to-kubeconfig-file>"
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
The schema of `admissionConfiguration` is defined
|
For more information about `AdmissionConfiguration`, see the
|
||||||
[here](https://github.com/kubernetes/kubernetes/blob/v1.13.0/staging/src/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go#L27).
|
[AdmissionConfiguration schema](https://github.com/kubernetes/kubernetes/blob/v1.17.0/staging/src/k8s.io/apiserver/pkg/apis/apiserver/v1/types.go#L27).
|
||||||
See the [webhook configuration](#webhook-configuration) section for details about each config field.
|
See the [webhook configuration](#webhook-configuration) section for details about each config field.
|
||||||
|
|
||||||
* In the kubeConfig file, provide the credentials:
|
* In the kubeConfig file, provide the credentials:
|
||||||
|
|||||||
Reference in New Issue
Block a user