validation

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NexusCommunityImage = "docker.io/sonatype/nexus3"
	NexusCertifiedImage = "registry.connect.redhat.com/sonatype/nexus-repository-manager"

	DefaultVolumeSize = "10Gi"
)

Variables

View Source
var (
	DefaultResources = corev1.ResourceRequirements{
		Limits: corev1.ResourceList{
			corev1.ResourceCPU:    k8sres.MustParse("2"),
			corev1.ResourceMemory: k8sres.MustParse("2Gi"),
		},
		Requests: corev1.ResourceList{
			corev1.ResourceCPU:    k8sres.MustParse("1"),
			corev1.ResourceMemory: k8sres.MustParse("2Gi"),
		},
	}

	DefaultProbe = &v1alpha1.NexusProbe{
		InitialDelaySeconds: probeDefaultInitialDelaySeconds,
		TimeoutSeconds:      probeDefaultTimeoutSeconds,
		PeriodSeconds:       probeDefaultPeriodSeconds,
		SuccessThreshold:    probeDefaultSuccessThreshold,
		FailureThreshold:    probeDefaultFailureThreshold,
	}

	DefaultPersistence = v1alpha1.NexusPersistence{
		Persistent:   false,
		VolumeSize:   DefaultVolumeSize,
		StorageClass: "",
	}

	DefaultNetworking = v1alpha1.NexusNetworking{
		Expose: false,
		TLS:    DefaultTLS,
	}

	DefaultTLS = v1alpha1.NexusNetworkingTLS{
		Mandatory:  false,
		SecretName: "",
	}

	DefaultUpdate = v1alpha1.NexusAutomaticUpdate{

		Disabled: true,
	}

	AllDefaultsCommunityNexus = v1alpha1.Nexus{
		ObjectMeta: metav1.ObjectMeta{Name: "default-community-nexus", Namespace: "default"},
		Spec: v1alpha1.NexusSpec{
			Replicas:                    0,
			Image:                       NexusCommunityImage,
			ImagePullPolicy:             "",
			AutomaticUpdate:             DefaultUpdate,
			Resources:                   DefaultResources,
			Persistence:                 DefaultPersistence,
			UseRedHatImage:              false,
			GenerateRandomAdminPassword: false,
			Networking:                  DefaultNetworking,
			ServiceAccountName:          "default-community-nexus",
			LivenessProbe:               DefaultProbe.DeepCopy(),
			ReadinessProbe:              DefaultProbe.DeepCopy(),
		},
	}
)

Functions

This section is empty.

Types

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator(client client.Client, scheme *runtime.Scheme) (*Validator, error)

NewValidator creates a new validator to set defaults, validate and update the Nexus CR

func (*Validator) SetDefaultsAndValidate

func (v *Validator) SetDefaultsAndValidate(nexus *v1alpha1.Nexus) (*v1alpha1.Nexus, error)

SetDefaultsAndValidate returns a copy of the parameter Nexus with defaults set and an error if validation fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL