Skip to content

Commit

Permalink
Merge pull request operator-framework#426 from alecmerdler/action-des…
Browse files Browse the repository at this point in the history
…criptors

Action Descriptors
  • Loading branch information
alecmerdler authored Aug 17, 2018
2 parents b5c1272 + 2b985a6 commit 489dc9e
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
27 changes: 27 additions & 0 deletions deploy/chart/templates/03-clusterserviceversion.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,33 @@ spec:
value:
type: object
description: If present, the value of this spec is the same for all instances of the CRD and can be found here instead of on the CR.
actionDescriptors:
type: array
items:
type: object
description: A spec for actions that can be performed on instances of the CRD
required:
- path
- displayName
- description
properties:
path:
type: string
description: A jsonpath indexing into the spec object on the CR where the the spec value can be found.
displayName:
type: string
description: A human-readable name for the action.
description:
type: string
description: A description of the action.
x-descriptors:
type: array
description: A list of descriptors for the action that indicate the meaning of the action.
items:
type: string
value:
type: object
description: If present, the value of this action is the same for all instances of the CRD and can be found here instead of on the CR.
required:
type: array
description: What resources this operator is responsible for managing. No two running operators should manage the same resource.
Expand Down
10 changes: 10 additions & 0 deletions pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ type SpecDescriptor struct {
Value *json.RawMessage `json:"value,omitempty"`
}

// ActionDescriptor describes a declarative action that can be performed on a custom resource instance
type ActionDescriptor struct {
Path string `json:"path"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
XDescriptors []string `json:"x-descriptors,omitempty"`
Value *json.RawMessage `json:"value,omitempty"`
}

// CRDDescription provides details to ALM about the CRDs
type CRDDescription struct {
Name string `json:"name"`
Expand All @@ -51,6 +60,7 @@ type CRDDescription struct {
Resources []CRDResourceReference `json:"resources,omitempty"`
StatusDescriptors []StatusDescriptor `json:"statusDescriptors,omitempty"`
SpecDescriptors []SpecDescriptor `json:"specDescriptors,omitempty"`
ActionDescriptor []ActionDescriptor `json:"actionDescriptors,omitempty"`
}

// CRDResourceReference is a Kubernetes resource type used by a custom resource
Expand Down
41 changes: 41 additions & 0 deletions pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 489dc9e

Please sign in to comment.