func Name(name string) omfunc {
	return func(o metav1.Object) {
		o.SetName(name)
	}
}
Name returns a function that sets the name of an object to that of the
passed in string.
package v1alpha1
import (
	"context"
	"errors"
	"fmt"
	"github.com/RedHatInsights/clowder/apis/cloud.redhat.com/v1alpha1/common"
	batch "k8s.io/api/batch/v1beta1"
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"sigs.k8s.io/controller-runtime/pkg/client"
)
type InitContainer struct {
	Image string `json:"image,omitempty"`
	Command []string `json:"command,omitempty"`
	Args []string `json:"args,omitempty"`
	InheritEnv bool `json:"inheritEnv,omitempty"`
	Env []v1.EnvVar `json:"env,omitempty"`
}
type DatabaseSpec struct {
	Version *int32 `json:"version,omitempty"`
	Name string `json:"name,omitempty"`
	SharedDBAppName string `json:"sharedDbAppName,omitempty"`
}
type Job struct {
	Name string `json:"name"`
	Schedule string `json:"schedule,omitempty"`
	PodSpec PodSpec `json:"podSpec"`
	RestartPolicy v1.RestartPolicy `json:"restartPolicy,omitempty"`
	ConcurrencyPolicy batch.ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`
	Suspend *bool `json:"suspend,omitempty"`
	SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"`
	FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"`
	StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty"`
}
type WebDeprecated bool
type PublicWebService struct {
	Enabled bool `json:"enabled,omitempty"`
	ApiPath string `json:"apiPath,omitempty"`
	WhitelistPaths []string `json:"whitelistPaths,omitempty"`
}
type PrivateWebService struct {
	Enabled bool `json:"enabled,omitempty"`
}
type MetricsWebService struct {
}
type WebServices struct {
	Public  PublicWebService  `json:"public,omitempty"`
	Private PrivateWebService `json:"private,omitempty"`
	Metrics MetricsWebService `json:"metrics,omitempty"`
}
type K8sAccessLevel string
type Deployment struct {
	Name string `json:"name"`
	MinReplicas *int32 `json:"minReplicas,omitempty"`
	Web WebDeprecated `json:"web,omitempty"`
	WebServices WebServices `json:"webServices,omitempty"`
	PodSpec PodSpec `json:"podSpec"`
	K8sAccessLevel K8sAccessLevel `json:"k8sAccessLevel,omitempty"`
}
type Sidecar struct {
	Name string `json:"name"`
	Enabled bool `json:"enabled"`
}
type PodSpec struct {
	Image string `json:"image,omitempty"`
	InitContainers []InitContainer `json:"initContainers,omitempty"`
	Command []string `json:"command,omitempty"`
	Args []string `json:"args,omitempty"`
	Env []v1.EnvVar `json:"env,omitempty"`
	Resources v1.ResourceRequirements `json:"resources,omitempty"`
	LivenessProbe *v1.Probe `json:"livenessProbe,omitempty"`
	ReadinessProbe *v1.Probe `json:"readinessProbe,omitempty"`
	Volumes []v1.Volume `json:"volumes,omitempty"`
	VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"`
	Sidecars []Sidecar `json:"sidecars,omitempty"`
}
type CyndiSpec struct {
	Enabled bool `json:"enabled,omitempty"`
	AppName string `json:"appName,omitempty"`
	InsightsOnly bool `json:"insightsOnly,omitempty"`
}
type KafkaTopicSpec struct {
	Config map[string]string `json:"config,omitempty"`
	Partitions int32 `json:"partitions,omitempty"`
	Replicas int32 `json:"replicas,omitempty"`
	TopicName string `json:"topicName"`
}
type TestingSpec struct {
	IqePlugin string `json:"iqePlugin"`
}
type ClowdAppSpec struct {
	Deployments []Deployment `json:"deployments,omitempty"`
	Jobs []Job `json:"jobs,omitempty"`
	EnvName string `json:"envName"`
	KafkaTopics []KafkaTopicSpec `json:"kafkaTopics,omitempty"`
	Database DatabaseSpec `json:"database,omitempty"`
	ObjectStore []string `json:"objectStore,omitempty"`
	InMemoryDB bool `json:"inMemoryDb,omitempty"`
	FeatureFlags bool `json:"featureFlags,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
	OptionalDependencies []string `json:"optionalDependencies,omitempty"`
	Testing TestingSpec `json:"testing,omitempty"`
	Cyndi CyndiSpec `json:"cyndi,omitempty"`
	Disabled bool `json:"disabled,omitempty"`
}
type ClowdConditionType string
const (
	DeploymentsReady ClowdConditionType = "DeploymentsReady"
	ReconciliationSuccessful ClowdConditionType = "ReconciliationSuccessful"
	ReconciliationPartiallySuccessful ClowdConditionType = "ReconciliationPartiallySuccessful"
	ReconciliationFailed ClowdConditionType = "ReconciliationFailed"
	JobInvocationComplete ClowdConditionType = "JobInvocationComplete"
)
type ClowdCondition struct {
	Type ClowdConditionType `json:"type"`
	Status v1.ConditionStatus `json:"status"`
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	Reason string `json:"reason,omitempty"`
	Message string `json:"message,omitempty"`
}
type ClowdAppStatus struct {
	Deployments AppResourceStatus `json:"deployments,omitempty"`
	Ready       bool              `json:"ready"`
	Conditions  []ClowdCondition  `json:"conditions,omitempty"`
}
type AppResourceStatus struct {
	ManagedDeployments int32 `json:"managedDeployments"`
	ReadyDeployments   int32 `json:"readyDeployments"`
}
type ClowdApp struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec   ClowdAppSpec   `json:"spec,omitempty"`
	Status ClowdAppStatus `json:"status,omitempty"`
}
type ClowdAppList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items []ClowdApp `json:"items"`
}
func init() {
	SchemeBuilder.Register(&ClowdApp{}, &ClowdAppList{})
}
func (i *ClowdApp) GetLabels() map[string]string {
	if i.Labels == nil {
		i.Labels = map[string]string{}
	}
	if _, ok := i.Labels["app"]; !ok {
		i.Labels["app"] = i.ObjectMeta.Name
	}
	newMap := make(map[string]string, len(i.Labels))
	for k, v := range i.Labels {
		newMap[k] = v
	}
	return newMap
}
func (i *ClowdApp) GetNamespacedName(pattern string) types.NamespacedName {
	return types.NamespacedName{
		Namespace: i.Namespace,
		Name:      fmt.Sprintf(pattern, i.Name),
	}
}
func (i *ClowdApp) GetIdent() string {
	return fmt.Sprintf("%v.%v", i.Spec.EnvName, i.Name)
}
func (i *ClowdApp) MakeOwnerReference() metav1.OwnerReference {
	return metav1.OwnerReference{
		APIVersion: i.APIVersion,
		Kind:       i.Kind,
		Name:       i.ObjectMeta.Name,
		UID:        i.ObjectMeta.UID,
		Controller: common.TruePtr(),
	}
}
func (i *ClowdApp) GetPrimaryLabel() string {
	return "app"
}
func (i *ClowdApp) GetClowdNamespace() string {
	return i.Namespace
}
func (i *ClowdApp) GetClowdName() string {
	return i.Name
}
func (i *ClowdApp) GetUID() types.UID {
	return i.ObjectMeta.UID
}
func (i *ClowdApp) GetDeploymentStatus() *AppResourceStatus {
	return &i.Status.Deployments
}
func (i *ClowdApp) GetDeploymentNamespacedName(d *Deployment) types.NamespacedName {
	return types.NamespacedName{
		Name:      fmt.Sprintf("%s-%s", i.Name, d.Name),
		Namespace: i.Namespace,
	}
}
func (i *ClowdApp) GetCronJobNamespacedName(d *Job) types.NamespacedName {
	return types.NamespacedName{
		Name:      fmt.Sprintf("%s-%s", i.Name, d.Name),
		Namespace: i.Namespace,
	}
}
func (i *ClowdApp) IsReady() bool {
	return (i.Status.Deployments.ManagedDeployments == i.Status.Deployments.ReadyDeployments)
}
func (i *ClowdApp) GetClowdSAName() string {
	return fmt.Sprintf("%s-app", i.GetClowdName())
}
type omfunc func(o metav1.Object)
func (i *ClowdApp) SetObjectMeta(o metav1.Object, opts ...omfunc) {
	o.SetName(i.Name)
	o.SetNamespace(i.Namespace)
	o.SetLabels(i.GetLabels())
	o.SetOwnerReferences([]metav1.OwnerReference{i.MakeOwnerReference()})
	for _, opt := range opts {
		opt(o)
	}
}