Skip to content

Commit

Permalink
capitalize/export utils functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nasark committed Sep 27, 2023
1 parent f39ee8b commit c84fc13
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func ManageAppSecret(cr *miqv1alpha1.ManageIQ, client client.Client, scheme *run
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)

return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func ApplicationUiHttpdConfigMap(cr *miqv1alpha1.ManageIQ, scheme *runtime.Schem
if err := controllerutil.SetControllerReference(cr, configMap, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)

protocol := "http"

Expand Down Expand Up @@ -54,8 +54,8 @@ func ApplicationApiHttpdConfigMap(cr *miqv1alpha1.ManageIQ, scheme *runtime.Sche
if err := controllerutil.SetControllerReference(cr, configMap, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)

protocol := "http"

Expand Down Expand Up @@ -85,8 +85,8 @@ func ApplicationRemoteConsoleHttpdConfigMap(cr *miqv1alpha1.ManageIQ, scheme *ru
if err := controllerutil.SetControllerReference(cr, configMap, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)

protocol := "ws"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func ManageCR(cr *miqv1alpha1.ManageIQ, c *client.Client) (*miqv1alpha1.ManageIQ
cr.Spec.ZookeeperImage = zookeeperImage(cr)
cr.Spec.ZookeeperVolumeCapacity = zookeeperVolumeCapacity(cr)

miqutils.addBackupLabel(backupLabelName(cr), &cr.ObjectMeta)
miqutils.AddBackupLabel(backupLabelName(cr), &cr.ObjectMeta)

return nil
}
Expand Down
56 changes: 28 additions & 28 deletions manageiq-operator/api/v1alpha1/helpers/miq-components/httpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func Ingress(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*networkingv1.In
},
},
}
miqutils.addAppLabel(cr.Spec.AppName, &ingress.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &ingress.ObjectMeta)
return nil
}

Expand Down Expand Up @@ -169,7 +169,7 @@ func HttpdConfigMap(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme, client cli
if err := controllerutil.SetControllerReference(cr, configMap, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)

uiHttpProtocol, uiWebSocketProtocol := "http", "ws"
if certSecret := miqutils.InternalCertificatesSecret(cr, client); certSecret.Data["ui_crt"] != nil && certSecret.Data["ui_key"] != nil {
Expand Down Expand Up @@ -211,8 +211,8 @@ func HttpdAuthConfigMap(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*core
if err := controllerutil.SetControllerReference(cr, configMap, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &configMap.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &configMap.ObjectMeta)

configMap.Data["auth-configuration.conf"] = httpdAuthConfigurationConf()

Expand All @@ -233,7 +233,7 @@ func HttpdAuthConfig(client client.Client, cr *miqv1alpha1.ManageIQ, scheme *run
}

f := func() error {
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)
return nil
}

Expand Down Expand Up @@ -270,8 +270,8 @@ func addOIDCEnv(secretName string, podSpec *corev1.PodSpec) {
},
}

podSpec.Containers[0].Env = miqutils.addOrUpdateEnvVar(podSpec.Containers[0].Env, clientId)
podSpec.Containers[0].Env = miqutils.addOrUpdateEnvVar(podSpec.Containers[0].Env, clientSecret)
podSpec.Containers[0].Env = miqutils.AddOrUpdateEnvVar(podSpec.Containers[0].Env, clientId)
podSpec.Containers[0].Env = miqutils.AddOrUpdateEnvVar(podSpec.Containers[0].Env, clientSecret)
}

