-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ValidatingWebhookConfiguration custom resource definition
- Loading branch information
Mitchell Huang
committed
Jul 15, 2020
1 parent
ca650ea
commit 5c21bf9
Showing
3 changed files
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ variable "cert_pem" { | |
variable "key_pem" { | ||
type = "string" | ||
} | ||
|
||
variable "ca_cert_pem" { | ||
type = "string" | ||
} |
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,49 @@ | ||
resource "kubernetes_manifest" "opa_validating_webhook_configuration" { | ||
manifest = { | ||
"apiVersion" = "admissionregistration.k8s.io/v1beta1" | ||
"kind" = "ValidatingWebhookConfiguration" | ||
"metadata" = { | ||
"name" = "opa-validating-webhook" | ||
} | ||
"webhooks" = [ | ||
{ | ||
"clientConfig" = { | ||
"caBundle" = filebase64("${var.ca_cert_pem}") | ||
"service" = { | ||
"name" = "opa" | ||
"namespace" = "opa" | ||
} | ||
} | ||
"name" = "validating-webhook.openpolicyagent.org" | ||
"namespaceSelector" = { | ||
"matchExpressions" = [ | ||
{ | ||
"key" = "openpolicyagent.org/webhook" | ||
"operator" = "NotIn" | ||
"values" = [ | ||
"ignore", | ||
] | ||
}, | ||
] | ||
} | ||
"rules" = [ | ||
{ | ||
"apiGroups" = [ | ||
"*", | ||
] | ||
"apiVersions" = [ | ||
"*", | ||
] | ||
"operations" = [ | ||
"CREATE", | ||
"UPDATE", | ||
] | ||
"resources" = [ | ||
"*", | ||
] | ||
}, | ||
] | ||
}, | ||
] | ||
} | ||
} |
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