From 60b5dd11fa54cb9ea9ae50e68859a0b766fe8a90 Mon Sep 17 00:00:00 2001 From: Alexandre Lavigne Date: Tue, 14 Apr 2026 18:06:31 +0200 Subject: [PATCH] Add new k8s remote config action Add the definition for a new action in kuberactions to get a resource. Signed-off-by: Alexandre Lavigne --- kubeactions/jsonschema/GetResourceParams.json | 18 ++ kubeactions/jsonschema/KubeAction.json | 18 +- kubeactions/jsonschema/KubeActionsList.json | 18 +- kubeactions/kubeactions.pb.go | 237 ++++++++++++------ proto/kubeactions/kubeactions.proto | 17 +- 5 files changed, 232 insertions(+), 76 deletions(-) create mode 100644 kubeactions/jsonschema/GetResourceParams.json diff --git a/kubeactions/jsonschema/GetResourceParams.json b/kubeactions/jsonschema/GetResourceParams.json new file mode 100644 index 00000000..5e7741a3 --- /dev/null +++ b/kubeactions/jsonschema/GetResourceParams.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/GetResourceParams", + "definitions": { + "GetResourceParams": { + "properties": { + "output_format": { + "type": "string", + "description": "OutputFormat specifies the desired output format for the resource. Supported values: \"json\" (default) - Output the resource as a JSON object \"yaml\" - Output the resource as a YAML string If not specified, defaults to \"json\"." + } + }, + "additionalProperties": false, + "type": "object", + "title": "Get Resource Params", + "description": "GetResourceParams contains parameters for a get_resource action." + } + } +} \ No newline at end of file diff --git a/kubeactions/jsonschema/KubeAction.json b/kubeactions/jsonschema/KubeAction.json index 79b76bdd..2f7497ab 100644 --- a/kubeactions/jsonschema/KubeAction.json +++ b/kubeactions/jsonschema/KubeAction.json @@ -14,6 +14,18 @@ "title": "Delete Pod Params", "description": "DeletePodParams contains parameters for the delete_pod action. Deletes a pod from the cluster with an optional grace period." }, + "GetResourceParams": { + "properties": { + "output_format": { + "type": "string", + "description": "OutputFormat specifies the desired output format for the resource. Supported values: \"json\" (default) - Output the resource as a JSON object \"yaml\" - Output the resource as a YAML string If not specified, defaults to \"json\"." + } + }, + "additionalProperties": false, + "type": "object", + "title": "Get Resource Params", + "description": "GetResourceParams contains parameters for a get_resource action." + }, "KubeAction": { "required": [ "resource", @@ -50,8 +62,12 @@ }, "patch_deployment": { "$ref": "#/definitions/PatchDeploymentParams", + "additionalProperties": false + }, + "get_resource": { + "$ref": "#/definitions/GetResourceParams", "additionalProperties": false, - "description": "Future actions can be added here: DrainNodeParams drain_node = 13; CordonNodeParams cordon_node = 14;" + "description": "Future actions can be added here: DrainNodeParams drain_node = 14; CordonNodeParams cordon_node = 15;" } }, "additionalProperties": false, diff --git a/kubeactions/jsonschema/KubeActionsList.json b/kubeactions/jsonschema/KubeActionsList.json index c16fa7e0..261e6ef3 100644 --- a/kubeactions/jsonschema/KubeActionsList.json +++ b/kubeactions/jsonschema/KubeActionsList.json @@ -14,6 +14,18 @@ "title": "Delete Pod Params", "description": "DeletePodParams contains parameters for the delete_pod action. Deletes a pod from the cluster with an optional grace period." }, + "GetResourceParams": { + "properties": { + "output_format": { + "type": "string", + "description": "OutputFormat specifies the desired output format for the resource. Supported values: \"json\" (default) - Output the resource as a JSON object \"yaml\" - Output the resource as a YAML string If not specified, defaults to \"json\"." + } + }, + "additionalProperties": false, + "type": "object", + "title": "Get Resource Params", + "description": "GetResourceParams contains parameters for a get_resource action." + }, "KubeAction": { "required": [ "resource", @@ -50,8 +62,12 @@ }, "patch_deployment": { "$ref": "#/definitions/PatchDeploymentParams", + "additionalProperties": false + }, + "get_resource": { + "$ref": "#/definitions/GetResourceParams", "additionalProperties": false, - "description": "Future actions can be added here: DrainNodeParams drain_node = 13; CordonNodeParams cordon_node = 14;" + "description": "Future actions can be added here: DrainNodeParams drain_node = 14; CordonNodeParams cordon_node = 15;" } }, "additionalProperties": false, diff --git a/kubeactions/kubeactions.pb.go b/kubeactions/kubeactions.pb.go index cc3ad5d7..7e9499c4 100644 --- a/kubeactions/kubeactions.pb.go +++ b/kubeactions/kubeactions.pb.go @@ -98,6 +98,7 @@ type KubeAction struct { // *KubeAction_DeletePod // *KubeAction_RestartDeployment // *KubeAction_PatchDeployment + // *KubeAction_GetResource_ Action isKubeAction_Action `protobuf_oneof:"action"` } @@ -189,6 +190,13 @@ func (x *KubeAction) GetPatchDeployment() *PatchDeploymentParams { return nil } +func (x *KubeAction) GetGetResource_() *GetResourceParams { + if x, ok := x.GetAction().(*KubeAction_GetResource_); ok { + return x.GetResource_ + } + return nil +} + type isKubeAction_Action interface { isKubeAction_Action() } @@ -205,12 +213,18 @@ type KubeAction_PatchDeployment struct { PatchDeployment *PatchDeploymentParams `protobuf:"bytes,12,opt,name=patch_deployment,json=patchDeployment,proto3,oneof"` } +type KubeAction_GetResource_ struct { + GetResource_ *GetResourceParams `protobuf:"bytes,13,opt,name=get_resource,json=getResource,proto3,oneof"` +} + func (*KubeAction_DeletePod) isKubeAction_Action() {} func (*KubeAction_RestartDeployment) isKubeAction_Action() {} func (*KubeAction_PatchDeployment) isKubeAction_Action() {} +func (*KubeAction_GetResource_) isKubeAction_Action() {} + // DeletePodParams contains parameters for the delete_pod action. // Deletes a pod from the cluster with an optional grace period. type DeletePodParams struct { @@ -373,6 +387,61 @@ func (x *PatchDeploymentParams) GetPatchStrategy() string { return "" } +// GetResourceParams contains parameters for a get_resource action. +type GetResourceParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // OutputFormat specifies the desired output format for the resource. + // Supported values: + // + // "json" (default) - Output the resource as a JSON object + // "yaml" - Output the resource as a YAML string + // + // If not specified, defaults to "json". + OutputFormat string `protobuf:"bytes,1,opt,name=output_format,json=outputFormat,proto3" json:"output_format,omitempty"` +} + +func (x *GetResourceParams) Reset() { + *x = GetResourceParams{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResourceParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResourceParams) ProtoMessage() {} + +func (x *GetResourceParams) ProtoReflect() protoreflect.Message { + mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResourceParams.ProtoReflect.Descriptor instead. +func (*GetResourceParams) Descriptor() ([]byte, []int) { + return file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDescGZIP(), []int{5} +} + +func (x *GetResourceParams) GetOutputFormat() string { + if x != nil { + return x.OutputFormat + } + return "" +} + // KubeResource represents a Kubernetes resource to act on type KubeResource struct { state protoimpl.MessageState @@ -389,7 +458,7 @@ type KubeResource struct { func (x *KubeResource) Reset() { *x = KubeResource{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[5] + mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -402,7 +471,7 @@ func (x *KubeResource) String() string { func (*KubeResource) ProtoMessage() {} func (x *KubeResource) ProtoReflect() protoreflect.Message { - mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[5] + mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -415,7 +484,7 @@ func (x *KubeResource) ProtoReflect() protoreflect.Message { // Deprecated: Use KubeResource.ProtoReflect.Descriptor instead. func (*KubeResource) Descriptor() ([]byte, []int) { - return file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDescGZIP(), []int{5} + return file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDescGZIP(), []int{6} } func (x *KubeResource) GetApiVersion() string { @@ -471,7 +540,7 @@ type KubeActionResult struct { func (x *KubeActionResult) Reset() { *x = KubeActionResult{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[6] + mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -484,7 +553,7 @@ func (x *KubeActionResult) String() string { func (*KubeActionResult) ProtoMessage() {} func (x *KubeActionResult) ProtoReflect() protoreflect.Message { - mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[6] + mi := &file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -497,7 +566,7 @@ func (x *KubeActionResult) ProtoReflect() protoreflect.Message { // Deprecated: Use KubeActionResult.ProtoReflect.Descriptor instead. func (*KubeActionResult) Descriptor() ([]byte, []int) { - return file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDescGZIP(), []int{6} + return file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDescGZIP(), []int{7} } func (x *KubeActionResult) GetActionId() string { @@ -564,7 +633,7 @@ var file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto 0x64, 0x6f, 0x67, 0x2e, 0x6b, 0x75, 0x62, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x05, 0xba, 0x46, 0x02, 0x20, - 0x01, 0x22, 0xf1, 0x03, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x01, 0x22, 0xbe, 0x04, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6b, 0x75, 0x62, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x52, 0x65, 0x73, @@ -594,55 +663,64 @@ var file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto 0x6b, 0x75, 0x62, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x05, 0xba, 0x46, 0x02, 0x20, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, - 0x6f, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x35, 0x0a, 0x14, 0x67, 0x72, 0x61, 0x63, - 0x65, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x12, 0x67, 0x72, 0x61, 0x63, 0x65, 0x50, - 0x65, 0x72, 0x69, 0x6f, 0x64, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x88, 0x01, 0x01, 0x3a, - 0x05, 0xba, 0x46, 0x02, 0x20, 0x01, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x67, 0x72, 0x61, 0x63, 0x65, - 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, - 0x20, 0x0a, 0x17, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x05, 0xba, 0x46, 0x02, 0x20, - 0x01, 0x22, 0x73, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x70, 0x61, - 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, - 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, - 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x22, 0xb9, 0x01, 0x0a, 0x0c, 0x4b, 0x75, 0x62, 0x65, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, - 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6b, - 0x69, 0x6e, 0x64, 0x12, 0x23, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x09, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, - 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x3a, 0x05, 0xba, 0x46, 0x02, - 0x20, 0x01, 0x22, 0xfe, 0x01, 0x0a, 0x10, 0x4b, 0x75, 0x62, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x22, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, - 0x01, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x05, 0xaa, 0x46, - 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0b, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, - 0x0b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, - 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x41, 0x74, 0x3a, 0x07, 0xba, 0x46, 0x04, 0x08, - 0x01, 0x20, 0x01, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x44, 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2d, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, 0x35, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0c, 0x67, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x64, 0x61, 0x74, + 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6b, 0x75, 0x62, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x48, 0x00, 0x52, 0x0b, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x3a, 0x05, 0xba, 0x46, 0x02, 0x20, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x64, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x35, 0x0a, 0x14, 0x67, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x70, + 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x12, 0x67, 0x72, 0x61, 0x63, 0x65, 0x50, 0x65, 0x72, 0x69, + 0x6f, 0x64, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x88, 0x01, 0x01, 0x3a, 0x05, 0xba, 0x46, + 0x02, 0x20, 0x01, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x67, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x20, 0x0a, 0x17, + 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x05, 0xba, 0x46, 0x02, 0x20, 0x01, 0x22, 0x73, + 0x0a, 0x15, 0x50, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x05, + 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, + 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, 0x72, 0x61, 0x74, + 0x65, 0x67, 0x79, 0x22, 0x3f, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x3a, 0x05, 0xba, + 0x46, 0x02, 0x20, 0x01, 0x22, 0xb9, 0x01, 0x0a, 0x0c, 0x4b, 0x75, 0x62, 0x65, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6b, 0x69, 0x6e, + 0x64, 0x12, 0x23, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x26, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x3a, 0x05, 0xba, 0x46, 0x02, 0x20, 0x01, + 0x22, 0xfe, 0x01, 0x0a, 0x10, 0x4b, 0x75, 0x62, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x22, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, + 0x08, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, + 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0b, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x05, 0xaa, 0x46, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x65, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x65, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x41, 0x74, 0x3a, 0x07, 0xba, 0x46, 0x04, 0x08, 0x01, 0x20, + 0x01, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x44, 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2d, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, 0x35, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -657,32 +735,34 @@ func file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_prot return file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDescData } -var file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_goTypes = []interface{}{ (*KubeActionsList)(nil), // 0: datadog.kubeactions.KubeActionsList (*KubeAction)(nil), // 1: datadog.kubeactions.KubeAction (*DeletePodParams)(nil), // 2: datadog.kubeactions.DeletePodParams (*RestartDeploymentParams)(nil), // 3: datadog.kubeactions.RestartDeploymentParams (*PatchDeploymentParams)(nil), // 4: datadog.kubeactions.PatchDeploymentParams - (*KubeResource)(nil), // 5: datadog.kubeactions.KubeResource - (*KubeActionResult)(nil), // 6: datadog.kubeactions.KubeActionResult - (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp - (*structpb.Value)(nil), // 8: google.protobuf.Value + (*GetResourceParams)(nil), // 5: datadog.kubeactions.GetResourceParams + (*KubeResource)(nil), // 6: datadog.kubeactions.KubeResource + (*KubeActionResult)(nil), // 7: datadog.kubeactions.KubeActionResult + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp + (*structpb.Value)(nil), // 9: google.protobuf.Value } var file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_depIdxs = []int32{ 1, // 0: datadog.kubeactions.KubeActionsList.actions:type_name -> datadog.kubeactions.KubeAction - 5, // 1: datadog.kubeactions.KubeAction.resource:type_name -> datadog.kubeactions.KubeResource - 7, // 2: datadog.kubeactions.KubeAction.timestamp:type_name -> google.protobuf.Timestamp + 6, // 1: datadog.kubeactions.KubeAction.resource:type_name -> datadog.kubeactions.KubeResource + 8, // 2: datadog.kubeactions.KubeAction.timestamp:type_name -> google.protobuf.Timestamp 2, // 3: datadog.kubeactions.KubeAction.delete_pod:type_name -> datadog.kubeactions.DeletePodParams 3, // 4: datadog.kubeactions.KubeAction.restart_deployment:type_name -> datadog.kubeactions.RestartDeploymentParams 4, // 5: datadog.kubeactions.KubeAction.patch_deployment:type_name -> datadog.kubeactions.PatchDeploymentParams - 8, // 6: datadog.kubeactions.PatchDeploymentParams.patch:type_name -> google.protobuf.Value - 7, // 7: datadog.kubeactions.KubeActionResult.executed_at:type_name -> google.protobuf.Timestamp - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 5, // 6: datadog.kubeactions.KubeAction.get_resource:type_name -> datadog.kubeactions.GetResourceParams + 9, // 7: datadog.kubeactions.PatchDeploymentParams.patch:type_name -> google.protobuf.Value + 8, // 8: datadog.kubeactions.KubeActionResult.executed_at:type_name -> google.protobuf.Timestamp + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_init() } @@ -752,7 +832,7 @@ func file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_prot } } file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KubeResource); i { + switch v := v.(*GetResourceParams); i { case 0: return &v.state case 1: @@ -764,6 +844,18 @@ func file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_prot } } file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KubeResource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KubeActionResult); i { case 0: return &v.state @@ -780,6 +872,7 @@ func file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_prot (*KubeAction_DeletePod)(nil), (*KubeAction_RestartDeployment)(nil), (*KubeAction_PatchDeployment)(nil), + (*KubeAction_GetResource_)(nil), } file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_msgTypes[2].OneofWrappers = []interface{}{} type x struct{} @@ -788,7 +881,7 @@ func file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_prot GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_github_com_DataDog_agent_payload_v5_proto_kubeactions_kubeactions_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/kubeactions/kubeactions.proto b/proto/kubeactions/kubeactions.proto index 74d5eb21..e995c16a 100644 --- a/proto/kubeactions/kubeactions.proto +++ b/proto/kubeactions/kubeactions.proto @@ -42,9 +42,10 @@ message KubeAction { DeletePodParams delete_pod = 10; RestartDeploymentParams restart_deployment = 11; PatchDeploymentParams patch_deployment = 12; + GetResourceParams get_resource = 13; // Future actions can be added here: - // DrainNodeParams drain_node = 13; - // CordonNodeParams cordon_node = 14; + // DrainNodeParams drain_node = 14; + // CordonNodeParams cordon_node = 15; } } @@ -87,6 +88,18 @@ message PatchDeploymentParams { string patch_strategy = 2; } +// GetResourceParams contains parameters for a get_resource action. +message GetResourceParams { + option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true; + + // OutputFormat specifies the desired output format for the resource. + // Supported values: + // "json" (default) - Output the resource as a JSON object + // "yaml" - Output the resource as a YAML string + // If not specified, defaults to "json". + string output_format = 1; +} + // KubeResource represents a Kubernetes resource to act on message KubeResource { option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;