Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider the ability to add verifier hinting to CRDs that will be generated against #4

Open
jessesanford opened this issue Jul 12, 2023 · 1 comment
Assignees

Comments

@jessesanford
Copy link

jessesanford commented Jul 12, 2023

Thinking about the developer workflow for the CRDs that will drive the backstage templates, it would be helpful to allow developers to simply add their dependencies inline somehow.

Consider a developer who is rapidly iterating on creating a composition that contains multiple resources possibly from multiple "providers" (crossplane or other operators)z

Do we really want them to have to jump out and create verifiers and pass those verifiers into the generation command? It would be handy to just "Hint" with annotations or inline comments what dependencies should be used as they go.

We could then plug this into CI or possibly some TDD solution so that changes to compositions are verified automatically upon commit or even filesystem change of a CRD.

@nimakaviani
Copy link
Contributor

yes this is a very good point and what the CLI already does. consider the following command:

> ./cnoe template crd \
  --inputDir examples/ack-crds \
  --outputDir /tmp/templates-ack-deploy \
  --templatePath config/templates/k8s-apply-template.yaml \
  --namespaced \
  --verifier ack-s3 \
  --templateName deploy-ack-resource \
  --templateTitle "Deploy ACK Resource" \
  --templateDescription "Deploy ACK Resource to Kubernetes"

indicating that the generated template needs to use ack-s3 will result in the following output Backstage template (omitting details):

properties:
  apiVersion:
    default: s3.services.k8s.aws/v1alpha1
    description: APIVersion for the resource
    type: string
  config:
    description: "BucketSpec defines the desired state of Bucket. \n In terms of implementation,
      a Bucket is a resource. An Amazon S3 bucket name is globally unique, and the
      namespace is shared by all Amazon Web Services accounts."
    properties:
      accelerate:
        description: Container for setting the transfer acceleration state.
        properties:
          name:
            type: string
          .... // other stuff
    required:
    - name
    title: s3.services.k8s.aws.Bucket configuration options
    type: object
  kind:
    default: Bucket
    description: Kind for the resource
    type: string
  namespace:
    description: Namespace for the resource
    namespace: default
    type: string
  resources:
    enum:
    - s3.services.k8s.aws.Bucket
  verifiers:
    default:
    - ack-s3
    description: verifiers to be used against the resource
    items:
      type: string
    type: array

the verifier gets added to the CRD / XRD open API object definition as a parameter that can take on a value with the default set to the parameter passed in. This way each generated template carries the verifiers it needs to correspond too. there might be better ways to automate this that we need to think about, but my thinking is very much aligned with yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants