Package io.fabric8.crd.generator
Class AbstractCustomResourceHandler
- java.lang.Object
-
- io.fabric8.crd.generator.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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCustomResourceHandler(Resources resources)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddDecorators(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.protected abstract DecoratorgetPrinterColumnDecorator(String name, String version, String path, String type, String column, String description, String format)Provides the decorator implementation associated with the CRD generation version.voidhandle(CustomResourceInfo config)
-
-
-
Field Detail
-
resources
protected final Resources resources
-
-
Constructor Detail
-
AbstractCustomResourceHandler
protected AbstractCustomResourceHandler(Resources resources)
-
-
Method Detail
-
handle
public void handle(CustomResourceInfo config)
-
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 nameversion- the associated versionpath- the path from which the printer column is extractedtype- the data type of the printer columncolumn- the name of the columndescription- the description of the columnformat- 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 gatheredCustomResourceInfoused as basis for the CRD generationdef- theTypeDefassociated with theCustomResourcefrom which the CRD is generatedspecReplicasPath- an optionally detected path of field defining spec replicasstatusReplicasPath- an optionally detected path of field defining status replicaslabelSelectorPath- an optionally detected path of field defining `status.selector`statusExists-trueif theCustomResourcefrom which the CRD is generated defines a status field,falseotherwise
-
-