Skip to content

Commit

Permalink
Fixes for test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
psav committed Jan 13, 2025
1 parent 2471ea3 commit e9f16f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controllers/cloud.redhat.com/providers/autoscaler/keda.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func initAutoScaler(env *crd.ClowdEnvironment, app *crd.ClowdApp, obj client.Obj

// Set up the watcher to watch the Deployment we created earlier.
scalerSpec := keda.ScaledObjectSpec{
ScaleTargetRef: &keda.ScaleTarget{Name: obj.GetName(), Kind: obj.GetObjectKind().GroupVersionKind().Kind, APIVersion: obj.GetObjectKind().GroupVersionKind().Version},
ScaleTargetRef: &keda.ScaleTarget{Name: obj.GetName(), Kind: obj.GetObjectKind().GroupVersionKind().Kind, APIVersion: obj.GetObjectKind().GroupVersionKind().GroupVersion().String()},
PollingInterval: deployment.AutoScaler.PollingInterval,
CooldownPeriod: deployment.AutoScaler.CooldownPeriod,
Advanced: deployment.AutoScaler.Advanced,
Expand Down
10 changes: 3 additions & 7 deletions controllers/cloud.redhat.com/providers/deployment/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/controller-runtime/pkg/client"

provutils "github.com/RedHatInsights/clowder/controllers/cloud.redhat.com/providers/utils"
"github.com/RedHatInsights/rhc-osdk-utils/utils"
Expand Down Expand Up @@ -54,15 +53,15 @@ func (dp *deploymentProvider) makeStatefulSet(deployment crd.Deployment, app *cr
return dp.Cache.Update(CoreStatefulSet, s)
}

func setLocalAnnotations(env *crd.ClowdEnvironment, deployment *crd.Deployment, d client.Object, app *crd.ClowdApp) {
func setLocalAnnotations(env *crd.ClowdEnvironment, deployment *crd.Deployment, pt *core.PodTemplateSpec, app *crd.ClowdApp) {
if env.Spec.Providers.Web.Mode == "local" && (deployment.WebServices.Public.Enabled || bool(deployment.Web)) {
annotations := map[string]string{
"clowder/authsidecar-image": provutils.GetCaddyImage(env),
"clowder/authsidecar-enabled": "true",
"clowder/authsidecar-port": strconv.Itoa(int(env.Spec.Providers.Web.Port)),
"clowder/authsidecar-config": fmt.Sprintf("caddy-config-%s-%s", app.Name, deployment.Name),
}
utils.UpdateAnnotations(d, annotations)
utils.UpdateAnnotations(pt, annotations)
}
}

Expand Down Expand Up @@ -261,8 +260,6 @@ func initDeployment(app *crd.ClowdApp, env *crd.ClowdEnvironment, d *apps.Deploy

utils.UpdateAnnotations(d, app.ObjectMeta.Annotations, deployment.Metadata.Annotations)

setLocalAnnotations(env, deployment, d, app)

setMinReplicasOnDeployment(deployment, d)

d.Spec.Selector = &metav1.LabelSelector{MatchLabels: labels}
Expand Down Expand Up @@ -301,8 +298,6 @@ func initStatefulSet(app *crd.ClowdApp, env *crd.ClowdEnvironment, s *apps.State

utils.UpdateAnnotations(s, app.ObjectMeta.Annotations, deployment.Metadata.Annotations)

setLocalAnnotations(env, deployment, s, app)

setMinReplicasOnStatefulSet(deployment, s)

s.Spec.Selector = &metav1.LabelSelector{MatchLabels: labels}
Expand All @@ -320,6 +315,7 @@ func renderPodSpec(app *crd.ClowdApp, env *crd.ClowdEnvironment, nn types.Namesp
// Everything from here is for the podspec and shoulr be ripped out
pod := deployment.PodSpec
utils.UpdateAnnotations(podSpec, pod.Metadata.Annotations)
setLocalAnnotations(env, deployment, podSpec, app)

c := core.Container{
Name: nn.Name,
Expand Down

0 comments on commit e9f16f5

Please sign in to comment.