Webhook-Zeitlimit konfigurieren

Auf dieser Seite wird beschrieben, wie Sie das Webhook-Zeitlimit für Config Connector konfigurieren. Sie können diese Webhooks in Config Connector Version 1.110 und höher konfigurieren.

Zeitlimit für die Validierung von Webhooks konfigurieren

Sie können die folgenden Validierungs-Webhooks konfigurieren:

  • deny-immutable-field-updates.cnrm.cloud.google.com
  • deny-unknown-fields.cnrm.cloud.google.com
  • iam-validation.cnrm.cloud.google.com
  • resource-validation.cnrm.cloud.google.com
  • abandon-on-uninstall.cnrm.cloud.google.com

Sie können beispielsweise das Zeitlimit für die Validierung von Webhooks deny-immutable-field-updates.cnrm.cloud.google.com und deny-unknown-fields.cnrm.cloud.google.com konfigurieren, indem Sie die folgende Beispiel-YAML-Datei erstellen und anwenden. Diese Webhooks sind Teil der Konfiguration des validating-webhook.cnrm.cloud.google.com-Validierungs-Webhooks.

  1. Erstellen Sie eine Datei mit dem Namen configure-validating-webhook-timeout.yaml und kopieren Sie die folgende YAML-Datei hinein:

    apiVersion: customize.core.cnrm.cloud.google.com/v1beta1
    kind: ValidatingWebhookConfigurationCustomization
    metadata:
      name: validating-webhook
    spec:
      webhooks:
      - name: deny-immutable-field-updates
        timeoutSeconds: 12
      - name: deny-unknown-fields
        timeoutSeconds: 15
    
  2. Verwenden Sie kubectl apply, um die Anpassung des Webhook-Timeouts auf Ihren Cluster anzuwenden:

    kubectl apply -f configure-validating-webhook-timeout.yaml
  3. Prüfen Sie mit dem folgenden Befehl, ob die Konfiguration erfolgreich war:

    kubectl get validatingwebhookconfigurationcustomizations validating-webhook -o jsonpath='{.status.healthy}{"\n"}'

    Das Feld status.healthy sollte auf true gesetzt sein.

  4. Prüfen Sie, ob das neue benutzerdefinierte Zeitlimit auf die Ziel-Webhooks angewendet wurde:

    kubectl get validatingwebhookconfigurations validating-webhook.cnrm.cloud.google.com -o jsonpath='{.webhooks[?(@.name=="deny-immutable-field-updates.cnrm.cloud.google.com")].timeoutSeconds}{"\n"}'
    kubectl get validatingwebhookconfigurations validating-webhook.cnrm.cloud.google.com -o jsonpath='{.webhooks[?(@.name=="deny-unknown-fields.cnrm.cloud.google.com")].timeoutSeconds}{"\n"}'

    Das Anwenden der Anpassung kann einige Minuten dauern.

Zeitlimit für Mutating Webhooks konfigurieren

Sie können die folgenden Mutating Webhooks konfigurieren:

  • container-annotation-handler.cnrm.cloud.google.com
  • generic-defaulter.cnrm.cloud.google.com
  • iam-defaulter.cnrm.cloud.google.com
  • management-conflict-annotation-defaulter.cnrm.cloud.google.com

Sie können beispielsweise das Zeitlimit des Mutating-Webhooks container-annotation-handler.cnrm.cloud.google.com konfigurieren, indem Sie die folgende Beispiel-YAML-Datei erstellen und anwenden. Der Webhook ist Teil der Konfiguration des mutating-webhook.cnrm.cloud.google.com MutatingWebhookConfiguration.

  1. Erstellen Sie eine Datei mit dem Namen configure-mutating-webhook-timeout.yaml und kopieren Sie die folgende YAML-Datei hinein:

    apiVersion: customize.core.cnrm.cloud.google.com/v1beta1
    kind: MutatingWebhookConfigurationCustomization
    metadata:
      name: mutating-webhook
    spec:
      webhooks:
      - name: container-annotation-handler
        timeoutSeconds: 20
    
  2. Verwenden Sie kubectl apply, um die Anpassung des Webhook-Timeouts auf Ihren Cluster anzuwenden:

    kubectl apply -f configure-mutating-webhook-timeout.yaml
  3. Prüfen Sie mit dem folgenden Befehl, ob die Konfiguration erfolgreich war:

    kubectl get mutatingwebhookconfigurationcustomizations mutating-webhook -o jsonpath='{.status.healthy}{"\n"}'

    Das Feld status.healthy sollte auf true gesetzt sein.

  4. Prüfen Sie, ob das neue benutzerdefinierte Zeitlimit auf die Ziel-Webhooks angewendet wurde:

    kubectl get mutatingwebhookconfigurations mutating-webhook.cnrm.cloud.google.com -o jsonpath='{.webhooks[?(@.name=="container-annotation-handler.cnrm.cloud.google.com")].timeoutSeconds}{"\n"}'

    Das Anwenden der Anpassung kann einige Minuten dauern.