func (nConfig *NodeConfig) GetResources() *corev1.ResourceRequirements {
	if nConfig.ResourcesRequirements != nil {
		return nConfig.ResourcesRequirements
	}
	return &corev1.ResourceRequirements{
		Limits: corev1.ResourceList{
			"cpu":    resource.MustParse("1000m"),
			"memory": resource.MustParse("1Gi"),
		},
		Requests: corev1.ResourceList{
			"cpu":    resource.MustParse("1000m"),
			"memory": resource.MustParse("1Gi"),
		},
	}
}
GetResources returns the nifi node specific Kubernetes resource
package v1alpha1
import (
	"strings"
	cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
	ClusterListenerType    = "cluster"
	HttpListenerType       = "http"
	HttpsListenerType      = "https"
	S2sListenerType        = "s2s"
	prometheusListenerType = "prometheus"
)
type NifiClusterSpec struct {
	ClientType ClientConfigType `json:"clientType,omitempty"`
	Type ClusterType `json:"type,omitempty"`
	NodeURITemplate string `json:"nodeURITemplate,omitempty"`
	NifiURI string `json:"nifiURI,omitempty"`
	RootProcessGroupId string `json:"rootProcessGroupId,omitempty"`
	SecretRef SecretReference `json:"secretRef,omitempty"`
	ProxyUrl string `json:"proxyUrl,omitempty"`
	Service ServicePolicy `json:"service,omitempty"`
	Pod PodPolicy `json:"pod,omitempty"`
	ZKAddress string `json:"zkAddress,omitempty"`
	ZKPath string `json:"zkPath,omitempty"`
	InitContainerImage string `json:"initContainerImage,omitempty"`
	InitContainers []corev1.Container `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"`
	ClusterImage string `json:"clusterImage,omitempty"`
	OneNifiNodePerNode bool `json:"oneNifiNodePerNode,omitempty"`
	PropagateLabels bool `json:"propagateLabels,omitempty"`
	ManagedAdminUsers []ManagedUser `json:"managedAdminUsers,omitempty"`
	ManagedReaderUsers []ManagedUser `json:"managedReaderUsers,omitempty"`
	ReadOnlyConfig ReadOnlyConfig `json:"readOnlyConfig,omitempty"`
	NodeConfigGroups map[string]NodeConfig `json:"nodeConfigGroups,omitempty"`
	Nodes []Node `json:"nodes"`
	DisruptionBudget DisruptionBudget `json:"disruptionBudget,omitempty"`
	LdapConfiguration LdapConfiguration `json:"ldapConfiguration,omitempty"`
	NifiClusterTaskSpec NifiClusterTaskSpec `json:"nifiClusterTaskSpec,omitempty"`
	ListenersConfig *ListenersConfig `json:"listenersConfig,omitempty"`
	SidecarConfigs []corev1.Container `json:"sidecarConfigs,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"`
	ExternalServices []ExternalServiceConfig `json:"externalServices,omitempty"`
}
type DisruptionBudget struct {
	Create bool `json:"create,omitempty"`
	Budget string `json:"budget,omitempty"`
}
type ServicePolicy struct {
	HeadlessEnabled bool `json:"headlessEnabled"`
	Annotations map[string]string `json:"annotations,omitempty"`
}
type PodPolicy struct {
	Annotations map[string]string `json:"annotations,omitempty"`
}
type RollingUpgradeStatus struct {
	LastSuccess string `json:"lastSuccess"`
	ErrorCount int `json:"errorCount"`
}
type Node struct {
	Id int32 `json:"id"`
	NodeConfigGroup string `json:"nodeConfigGroup,omitempty"`
	ReadOnlyConfig *ReadOnlyConfig `json:"readOnlyConfig,omitempty"`
	NodeConfig *NodeConfig `json:"nodeConfig,omitempty"`
}
type ReadOnlyConfig struct {
	MaximumTimerDrivenThreadCount *int32 `json:"maximumTimerDrivenThreadCount,omitempty"`
	AdditionalSharedEnvs []corev1.EnvVar `json:"additionalSharedEnvs,omitempty"`
	NifiProperties NifiProperties `json:"nifiProperties,omitempty"`
	ZookeeperProperties ZookeeperProperties `json:"zookeeperProperties,omitempty"`
	BootstrapProperties BootstrapProperties `json:"bootstrapProperties,omitempty"`
	LogbackConfig LogbackConfig `json:"logbackConfig,omitempty"`
	BootstrapNotificationServicesReplaceConfig BootstrapNotificationServicesConfig `json:"bootstrapNotificationServicesConfig,omitempty"`
}
type NifiProperties struct {
	OverrideConfigMap *ConfigmapReference `json:"overrideConfigMap,omitempty"`
	OverrideConfigs string `json:"overrideConfigs,omitempty"`
	OverrideSecretConfig *SecretConfigReference `json:"overrideSecretConfig,omitempty"`
	WebProxyHosts []string `json:"webProxyHosts,omitempty"`
	NeedClientAuth bool `json:"needClientAuth,omitempty"`
	Authorizer string `json:"authorizer,omitempty"`
}
type ZookeeperProperties struct {
	OverrideConfigMap *ConfigmapReference `json:"overrideConfigMap,omitempty"`
	OverrideConfigs string `json:"overrideConfigs,omitempty"`
	OverrideSecretConfig *SecretConfigReference `json:"overrideSecretConfig,omitempty"`
}
type BootstrapProperties struct {
	NifiJvmMemory string `json:"nifiJvmMemory,omitempty"`
	OverrideConfigMap *ConfigmapReference `json:"overrideConfigMap,omitempty"`
	OverrideConfigs string `json:"overrideConfigs,omitempty"`
	OverrideSecretConfig *SecretConfigReference `json:"overrideSecretConfig,omitempty"`
}
type LogbackConfig struct {
	ReplaceConfigMap *ConfigmapReference `json:"replaceConfigMap,omitempty"`
	ReplaceSecretConfig *SecretConfigReference `json:"replaceSecretConfig,omitempty"`
}
type BootstrapNotificationServicesConfig struct {
	ReplaceConfigMap *ConfigmapReference `json:"replaceConfigMap,omitempty"`
	ReplaceSecretConfig *SecretConfigReference `json:"replaceSecretConfig,omitempty"`
}
type NodeConfig struct {
	ProvenanceStorage string `json:"provenanceStorage,omitempty"`
	RunAsUser *int64 `json:"runAsUser,omitempty"`
	FSGroup *int64 `json:"fsGroup,omitempty"`
	IsNode *bool `json:"isNode,omitempty"`
	Image string `json:"image,omitempty"`
	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
	NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty"`
	StorageConfigs []StorageConfig `json:"storageConfigs,omitempty"`
	ServiceAccountName string `json:"serviceAccountName,omitempty"`
	ResourcesRequirements *corev1.ResourceRequirements `json:"resourcesRequirements,omitempty"`
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	NodeAnnotations map[string]string `json:"nifiAnnotations,omitempty"`
}
type StorageConfig struct {
	Name string `json:"name"`
	MountPath string `json:"mountPath"`
	PVCSpec *corev1.PersistentVolumeClaimSpec `json:"pvcSpec"`
}
type ListenersConfig struct {
	InternalListeners []InternalListenerConfig `json:"internalListeners"`
	SSLSecrets *SSLSecrets `json:"sslSecrets,omitempty"`
	ClusterDomain string `json:"clusterDomain,omitempty"`
	UseExternalDNS bool `json:"useExternalDNS,omitempty"`
}
type SSLSecrets struct {
	TLSSecretName string `json:"tlsSecretName"`
	Create bool `json:"create,omitempty"`
	ClusterScoped bool `json:"clusterScoped,omitempty"`
	IssuerRef *cmmeta.ObjectReference `json:"issuerRef,omitempty"`
	PKIBackend PKIBackend `json:"pkiBackend,omitempty"`
}
type InternalListenerConfig struct {
	Type string `json:"type,omitempty"`
	Name string `json:"name"`
	ContainerPort int32 `json:"containerPort"`
}
type ExternalServiceConfig struct {
	Name string `json:"name"`
	ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
	Spec ExternalServiceSpec `json:"spec"`
}
type ExternalServiceSpec struct {
	PortConfigs []PortConfig `json:"portConfigs"`
	ClusterIP string `json:"clusterIP,omitempty" protobuf:"bytes,3,opt,name=clusterIP"`
	Type corev1.ServiceType `json:"type,omitempty" protobuf:"bytes,4,opt,name=type,casttype=ServiceType"`
	ExternalIPs []string `json:"externalIPs,omitempty" protobuf:"bytes,5,rep,name=externalIPs"`
	LoadBalancerIP string `json:"loadBalancerIP,omitempty" protobuf:"bytes,8,opt,name=loadBalancerIP"`
	LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty" protobuf:"bytes,9,opt,name=loadBalancerSourceRanges"`
	ExternalName string `json:"externalName,omitempty" protobuf:"bytes,10,opt,name=externalName"`
}
type PortConfig struct {
	Port int32 `json:"port" protobuf:"varint,3,opt,name=port"`
	InternalListenerName string `json:"internalListenerName"`
}
type LdapConfiguration struct {
	Enabled bool `json:"enabled,omitempty"`
	Url string `json:"url,omitempty"`
	SearchBase string `json:"searchBase,omitempty"`
	SearchFilter string `json:"searchFilter,omitempty"`
}
type NifiClusterTaskSpec struct {
	RetryDurationMinutes int `json:"retryDurationMinutes"`
}
type NifiClusterStatus struct {
	NodesState map[string]NodeState `json:"nodesState,omitempty"`
	State ClusterState `json:"state"`
	RollingUpgrade RollingUpgradeStatus `json:"rollingUpgradeStatus,omitempty"`
	RootProcessGroupId string `json:"rootProcessGroupId,omitempty"`
	PrometheusReportingTask PrometheusReportingTaskStatus `json:"prometheusReportingTask,omitempty"`
}
type PrometheusReportingTaskStatus struct {
	Id string `json:"id"`
	Version int64 `json:"version"`
}
type NifiCluster struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec   NifiClusterSpec   `json:"spec,omitempty"`
	Status NifiClusterStatus `json:"status,omitempty"`
}
type NifiClusterList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NifiCluster `json:"items"`
}
func init() {
	SchemeBuilder.Register(&NifiCluster{}, &NifiClusterList{})
}
type ManagedUser struct {
	Identity string `json:"identity,omitempty"`
	Name string `json:"name"`
}
func (u *ManagedUser) GetIdentity() string {
	if u.Identity == "" {
		return u.Name
	}
	return u.Identity
}
func (nSpec *NifiClusterSpec) GetZkPath() string {
	const prefix = "/"
	if nSpec.ZKPath == "" {
		return prefix
	} else if !strings.HasPrefix(nSpec.ZKPath, prefix) {
		return prefix + nSpec.ZKPath
	} else {
		return nSpec.ZKPath
	}
}
func (nSpec *NifiClusterSpec) GetInitContainerImage() string {
	if nSpec.InitContainerImage == "" {
		return "busybox"
	}
	return nSpec.InitContainerImage
}
func (lConfig *ListenersConfig) GetClusterDomain() string {
	if len(lConfig.ClusterDomain) == 0 {
		return "cluster.local"
	}
	return lConfig.ClusterDomain
}
func (nReadOnlyConfig *ReadOnlyConfig) GetMaximumTimerDrivenThreadCount() int32 {
	if nReadOnlyConfig.MaximumTimerDrivenThreadCount == nil {
		return 10
	}
	return *nReadOnlyConfig.MaximumTimerDrivenThreadCount
}
func (nTaskSpec *NifiClusterTaskSpec) GetDurationMinutes() float64 {
	if nTaskSpec.RetryDurationMinutes == 0 {
		return 5
	}
	return float64(nTaskSpec.RetryDurationMinutes)
}
func (nConfig *NodeConfig) GetServiceAccount() string {
	if nConfig.ServiceAccountName != "" {
		return nConfig.ServiceAccountName
	}
	return "default"
}
func (nConfig *NodeConfig) GetTolerations() []corev1.Toleration {
	return nConfig.Tolerations
}
func (nConfig *NodeConfig) GetNodeSelector() map[string]string {
	return nConfig.NodeSelector
}
func (nConfig *NodeConfig) GetImagePullSecrets() []corev1.LocalObjectReference {
	return nConfig.ImagePullSecrets
}
func (nConfig *NodeConfig) GetImagePullPolicy() corev1.PullPolicy {
	return nConfig.ImagePullPolicy
}
func (nConfig *NodeConfig) GetNodeAnnotations() map[string]string {
	return nConfig.NodeAnnotations
}