Skip to content

Commit

Permalink
update structs and crd
Browse files Browse the repository at this point in the history
Signed-off-by: jnathangreeg <[email protected]>
  • Loading branch information
jnathangreeg committed Sep 16, 2024
1 parent 872ac1c commit 6de3cc1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 93 deletions.
62 changes: 0 additions & 62 deletions pkg/command/crds/crd-status-subresource.yaml

This file was deleted.

74 changes: 53 additions & 21 deletions pkg/command/crds/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
spec:
group: kubescape.io
names:
kind: OperatorCommand
plural: operatorcommands
singular: operatorcommand
kind: OperatorCommand
shortNames:
- opcmd
scope: Cluster
Expand All @@ -16,7 +16,6 @@ spec:
served: true
storage: true
schema:
# schema used for validation
openAPIV3Schema:
type: object
properties:
Expand All @@ -27,29 +26,62 @@ spec:
type: string
commandType:
type: string
commandVersion:
type: string
nullable: true
designators:
type: array
items:
type: object
additionalProperties: true
body:
type: string
format: byte
nullable: true
ttl:
type: string
format: duration
nullable: true
args:
type: object
additionalProperties: true
nullable: true
commandIndex:
type: integer
nullable: true
commandCount:
type: integer
nullable: true
status:
started:
type: boolean
startedAt:
allOf:
- $ref: '#/components/schemas/io.k8s.apimachinery.pkg.apis.meta.v1.Time'
completed:
type: boolean
completedAt:
allOf:
- $ref: '#/components/schemas/io.k8s.apimachinery.pkg.apis.meta.v1.Time'
error:
type: object
properties:
reason:
type: string
message:
type: string
errorCode:
type: integer
type: object
properties:
started:
type: boolean
startedAt:
type: string
format: date-time
nullable: true
completed:
type: boolean
completedAt:
type: string
format: date-time
nullable: true
executer:
type: string
nullable: true
error:
type: object
nullable: true
properties:
reason:
type: string
nullable: true
message:
type: string
nullable: true
errorCode:
type: integer
nullable: true
subresources:
status: {}
8 changes: 8 additions & 0 deletions pkg/command/types/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ const (
OperatorCommandKind string = "OperatorCommand"
OperatorCommandPlural string = "operatorcommands"
)

type ResponseType struct {
PodName string `json:"podName,omitempty"`
NameSpace string `json:"namespace,omitempty"`
ContainerName string `json:"containerName,omitempty"`
Pid *uint32 `json:"pid,omitempty"`
Action string `json:"action,omitempty"`
}
19 changes: 9 additions & 10 deletions pkg/command/types/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ type OperatorCommand struct {
}

type OperatorCommandSpec struct {
GUID string `json:"guid"` // GUID is a unique identifier for the command
CommandType string `json:"commandType"` // CommandType is the type of the command
CommandVersion string `json:"commandVersion,omitempty"` // CommandVersion is the version of the command
Labels map[string]string `json:"labels,omitempty"` // Labels are the labels for the command
Designators []identifiers.PortalDesignator `json:"designators,omitempty"` // Designators are the designators for the command
Body []byte `json:"body,omitempty"` // Body is the body of the command
TTL time.Duration `json:"ttl,omitempty"` // TTL is the time to live for the command
Args map[string]interface{} `json:"args,omitempty"` // Args are the arguments for the command
CommandIndex *int `json:"commandIndex,omitempty"` // CommandIndex is the index of the command in the sequence
CommandCount *int `json:"commandCount,omitempty"` // CommandCount is the total number of commands in the sequence
GUID string `json:"guid"` // GUID is a unique identifier for the command
CommandType string `json:"commandType"` // CommandType is the type of the command
CommandVersion string `json:"commandVersion,omitempty"` // CommandVersion is the version of the command
Designators []identifiers.PortalDesignator `json:"designators,omitempty"` // Designators are the designators for the command
Body []byte `json:"body,omitempty"` // Body is the body of the command
TTL time.Duration `json:"ttl,omitempty"` // TTL is the time to live for the command
Args map[string]interface{} `json:"args,omitempty"` // Args are the arguments for the command
CommandIndex *int `json:"commandIndex,omitempty"` // CommandIndex is the index of the command in the sequence
CommandCount *int `json:"commandCount,omitempty"` // CommandCount is the total number of commands in the sequence
}

type OperatorCommandStatus struct {
Expand Down

0 comments on commit 6de3cc1

Please sign in to comment.