Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit 7982787

Browse files
feat: Adds support for check-based platform policy evaluation to Binary Authorization Continuous Validation logs (#225)
* feat: Adds support for check-based platform policy evaluation to Binary Authorization Continuous Validation logs feat: Adds support for communicating configuration issues that prevent Continuous Validation from monitoring pods fix!: Remove unused unsupported_policy_event event_type from ContinuousValidationPodEvent PiperOrigin-RevId: 557146775 Source-Link: googleapis/googleapis@6c2b07f Source-Link: https://github.com/googleapis/googleapis-gen/commit/828cab43a0c39a28f10317b4b5b124c735f240fa Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODI4Y2FiNDNhMGMzOWEyOGYxMDMxN2I0YjViMTI0YzczNWYyNDBmYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e5821c3 commit 7982787

File tree

1 file changed

+133
-9
lines changed

1 file changed

+133
-9
lines changed

google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py

Lines changed: 133 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class ContinuousValidationEvent(proto.Message):
4343
Pod event.
4444
4545
This field is a member of `oneof`_ ``event_type``.
46-
unsupported_policy_event (google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.UnsupportedPolicyEvent):
47-
Unsupported policy event.
46+
config_error_event (google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ConfigErrorEvent):
47+
Config error event.
4848
4949
This field is a member of `oneof`_ ``event_type``.
5050
"""
@@ -57,6 +57,8 @@ class ContinuousValidationPodEvent(proto.Message):
5757
The k8s namespace of the Pod.
5858
pod (str):
5959
The name of the Pod.
60+
policy_name (str):
61+
The name of the policy.
6062
deploy_time (google.protobuf.timestamp_pb2.Timestamp):
6163
Deploy time of the Pod from k8s.
6264
end_time (google.protobuf.timestamp_pb2.Timestamp):
@@ -91,6 +93,8 @@ class ImageDetails(proto.Message):
9193
The result of the audit for this image.
9294
description (str):
9395
Description of the above result.
96+
check_results (MutableSequence[google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult]):
97+
List of check results.
9498
"""
9599

96100
class AuditResult(proto.Enum):
@@ -108,6 +112,115 @@ class AuditResult(proto.Enum):
108112
ALLOW = 1
109113
DENY = 2
110114

115+
class CheckResult(proto.Message):
116+
r"""
117+
118+
Attributes:
119+
check_set_index (str):
120+
The index of the check set.
121+
check_set_name (str):
122+
The name of the check set.
123+
check_set_scope (google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult.CheckSetScope):
124+
The scope of the check set.
125+
check_index (str):
126+
The index of the check.
127+
check_name (str):
128+
The name of the check.
129+
check_type (str):
130+
The type of the check.
131+
verdict (google.cloud.binaryauthorization_v1beta1.types.ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult.CheckVerdict):
132+
The verdict of this check.
133+
explanation (str):
134+
User-friendly explanation of this check
135+
result.
136+
"""
137+
138+
class CheckVerdict(proto.Enum):
139+
r"""Result of evaluating one check.
140+
141+
Values:
142+
CHECK_VERDICT_UNSPECIFIED (0):
143+
We should always have a verdict. This is an
144+
error.
145+
NON_CONFORMANT (1):
146+
The check was successfully evaluated and the
147+
image did not satisfy the check.
148+
"""
149+
CHECK_VERDICT_UNSPECIFIED = 0
150+
NON_CONFORMANT = 1
151+
152+
class CheckSetScope(proto.Message):
153+
r"""A scope specifier for check sets.
154+
155+
This message has `oneof`_ fields (mutually exclusive fields).
156+
For each oneof, at most one member field can be set at the same time.
157+
Setting any member of the oneof automatically clears all other
158+
members.
159+
160+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
161+
162+
Attributes:
163+
kubernetes_service_account (str):
164+
Matches a single Kubernetes service account, e.g.
165+
'my-namespace:my-service-account'.
166+
``kubernetes_service_account`` scope is always more specific
167+
than ``kubernetes_namespace`` scope for the same namespace.
168+
169+
This field is a member of `oneof`_ ``scope``.
170+
kubernetes_namespace (str):
171+
Matches all Kubernetes service accounts in the provided
172+
namespace, unless a more specific
173+
``kubernetes_service_account`` scope already matched.
174+
175+
This field is a member of `oneof`_ ``scope``.
176+
"""
177+
178+
kubernetes_service_account: str = proto.Field(
179+
proto.STRING,
180+
number=1,
181+
oneof="scope",
182+
)
183+
kubernetes_namespace: str = proto.Field(
184+
proto.STRING,
185+
number=2,
186+
oneof="scope",
187+
)
188+
189+
check_set_index: str = proto.Field(
190+
proto.STRING,
191+
number=1,
192+
)
193+
check_set_name: str = proto.Field(
194+
proto.STRING,
195+
number=2,
196+
)
197+
check_set_scope: "ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult.CheckSetScope" = proto.Field(
198+
proto.MESSAGE,
199+
number=3,
200+
message="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult.CheckSetScope",
201+
)
202+
check_index: str = proto.Field(
203+
proto.STRING,
204+
number=4,
205+
)
206+
check_name: str = proto.Field(
207+
proto.STRING,
208+
number=5,
209+
)
210+
check_type: str = proto.Field(
211+
proto.STRING,
212+
number=6,
213+
)
214+
verdict: "ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult.CheckVerdict" = proto.Field(
215+
proto.ENUM,
216+
number=7,
217+
enum="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult.CheckVerdict",
218+
)
219+
explanation: str = proto.Field(
220+
proto.STRING,
221+
number=8,
222+
)
223+
111224
image: str = proto.Field(
112225
proto.STRING,
113226
number=1,
@@ -121,6 +234,13 @@ class AuditResult(proto.Enum):
121234
proto.STRING,
122235
number=3,
123236
)
237+
check_results: MutableSequence[
238+
"ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult"
239+
] = proto.RepeatedField(
240+
proto.MESSAGE,
241+
number=4,
242+
message="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.CheckResult",
243+
)
124244

125245
pod_namespace: str = proto.Field(
126246
proto.STRING,
@@ -130,6 +250,10 @@ class AuditResult(proto.Enum):
130250
proto.STRING,
131251
number=1,
132252
)
253+
policy_name: str = proto.Field(
254+
proto.STRING,
255+
number=8,
256+
)
133257
deploy_time: timestamp_pb2.Timestamp = proto.Field(
134258
proto.MESSAGE,
135259
number=2,
@@ -153,13 +277,13 @@ class AuditResult(proto.Enum):
153277
message="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails",
154278
)
155279

156-
class UnsupportedPolicyEvent(proto.Message):
157-
r"""An event describing that the project policy is unsupported by
158-
CV.
280+
class ConfigErrorEvent(proto.Message):
281+
r"""An event describing a user-actionable configuration issue
282+
that prevents CV from auditing.
159283
160284
Attributes:
161285
description (str):
162-
A description of the unsupported policy.
286+
A description of the issue.
163287
"""
164288

165289
description: str = proto.Field(
@@ -173,11 +297,11 @@ class UnsupportedPolicyEvent(proto.Message):
173297
oneof="event_type",
174298
message=ContinuousValidationPodEvent,
175299
)
176-
unsupported_policy_event: UnsupportedPolicyEvent = proto.Field(
300+
config_error_event: ConfigErrorEvent = proto.Field(
177301
proto.MESSAGE,
178-
number=2,
302+
number=4,
179303
oneof="event_type",
180-
message=UnsupportedPolicyEvent,
304+
message=ConfigErrorEvent,
181305
)
182306

183307

0 commit comments

Comments
 (0)