Skip to content

Commit f639245

Browse files
hdp617entertvl
authored andcommitted
feat(containerattached): Add security_posture_config (#11516)
1 parent 62a4de3 commit f639245

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

mmv1/products/containerattached/Cluster.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,17 @@ properties:
355355
required: true
356356
description: |
357357
Namespace of the kubernetes secret containing the proxy config.
358+
- !ruby/object:Api::Type::NestedObject
359+
name: securityPostureConfig
360+
description: |
361+
Enable/Disable Security Posture API features for the cluster.
362+
default_from_api: true
363+
properties:
364+
- !ruby/object:Api::Type::Enum
365+
name: vulnerabilityMode
366+
required: true
367+
description: |
368+
Sets the mode of the Kubernetes security posture API's workload vulnerability scanning.
369+
values:
370+
- :VULNERABILITY_DISABLED
371+
- :VULNERABILITY_ENTERPRISE

mmv1/templates/terraform/examples/container_attached_cluster_full.tf.erb

+3
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@ resource "google_container_attached_cluster" "primary" {
4646
namespace = "default"
4747
}
4848
}
49+
security_posture_config {
50+
vulnerability_mode = "VULNERABILITY_ENTERPRISE"
51+
}
4952
}

mmv1/templates/terraform/pre_update/containerattached_update.go.erb

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ if d.HasChange("proxy_config") {
1919
newUpdateMask = append(newUpdateMask, "proxy_config.kubernetes_secret.name")
2020
newUpdateMask = append(newUpdateMask, "proxy_config.kubernetes_secret.namespace")
2121
}
22+
if d.HasChange("security_posture_config") {
23+
newUpdateMask = append(newUpdateMask, "security_posture_config.vulnerability_mode")
24+
}
2225
// Pull out any other set fields from the generated mask.
2326
for _, mask := range updateMask {
24-
if mask == "authorization" || mask == "loggingConfig" || mask == "monitoringConfig" || mask == "binaryAuthorization" || mask == "proxyConfig" {
27+
if mask == "authorization" || mask == "loggingConfig" || mask == "monitoringConfig" || mask == "binaryAuthorization" || mask == "proxyConfig" || mask == "securityPostureConfig" {
2528
continue
2629
}
2730
newUpdateMask = append(newUpdateMask, mask)

mmv1/third_party/terraform/services/containerattached/resource_container_attached_cluster_update_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ resource "google_container_attached_cluster" "primary" {
118118
namespace = "default"
119119
}
120120
}
121+
security_posture_config {
122+
vulnerability_mode = "VULNERABILITY_ENTERPRISE"
123+
}
121124
}
122125
`, context)
123126
}
@@ -166,6 +169,9 @@ resource "google_container_attached_cluster" "primary" {
166169
namespace = "custom-ns"
167170
}
168171
}
172+
security_posture_config {
173+
vulnerability_mode = "VULNERABILITY_DISABLED"
174+
}
169175
lifecycle {
170176
prevent_destroy = true
171177
}
@@ -312,6 +318,9 @@ resource "google_container_attached_cluster" "primary" {
312318
namespace = "custom-ns"
313319
}
314320
}
321+
security_posture_config {
322+
vulnerability_mode = "VULNERABILITY_DISABLED"
323+
}
315324
}
316325
`, context)
317326
}

0 commit comments

Comments
 (0)