Class AbstractCustomResourceHandler

  • Direct Known Subclasses:
    CustomResourceHandler, CustomResourceHandler

    public abstract class AbstractCustomResourceHandler
    extends Object
    This class encapsulates the common behavior between v1beta1 and v1 CRD generation logic. The intent is that each CRD spec version is implemented as a sub-class of this one.
    • Field Detail

      • resources

        protected final Resources resources
    • Constructor Detail

      • AbstractCustomResourceHandler

        protected AbstractCustomResourceHandler​(Resources resources)
    • Method Detail

      • getPrinterColumnDecorator

        protected abstract Decorator getPrinterColumnDecorator​(String name,
                                                               String version,
                                                               String path,
                                                               String type,
                                                               String column,
                                                               String description,
                                                               String format)
        Provides the decorator implementation associated with the CRD generation version.
        Parameters:
        name - the resource name
        version - the associated version
        path - the path from which the printer column is extracted
        type - the data type of the printer column
        column - the name of the column
        description - the description of the column
        format - the format of the printer column
        Returns:
        the concrete decorator implementing the addition of a printer column to the currently built CRD
      • addDecorators

        protected abstract void addDecorators​(CustomResourceInfo config,
                                              io.sundr.codegen.model.TypeDef def,
                                              Optional<String> specReplicasPath,
                                              Optional<String> statusReplicasPath,
                                              Optional<String> labelSelectorPath,
                                              boolean statusExists)
        Adds all the necessary decorators to build the specific CRD version. For optional paths, see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#customresourcesubresourcescale-v1-apiextensions-k8s-io These paths
        Parameters:
        config - the gathered CustomResourceInfo used as basis for the CRD generation
        def - the TypeDef associated with the CustomResource from which the CRD is generated
        specReplicasPath - an optionally detected path of field defining spec replicas
        statusReplicasPath - an optionally detected path of field defining status replicas
        labelSelectorPath - an optionally detected path of field defining `status.selector`
        statusExists - true if the CustomResource from which the CRD is generated defines a status field, false otherwise