-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Single webhook per configuration entity
We've noticed an unexpected behavior in OpenShift: 1. ValidatingWebhookConfiguration or MutatingWebhookConfiguration is posted with a webhook 2. CA bundle is injected to the webhook 3. More webhooks are added to the configuration entity 4. Some of the webhooks (in our case it has always been the last one) does not get a CA bundle injected This is a workaround for this issue - avoid adding webhooks to an existing configuration entity by separating each webhook to a different configuration entity. Signed-off-by: Arik Hadas <[email protected]>
- Loading branch information
Showing
8 changed files
with
227 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 2 additions & 61 deletions
63
...r/roles/forkliftcontroller/templates/api/mutatingwebhookconfiguration-forklift-api.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,8 @@ | ||
# Do not add webhooks to this file | ||
# This configuration has been deprecated | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
name: {{ api_deployment_name }} | ||
namespace: "" | ||
annotations: | ||
{% if k8s_cluster|bool %} | ||
cert-manager.io/inject-ca-from: {{ app_namespace }}/{{ api_certificate_name }} | ||
{% else %} | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{% endif %} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /secret-mutate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: ca-mutatur.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: | ||
matchExpressions: | ||
- key: createdForProviderType | ||
operator: Exists | ||
rules: | ||
- apiGroups: | ||
- '' | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resources: | ||
- secrets | ||
scope: Namespaced | ||
sideEffects: None | ||
timeoutSeconds: 30 | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /plan-mutate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: plans.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: {} | ||
rules: | ||
- apiGroups: | ||
- forklift.konveyor.io | ||
resources: | ||
- plans | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
sideEffects: None | ||
timeoutSeconds: 30 |
38 changes: 38 additions & 0 deletions
38
operator/roles/forkliftcontroller/templates/api/mutatingwebhookconfiguration-plans.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
name: {{ api_deployment_name }}-plans | ||
namespace: "" | ||
annotations: | ||
{% if k8s_cluster|bool %} | ||
cert-manager.io/inject-ca-from: {{ app_namespace }}/{{ api_certificate_name }} | ||
{% else %} | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{% endif %} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /plan-mutate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: plans.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: {} | ||
rules: | ||
- apiGroups: | ||
- forklift.konveyor.io | ||
resources: | ||
- plans | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
sideEffects: None | ||
timeoutSeconds: 30 |
42 changes: 42 additions & 0 deletions
42
operator/roles/forkliftcontroller/templates/api/mutatingwebhookconfiguration-secrets.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
name: {{ api_deployment_name }}-secrets | ||
namespace: "" | ||
annotations: | ||
{% if k8s_cluster|bool %} | ||
cert-manager.io/inject-ca-from: {{ app_namespace }}/{{ api_certificate_name }} | ||
{% else %} | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{% endif %} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /secret-mutate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: ca-mutatur.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: | ||
matchExpressions: | ||
- key: createdForProviderType | ||
operator: Exists | ||
rules: | ||
- apiGroups: | ||
- '' | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resources: | ||
- secrets | ||
scope: Namespaced | ||
sideEffects: None | ||
timeoutSeconds: 30 |
85 changes: 2 additions & 83 deletions
85
...roles/forkliftcontroller/templates/api/validatingwebhookconfiguration-forklift-api.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,8 @@ | ||
# Do not add webhooks to this file | ||
# This configuration has been deprecated | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: {{ api_deployment_name }} | ||
namespace: "" | ||
annotations: | ||
{% if k8s_cluster|bool %} | ||
cert-manager.io/inject-ca-from: {{ app_namespace }}/{{ api_certificate_name }} | ||
{% else %} | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{% endif %} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /secret-validate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: secrets.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: | ||
matchExpressions: | ||
- key: createdForResourceType | ||
operator: Exists | ||
rules: | ||
- apiGroups: | ||
- '' | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resources: | ||
- secrets | ||
scope: Namespaced | ||
sideEffects: None | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /plan-validate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: plans.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: {} | ||
rules: | ||
- apiGroups: | ||
- forklift.konveyor.io | ||
resources: | ||
- plans | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
sideEffects: None | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /provider-validate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: providers.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: {} | ||
rules: | ||
- apiGroups: | ||
- forklift.konveyor.io | ||
resources: | ||
- providers | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
sideEffects: None |
37 changes: 37 additions & 0 deletions
37
operator/roles/forkliftcontroller/templates/api/validatingwebhookconfiguration-plans.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: {{ api_deployment_name }}-plans | ||
namespace: "" | ||
annotations: | ||
{% if k8s_cluster|bool %} | ||
cert-manager.io/inject-ca-from: {{ app_namespace }}/{{ api_certificate_name }} | ||
{% else %} | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{% endif %} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /plan-validate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: plans.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: {} | ||
rules: | ||
- apiGroups: | ||
- forklift.konveyor.io | ||
resources: | ||
- plans | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
sideEffects: None |
37 changes: 37 additions & 0 deletions
37
...or/roles/forkliftcontroller/templates/api/validatingwebhookconfiguration-providers.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: {{ api_deployment_name }}-providers | ||
namespace: "" | ||
annotations: | ||
{% if k8s_cluster|bool %} | ||
cert-manager.io/inject-ca-from: {{ app_namespace }}/{{ api_certificate_name }} | ||
{% else %} | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{% endif %} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
clientConfig: | ||
service: | ||
name: {{ api_service_name }} | ||
namespace: {{ app_namespace }} | ||
path: /provider-validate | ||
port: 443 | ||
failurePolicy: Fail | ||
matchPolicy: Equivalent | ||
name: providers.forklift.konveyor | ||
namespaceSelector: {} | ||
objectSelector: {} | ||
rules: | ||
- apiGroups: | ||
- forklift.konveyor.io | ||
resources: | ||
- providers | ||
apiVersions: | ||
- v1beta1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
sideEffects: None |
Oops, something went wrong.