Skip to content

Go CSV Markers to populate specDescriptors for "owned" CRDs from another module #6616

@kaovilai

Description

@kaovilai

Feature Request

A way to generate specDescriptors and statusDescriptors to CSV from CRD defined in _types.go in external module (ie. different go.mod) using markers

Describe the problem you need a feature to resolve.

We oadp-operator deploy CRDs that are not from the same Go module github.com/vmware-tanzu/velero/. Our go module is github.com/openshift/oadp-operator

This means we are not able to add operator-sdk Go tags to the _types.go since the github.com/vmware-tanzu/velero/ project is not operator-sdk specific.

I have an issue when ...
make bundle does not have a way to populate specDescriptors into CSV from out of module CRD. Defining specDescriptors manually also gets overwritten if I'm not mistaken.

Usecase
So we can specify which x-descriptors applies to each field to customize the UI for a field in externally and non operator-sdk specific defined _types.go
https://github.com/openshift/console/blob/master/frontend/packages/operator-lifecycle-manager/src/components/descriptors/reference/reference.md
image

Describe the solution you'd like.

A way to store define/generate specDescriptors into CSV dynamically from out of module _types.go or CRD. Perhaps by defining imported_types.go like following

// file: imported_types.go
package v1alpha1

import velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"

// To generate CSV this CRD
// spec:
//   apiservicedefinitions: {}
//   customresourcedefinitions:
//     owned:
//     - description: Backup is a Velero resource that respresents the capture of Kubernetes
//         cluster state at a point in time (API objects and associated volume state).
//       displayName: Backup
//       kind: Backup
//       name: backups.velero.io
//       statusDescriptors:
//       - description: CompletionTimestamp records the time a backup was completed.
//           Completion time is recorded even on failed backups. Completion time is recorded
//           before uploading the backup object. The server's time is used for CompletionTimestamps.
//         displayName: CompletionTimestamp
//         path: completionTimestamp

//+operator-sdk:csv:customresourcedefinitions:externalModule=true,displayName="Backup",kind=Backup,name=backupstoragelocations.velero.io
// Backup is a Velero resource that respresents the capture of Kubernetes cluster state at a point in time (API objects and associated volume state).
type importVeleroBackup velerov1.Backup

//+operator-sdk:csv:customresourcedefinitions:externalModule=true,displayName="CompletionTimestamp",path=backupstoragelocations.velero.io/completionTimestamp
// CompletionTimestamp records the time a backup was completed.
// Completion time is recorded even on failed backups. Completion time is recorded
// before uploading the backup object. The server's time is used for CompletionTimestamps.
type CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"`

/language go

Metadata

Metadata

Assignees

Labels

language/goIssue is related to a Go operator projectlifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.triage/needs-informationIndicates an issue needs more information in order to work on it.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions