Skip to content

✨ Support json-schema declaration on Task and Addon CRs. #838

@jortel

Description

@jortel

Add supprt for json-schema (jsd) declaration on Task and Addon CRs. The task manager would validate the Task.Data to comply with the schema. Also, we can generate documentation using community tools.

The task manager will ensure that the schema defined on an Addon CR does not conflict with the schema defined on a Task for which it declares it implements.

Here is an example addon CR with schema (jsd) defined for the addon-analyzer:

spec:
  container:
    image: quay.io/konveyor/tackle2-addon-analyzer:latest
    imagePullPolicy: Always
    name: addon
    resources:
      limits:
        cpu: 1
        memory: 1Gi
      requests:
        cpu: 1
        memory: 512Mi
  task: analyzer
  schema: analyzer

The schema would be defined in a new CR that may look something like this (but with better descriptions):

apiVersion: tackle.konveyor.io/v1alpha1
kind: Schema
metadata:
  name: analyzer
  namespace: konveyor-tackle
spec:
    $schema: "http://json-schema.org/draft-07/schema#"
    type: object
    properties:
      verbosity:
        type: integer
        description: Verbosity level.
      mode:
        type: object
        description: Mode options.
        properties:
          discovery:
            type: boolean
            description: Enable discovery mode.
          binary:
            type: boolean
            description: Enable binary mode.
          artifact:
            type: string
            description: Artifact name or path.
          withDeps:
            type: boolean
            description: Include dependencies.
      scope:
        type: object
        description: Scope options.
        properties:
          withKnownLibs:
            type: boolean
            description: Include known libraries.
          packages:
            type: object
            description: Package filtering options.
            properties:
              included:
                type: array
                description: Included packages.
                items:
                  type: string
              excluded:
                type: array
                description: Excluded packages.
                items:
                  type: string
      rules:
        type: object
        description: Rules options.
        properties:
          path:
            type: string
            description: Path to rules.
          repository:
            type: object
            description: Repository information.
            properties:
              kind:
                type: string
                description: Repository kind.
              url:
                type: string
                description: Repository URL.
              branch:
                type: string
                description: Repository branch.
              tag:
                type: string
                description: Repository tag.
              path:
                type: string
                description: Path inside repository.
          identity:
            type: object
            description: Identity reference.
            required: [id]
            properties:
              id:
                type: integer
                minimum: 1
                description: Identity ID.
          labels:
            type: object
            description: Label filtering options.
            properties:
              included:
                type: array
                description: Included labels.
                items:
                  type: string
              excluded:
                type: array
                description: Excluded labels.
                items:
                  type: string
          ruleSets:
            type: array
            description: List of rule sets.
            items:
              type: object
              required: [id]
              properties:
                id:
                  type: integer
                  minimum: 1
                  description: Rule set ID.
      tagger:
        type: object
        description: Tagger options.
        properties:
          enabled:
            type: boolean
            description: Enable tagging.
          source:
            type: string
            description: Tagger source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-priorityIndicates an issue or PR lacks a `priority/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    Status

    🔖 Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions