Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

feat: Adds a pod_namespace field to pod events created by Continuous Validation, to distinguish pods with the same name that run in different namespaces #227

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,31 @@ public interface ContinuousValidationPodEventOrBuilder
// @@protoc_insertion_point(interface_extends:google.cloud.binaryauthorization.v1beta1.ContinuousValidationEvent.ContinuousValidationPodEvent)
com.google.protobuf.MessageOrBuilder {

/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return The podNamespace.
*/
java.lang.String getPodNamespace();
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return The bytes for podNamespace.
*/
com.google.protobuf.ByteString getPodNamespaceBytes();

/**
*
*
Expand Down Expand Up @@ -384,6 +409,7 @@ private ContinuousValidationPodEvent(
}

private ContinuousValidationPodEvent() {
podNamespace_ = "";
pod_ = "";
verdict_ = 0;
images_ = java.util.Collections.emptyList();
Expand Down Expand Up @@ -479,6 +505,13 @@ private ContinuousValidationPodEvent(
extensionRegistry));
break;
}
case 58:
{
java.lang.String s = input.readStringRequireUtf8();

podNamespace_ = s;
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
Expand Down Expand Up @@ -1977,6 +2010,55 @@ public com.google.protobuf.Parser<ImageDetails> getParserForType() {
}
}

public static final int POD_NAMESPACE_FIELD_NUMBER = 7;
private volatile java.lang.Object podNamespace_;
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return The podNamespace.
*/
@java.lang.Override
public java.lang.String getPodNamespace() {
java.lang.Object ref = podNamespace_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
podNamespace_ = s;
return s;
}
}
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return The bytes for podNamespace.
*/
@java.lang.Override
public com.google.protobuf.ByteString getPodNamespaceBytes() {
java.lang.Object ref = podNamespace_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
podNamespace_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

public static final int POD_FIELD_NUMBER = 1;
private volatile java.lang.Object pod_;
/**
Expand Down Expand Up @@ -2291,6 +2373,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
for (int i = 0; i < images_.size(); i++) {
output.writeMessage(5, images_.get(i));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(podNamespace_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 7, podNamespace_);
}
unknownFields.writeTo(output);
}

Expand Down Expand Up @@ -2319,6 +2404,9 @@ public int getSerializedSize() {
for (int i = 0; i < images_.size(); i++) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, images_.get(i));
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(podNamespace_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, podNamespace_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -2342,6 +2430,7 @@ public boolean equals(final java.lang.Object obj) {
.ContinuousValidationPodEvent)
obj;

if (!getPodNamespace().equals(other.getPodNamespace())) return false;
if (!getPod().equals(other.getPod())) return false;
if (hasDeployTime() != other.hasDeployTime()) return false;
if (hasDeployTime()) {
Expand All @@ -2364,6 +2453,8 @@ public int hashCode() {
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + POD_NAMESPACE_FIELD_NUMBER;
hash = (53 * hash) + getPodNamespace().hashCode();
hash = (37 * hash) + POD_FIELD_NUMBER;
hash = (53 * hash) + getPod().hashCode();
if (hasDeployTime()) {
Expand Down Expand Up @@ -2555,6 +2646,8 @@ private void maybeForceBuilderInitialization() {
@java.lang.Override
public Builder clear() {
super.clear();
podNamespace_ = "";

pod_ = "";

if (deployTimeBuilder_ == null) {
Expand Down Expand Up @@ -2617,6 +2710,7 @@ public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
new com.google.cloud.binaryauthorization.v1beta1.ContinuousValidationEvent
.ContinuousValidationPodEvent(this);
int from_bitField0_ = bitField0_;
result.podNamespace_ = podNamespace_;
result.pod_ = pod_;
if (deployTimeBuilder_ == null) {
result.deployTime_ = deployTime_;
Expand Down Expand Up @@ -2700,6 +2794,10 @@ public Builder mergeFrom(
if (other
== com.google.cloud.binaryauthorization.v1beta1.ContinuousValidationEvent
.ContinuousValidationPodEvent.getDefaultInstance()) return this;
if (!other.getPodNamespace().isEmpty()) {
podNamespace_ = other.podNamespace_;
onChanged();
}
if (!other.getPod().isEmpty()) {
pod_ = other.pod_;
onChanged();
Expand Down Expand Up @@ -2776,6 +2874,112 @@ public Builder mergeFrom(

private int bitField0_;

private java.lang.Object podNamespace_ = "";
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return The podNamespace.
*/
public java.lang.String getPodNamespace() {
java.lang.Object ref = podNamespace_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
podNamespace_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return The bytes for podNamespace.
*/
public com.google.protobuf.ByteString getPodNamespaceBytes() {
java.lang.Object ref = podNamespace_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
podNamespace_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @param value The podNamespace to set.
* @return This builder for chaining.
*/
public Builder setPodNamespace(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}

podNamespace_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @return This builder for chaining.
*/
public Builder clearPodNamespace() {

podNamespace_ = getDefaultInstance().getPodNamespace();
onChanged();
return this;
}
/**
*
*
* <pre>
* The k8s namespace of the Pod.
* </pre>
*
* <code>string pod_namespace = 7;</code>
*
* @param value The bytes for podNamespace to set.
* @return This builder for chaining.
*/
public Builder setPodNamespaceBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);

podNamespace_ = value;
onChanged();
return this;
}

private java.lang.Object pod_ = "";
/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,43 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"\nLgoogle/cloud/binaryauthorization/v1bet"
+ "a1/continuous_validation_logging.proto\022("
+ "google.cloud.binaryauthorization.v1beta1"
+ "\032\037google/protobuf/timestamp.proto\"\310\010\n\031Co"
+ "\032\037google/protobuf/timestamp.proto\"\337\010\n\031Co"
+ "ntinuousValidationEvent\022u\n\tpod_event\030\001 \001"
+ "(\0132`.google.cloud.binaryauthorization.v1"
+ "beta1.ContinuousValidationEvent.Continuo"
+ "usValidationPodEventH\000\022~\n\030unsupported_po"
+ "licy_event\030\002 \001(\0132Z.google.cloud.binaryau"
+ "thorization.v1beta1.ContinuousValidation"
+ "Event.UnsupportedPolicyEventH\000\032\366\005\n\034Conti"
+ "nuousValidationPodEvent\022\013\n\003pod\030\001 \001(\t\022/\n\013"
+ "deploy_time\030\002 \001(\0132\032.google.protobuf.Time"
+ "stamp\022,\n\010end_time\030\003 \001(\0132\032.google.protobu"
+ "f.Timestamp\022\212\001\n\007verdict\030\004 \001(\0162y.google.c"
+ "loud.binaryauthorization.v1beta1.Continu"
+ "ousValidationEvent.ContinuousValidationP"
+ "odEvent.PolicyConformanceVerdict\022}\n\006imag"
+ "es\030\005 \003(\0132m.google.cloud.binaryauthorizat"
+ "ion.v1beta1.ContinuousValidationEvent.Co"
+ "ntinuousValidationPodEvent.ImageDetails\032"
+ "\200\002\n\014ImageDetails\022\r\n\005image\030\001 \001(\t\022\211\001\n\006resu"
+ "lt\030\002 \001(\0162y.google.cloud.binaryauthorizat"
+ "ion.v1beta1.ContinuousValidationEvent.Co"
+ "ntinuousValidationPodEvent.ImageDetails."
+ "AuditResult\022\023\n\013description\030\003 \001(\t\"@\n\013Audi"
+ "tResult\022\034\n\030AUDIT_RESULT_UNSPECIFIED\020\000\022\t\n"
+ "\005ALLOW\020\001\022\010\n\004DENY\020\002\"[\n\030PolicyConformanceV"
+ "erdict\022*\n&POLICY_CONFORMANCE_VERDICT_UNS"
+ "PECIFIED\020\000\022\023\n\017VIOLATES_POLICY\020\001\032-\n\026Unsup"
+ "portedPolicyEvent\022\023\n\013description\030\001 \001(\tB\014"
+ "\n\nevent_typeB\266\002\n,com.google.cloud.binary"
+ "authorization.v1beta1B ContinuousValidat"
+ "ionLoggingProtoP\001Z[google.golang.org/gen"
+ "proto/googleapis/cloud/binaryauthorizati"
+ "on/v1beta1;binaryauthorization\370\001\001\252\002(Goog"
+ "le.Cloud.BinaryAuthorization.V1Beta1\312\002(G"
+ "oogle\\Cloud\\BinaryAuthorization\\V1beta1\352"
+ "\002+Google::Cloud::BinaryAuthorization::V1"
+ "beta1b\006proto3"
+ "Event.UnsupportedPolicyEventH\000\032\215\006\n\034Conti"
+ "nuousValidationPodEvent\022\025\n\rpod_namespace"
+ "\030\007 \001(\t\022\013\n\003pod\030\001 \001(\t\022/\n\013deploy_time\030\002 \001(\013"
+ "2\032.google.protobuf.Timestamp\022,\n\010end_time"
+ "\030\003 \001(\0132\032.google.protobuf.Timestamp\022\212\001\n\007v"
+ "erdict\030\004 \001(\0162y.google.cloud.binaryauthor"
+ "ization.v1beta1.ContinuousValidationEven"
+ "t.ContinuousValidationPodEvent.PolicyCon"
+ "formanceVerdict\022}\n\006images\030\005 \003(\0132m.google"
+ ".cloud.binaryauthorization.v1beta1.Conti"
+ "nuousValidationEvent.ContinuousValidatio"
+ "nPodEvent.ImageDetails\032\200\002\n\014ImageDetails\022"
+ "\r\n\005image\030\001 \001(\t\022\211\001\n\006result\030\002 \001(\0162y.google"
+ ".cloud.binaryauthorization.v1beta1.Conti"
+ "nuousValidationEvent.ContinuousValidatio"
+ "nPodEvent.ImageDetails.AuditResult\022\023\n\013de"
+ "scription\030\003 \001(\t\"@\n\013AuditResult\022\034\n\030AUDIT_"
+ "RESULT_UNSPECIFIED\020\000\022\t\n\005ALLOW\020\001\022\010\n\004DENY\020"
+ "\002\"[\n\030PolicyConformanceVerdict\022*\n&POLICY_"
+ "CONFORMANCE_VERDICT_UNSPECIFIED\020\000\022\023\n\017VIO"
+ "LATES_POLICY\020\001\032-\n\026UnsupportedPolicyEvent"
+ "\022\023\n\013description\030\001 \001(\tB\014\n\nevent_typeB\266\002\n,"
+ "com.google.cloud.binaryauthorization.v1b"
+ "eta1B ContinuousValidationLoggingProtoP\001"
+ "Z[google.golang.org/genproto/googleapis/"
+ "cloud/binaryauthorization/v1beta1;binary"
+ "authorization\370\001\001\252\002(Google.Cloud.BinaryAu"
+ "thorization.V1Beta1\312\002(Google\\Cloud\\Binar"
+ "yAuthorization\\V1beta1\352\002+Google::Cloud::"
+ "BinaryAuthorization::V1beta1b\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand All @@ -115,7 +115,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_binaryauthorization_v1beta1_ContinuousValidationEvent_ContinuousValidationPodEvent_descriptor,
new java.lang.String[] {
"Pod", "DeployTime", "EndTime", "Verdict", "Images",
"PodNamespace", "Pod", "DeployTime", "EndTime", "Verdict", "Images",
});
internal_static_google_cloud_binaryauthorization_v1beta1_ContinuousValidationEvent_ContinuousValidationPodEvent_ImageDetails_descriptor =
internal_static_google_cloud_binaryauthorization_v1beta1_ContinuousValidationEvent_ContinuousValidationPodEvent_descriptor
Expand Down
Loading