From e4544e305071da1ef18ee5c1eeb0fd094e8f027c Mon Sep 17 00:00:00 2001 From: alecmerdler Date: Wed, 15 Aug 2018 10:36:32 -0400 Subject: [PATCH] add actionDescriptors block --- .../03-clusterserviceversion.crd.yaml | 27 ++++++++++++ .../v1alpha1/clusterserviceversion_types.go | 10 +++++ .../v1alpha1/zz_generated.deepcopy.go | 41 +++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/deploy/chart/templates/03-clusterserviceversion.crd.yaml b/deploy/chart/templates/03-clusterserviceversion.crd.yaml index 8c3144666e..434a216619 100644 --- a/deploy/chart/templates/03-clusterserviceversion.crd.yaml +++ b/deploy/chart/templates/03-clusterserviceversion.crd.yaml @@ -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. diff --git a/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go b/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go index 665e84e07f..0581f2ba62 100644 --- a/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go +++ b/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go @@ -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"` @@ -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 diff --git a/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go b/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go index fbc0a12a1c..f3509e73f1 100644 --- a/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go @@ -27,6 +27,40 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ActionDescriptor) DeepCopyInto(out *ActionDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + if *in == nil { + *out = nil + } else { + *out = new(json.RawMessage) + if **in != nil { + in, out := *in, *out + *out = make([]byte, len(*in)) + copy(*out, *in) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionDescriptor. +func (in *ActionDescriptor) DeepCopy() *ActionDescriptor { + if in == nil { + return nil + } + out := new(ActionDescriptor) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AppLink) DeepCopyInto(out *AppLink) { *out = *in @@ -65,6 +99,13 @@ func (in *CRDDescription) DeepCopyInto(out *CRDDescription) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return }