func getHttpdAuthConfigVersion(client client.Client, namespace string, spec *miqv1alpha1.ManageIQSpec) string {
Expand All @@ -288,26 +288,26 @@ func getHttpdAuthConfigVersion(client client.Client, namespace string, spec *miq

func addAuthConfigVolume(podSpec *corev1.PodSpec) {
volumeMount := corev1.VolumeMount{Name: "httpd-auth-config", MountPath: "/etc/httpd/auth-conf.d"}
podSpec.Containers[0].VolumeMounts = miqutils.addOrUpdateVolumeMount(podSpec.Containers[0].VolumeMounts, volumeMount)
podSpec.Containers[0].VolumeMounts = miqutils.AddOrUpdateVolumeMount(podSpec.Containers[0].VolumeMounts, volumeMount)

configMapVolumeSource := corev1.ConfigMapVolumeSource{LocalObjectReference: corev1.LocalObjectReference{Name: "httpd-auth-configs"}}
podSpec.Volumes = miqutils.addOrUpdateVolume(podSpec.Volumes, corev1.Volume{Name: "httpd-auth-config", VolumeSource: corev1.VolumeSource{ConfigMap: &configMapVolumeSource}})
podSpec.Volumes = miqutils.AddOrUpdateVolume(podSpec.Volumes, corev1.Volume{Name: "httpd-auth-config", VolumeSource: corev1.VolumeSource{ConfigMap: &configMapVolumeSource}})
}

func addUserAuthVolume(secretName string, podSpec *corev1.PodSpec) {
volumeMount := corev1.VolumeMount{Name: "user-auth-config", MountPath: "/etc/httpd/user-conf.d"}
podSpec.Containers[0].VolumeMounts = miqutils.addOrUpdateVolumeMount(podSpec.Containers[0].VolumeMounts, volumeMount)
podSpec.Containers[0].VolumeMounts = miqutils.AddOrUpdateVolumeMount(podSpec.Containers[0].VolumeMounts, volumeMount)

secretVolumeSource := corev1.SecretVolumeSource{SecretName: secretName}
podSpec.Volumes = miqutils.addOrUpdateVolume(podSpec.Volumes, corev1.Volume{Name: "user-auth-config", VolumeSource: corev1.VolumeSource{Secret: &secretVolumeSource}})
podSpec.Volumes = miqutils.AddOrUpdateVolume(podSpec.Volumes, corev1.Volume{Name: "user-auth-config", VolumeSource: corev1.VolumeSource{Secret: &secretVolumeSource}})
}

func addOIDCCACertVolume(secretName string, podSpec *corev1.PodSpec) {
volumeMount := corev1.VolumeMount{Name: "oidc-ca-cert", MountPath: "/etc/pki/ca-trust/source/anchors"}
podSpec.Containers[0].VolumeMounts = miqutils.addOrUpdateVolumeMount(podSpec.Containers[0].VolumeMounts, volumeMount)
podSpec.Containers[0].VolumeMounts = miqutils.AddOrUpdateVolumeMount(podSpec.Containers[0].VolumeMounts, volumeMount)

secretVolumeSource := corev1.SecretVolumeSource{SecretName: secretName}
podSpec.Volumes = miqutils.addOrUpdateVolume(podSpec.Volumes, corev1.Volume{Name: "oidc-ca-cert", VolumeSource: corev1.VolumeSource{Secret: &secretVolumeSource}})
podSpec.Volumes = miqutils.AddOrUpdateVolume(podSpec.Volumes, corev1.Volume{Name: "oidc-ca-cert", VolumeSource: corev1.VolumeSource{Secret: &secretVolumeSource}})
}

func configureHttpdAuth(spec *miqv1alpha1.ManageIQSpec, podSpec *corev1.PodSpec) {
Expand Down Expand Up @@ -389,7 +389,7 @@ func initializeHttpdContainer(spec *miqv1alpha1.ManageIQSpec, privileged bool, c

assignHttpdPorts(privileged, c)

err := miqutils.addResourceReqs(spec.HttpdMemoryLimit, spec.HttpdMemoryRequest, spec.HttpdCpuLimit, spec.HttpdCpuRequest, c)
err := miqutils.AddResourceReqs(spec.HttpdMemoryLimit, spec.HttpdMemoryRequest, spec.HttpdCpuLimit, spec.HttpdCpuRequest, c)
if err != nil {
return err
}
Expand Down Expand Up @@ -433,18 +433,18 @@ func HttpdDeployment(client client.Client, cr *miqv1alpha1.ManageIQ, scheme *run
if err := controllerutil.SetControllerReference(cr, deployment, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &deployment.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &deployment.ObjectMeta)
var repNum int32 = 1
deployment.Spec.Replicas = &repNum
deployment.Spec.Strategy = appsv1.DeploymentStrategy{
Type: "Recreate",
}
miqutils.addAnnotations(cr.Spec.AppAnnotations, &deployment.Spec.Template.ObjectMeta)
miqutils.AddAnnotations(cr.Spec.AppAnnotations, &deployment.Spec.Template.ObjectMeta)
deployment.Spec.Template.Spec.Containers = []corev1.Container{container}
deployment.Spec.Template.Spec.Containers[0].SecurityContext = miqutils.DefaultSecurityContext()

configMapVolumeSource := corev1.ConfigMapVolumeSource{LocalObjectReference: corev1.LocalObjectReference{Name: "httpd-configs"}}
deployment.Spec.Template.Spec.Volumes = miqutils.addOrUpdateVolume(deployment.Spec.Template.Spec.Volumes, corev1.Volume{Name: "httpd-config", VolumeSource: corev1.VolumeSource{ConfigMap: &configMapVolumeSource}})
deployment.Spec.Template.Spec.Volumes = miqutils.AddOrUpdateVolume(deployment.Spec.Template.Spec.Volumes, corev1.Volume{Name: "httpd-config", VolumeSource: corev1.VolumeSource{ConfigMap: &configMapVolumeSource}})

// Only assign the service account if we need additional privileges
if privileged {
Expand All @@ -457,18 +457,18 @@ func HttpdDeployment(client client.Client, cr *miqv1alpha1.ManageIQ, scheme *run

// This is not used by the pod, it is defined to trigger a redeployment if the secret was updated
httpdAuthConfigVersion := getHttpdAuthConfigVersion(client, cr.Namespace, &cr.Spec)
deployment.Spec.Template.Spec.Containers[0].Env = miqutils.addOrUpdateEnvVar(deployment.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{Name: "MANAGED_HTTPD_CFG_VERSION", Value: httpdAuthConfigVersion})
deployment.Spec.Template.Spec.Containers[0].Env = miqutils.AddOrUpdateEnvVar(deployment.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{Name: "MANAGED_HTTPD_CFG_VERSION", Value: httpdAuthConfigVersion})

miqutils.addInternalCertificate(cr, deployment, client, "httpd", "/root")
miqutils.AddInternalCertificate(cr, deployment, client, "httpd", "/root")

secret := miqutils.InternalCertificatesSecret(cr, client)
if secret.Data["root_crt"] != nil {
volumeName := "internal-root-certificate"
volumeMount := corev1.VolumeMount{Name: volumeName, MountPath: "/etc/pki/ca-trust/source/anchors", ReadOnly: true}
deployment.Spec.Template.Spec.Containers[0].VolumeMounts = miqutils.addOrUpdateVolumeMount(deployment.Spec.Template.Spec.Containers[0].VolumeMounts, volumeMount)
deployment.Spec.Template.Spec.Containers[0].VolumeMounts = miqutils.AddOrUpdateVolumeMount(deployment.Spec.Template.Spec.Containers[0].VolumeMounts, volumeMount)

secretVolumeSource := corev1.SecretVolumeSource{SecretName: secret.Name, Items: []corev1.KeyToPath{corev1.KeyToPath{Key: "root_crt", Path: "root.crt"}}}
deployment.Spec.Template.Spec.Volumes = miqutils.addOrUpdateVolume(deployment.Spec.Template.Spec.Volumes, corev1.Volume{Name: volumeName, VolumeSource: corev1.VolumeSource{Secret: &secretVolumeSource}})
deployment.Spec.Template.Spec.Volumes = miqutils.AddOrUpdateVolume(deployment.Spec.Template.Spec.Volumes, corev1.Volume{Name: volumeName, VolumeSource: corev1.VolumeSource{Secret: &secretVolumeSource}})
}

return nil
Expand All @@ -489,7 +489,7 @@ func UIService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1.Servic
if err := controllerutil.SetControllerReference(cr, service, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand All @@ -514,7 +514,7 @@ func WebService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1.Servi
if err := controllerutil.SetControllerReference(cr, service, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand All @@ -539,7 +539,7 @@ func RemoteConsoleService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*co
if err := controllerutil.SetControllerReference(cr, service, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand All @@ -564,7 +564,7 @@ func HttpdService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1.Ser
if err := controllerutil.SetControllerReference(cr, service, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand All @@ -589,7 +589,7 @@ func HttpdDbusAPIService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*cor
if err := controllerutil.SetControllerReference(cr, service, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand All @@ -616,8 +616,8 @@ func ManageTlsSecret(cr *miqv1alpha1.ManageIQ, client client.Client, scheme *run
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)

return nil
}
Expand Down
42 changes: 21 additions & 21 deletions manageiq-operator/api/v1alpha1/helpers/miq-components/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func ManageKafkaSecret(cr *miqv1alpha1.ManageIQ, client client.Client, scheme *r
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)

return nil
}
Expand All @@ -53,8 +53,8 @@ func defaultKafkaSecret(cr *miqv1alpha1.ManageIQ) *corev1.Secret {
StringData: secretData,
}

miqutils.addAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &secret.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &secret.ObjectMeta)

return secret
}
Expand Down Expand Up @@ -93,8 +93,8 @@ func KafkaPVC(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1.Persist
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &pvc.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &pvc.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &pvc.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &pvc.ObjectMeta)
pvc.Spec.AccessModes = accessModes
pvc.Spec.Resources = resources

Expand Down Expand Up @@ -132,8 +132,8 @@ func ZookeeperPVC(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1.Per
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &pvc.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &pvc.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &pvc.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &pvc.ObjectMeta)
pvc.Spec.AccessModes = accessModes
pvc.Spec.Resources = resources

Expand All @@ -159,7 +159,7 @@ func KafkaService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1.Ser
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand All @@ -185,7 +185,7 @@ func ZookeeperService(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*corev1
return err
}

miqutils.addAppLabel(cr.Spec.AppName, &service.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &service.ObjectMeta)
if len(service.Spec.Ports) == 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{})
}
Expand Down Expand Up @@ -264,7 +264,7 @@ func KafkaDeployment(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*appsv1.
},
}

err := miqutils.addResourceReqs(cr.Spec.KafkaMemoryLimit, cr.Spec.KafkaMemoryRequest, cr.Spec.KafkaCpuLimit, cr.Spec.KafkaCpuRequest, &container)
err := miqutils.AddResourceReqs(cr.Spec.KafkaMemoryLimit, cr.Spec.KafkaMemoryRequest, cr.Spec.KafkaCpuLimit, cr.Spec.KafkaCpuRequest, &container)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -292,10 +292,10 @@ func KafkaDeployment(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*appsv1.
if err := controllerutil.SetControllerReference(cr, deployment, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &deployment.ObjectMeta)
miqutils.addBackupAnnotation("kafka-data", &deployment.Spec.Template.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &deployment.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &deployment.Spec.Template.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &deployment.ObjectMeta)
miqutils.AddBackupAnnotation("kafka-data", &deployment.Spec.Template.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &deployment.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &deployment.Spec.Template.ObjectMeta)
var repNum int32 = 1
deployment.Spec.Replicas = &repNum
deployment.Spec.Strategy = appsv1.DeploymentStrategy{
Expand Down Expand Up @@ -348,7 +348,7 @@ func ZookeeperDeployment(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*app
},
}

err := miqutils.addResourceReqs(cr.Spec.ZookeeperMemoryLimit, cr.Spec.ZookeeperMemoryRequest, cr.Spec.ZookeeperCpuLimit, cr.Spec.ZookeeperCpuRequest, &container)
err := miqutils.AddResourceReqs(cr.Spec.ZookeeperMemoryLimit, cr.Spec.ZookeeperMemoryRequest, cr.Spec.ZookeeperCpuLimit, cr.Spec.ZookeeperCpuRequest, &container)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -376,16 +376,16 @@ func ZookeeperDeployment(cr *miqv1alpha1.ManageIQ, scheme *runtime.Scheme) (*app
if err := controllerutil.SetControllerReference(cr, deployment, scheme); err != nil {
return err
}
miqutils.addAppLabel(cr.Spec.AppName, &deployment.ObjectMeta)
miqutils.addBackupAnnotation("zookeeper-data", &deployment.Spec.Template.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &deployment.ObjectMeta)
miqutils.addBackupLabel(cr.Spec.BackupLabelName, &deployment.Spec.Template.ObjectMeta)
miqutils.AddAppLabel(cr.Spec.AppName, &deployment.ObjectMeta)
miqutils.AddBackupAnnotation("zookeeper-data", &deployment.Spec.Template.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &deployment.ObjectMeta)
miqutils.AddBackupLabel(cr.Spec.BackupLabelName, &deployment.Spec.Template.ObjectMeta)
var repNum int32 = 1
deployment.Spec.Replicas = &repNum
deployment.Spec.Strategy = appsv1.DeploymentStrategy{
Type: "Recreate",
}
miqutils.addAnnotations(cr.Spec.AppAnnotations, &deployment.Spec.Template.ObjectMeta)
miqutils.AddAnnotations(cr.Spec.AppAnnotations, &deployment.Spec.Template.ObjectMeta)
deployment.Spec.Template.Spec.Containers = []corev1.Container{container}
deployment.Spec.Template.Spec.Containers[0].SecurityContext = miqutils.DefaultSecurityContext()
deployment.Spec.Template.Spec.ServiceAccountName = defaultServiceAccountName(cr.Spec.AppName)
Expand Down
Loading

0 comments on commit c84fc13

Please sign in to comment.