Skip to content

Commit

Permalink
Merge pull request #860 from austincunningham/THREESCALE-7864
Browse files Browse the repository at this point in the history
THREESCALE-7864 set async by default on backend work
  • Loading branch information
austincunningham committed Aug 25, 2023
2 parents 2c8a019 + b3f3fc9 commit 2757379
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/3scale/amp/component/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ func (backend *Backend) buildBackendWorkerEnv() []v1.EnvVar {
result := []v1.EnvVar{}
result = append(result, backend.buildBackendCommonEnv()...)
result = append(result,
helper.EnvVarFromValue("CONFIG_REDIS_ASYNC", "1"),
helper.EnvVarFromSecret("CONFIG_EVENTS_HOOK", "system-events-hook", "URL"),
helper.EnvVarFromSecret("CONFIG_EVENTS_HOOK_SHARED_SECRET", "system-events-hook", "PASSWORD"),
)
Expand Down
15 changes: 15 additions & 0 deletions pkg/reconcilers/deploymentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/3scale/3scale-operator/pkg/3scale/amp/component"
"github.com/3scale/3scale-operator/pkg/common"
"github.com/3scale/3scale-operator/pkg/helper"
)
Expand Down Expand Up @@ -54,9 +55,23 @@ func GenericBackendMutators() []DCMutateFn {
DeploymentConfigPriorityClassMutator,
DeploymentConfigTopologySpreadConstraintsMutator,
DeploymentConfigPodTemplateAnnotationsMutator,
DeploymentConfigEnvMutator,
}
}

func DeploymentConfigEnvMutator(desired, existing *appsv1.DeploymentConfig) (bool, error) {
update := false
if desired.Name == component.BackendWorkerName {
if !reflect.DeepEqual(existing.Spec.Template.Spec.Containers[0].Env, desired.Spec.Template.Spec.Containers[0].Env) {
diff := cmp.Diff(existing.Spec.Template.Spec.Containers[0].Env, desired.Spec.Template.Spec.Containers[0].Env)
log.Info(fmt.Sprintf("%s spec.template.spec.containers[0].Env has changed: %s", common.ObjectInfo(desired), diff))
existing.Spec.Template.Spec.Containers[0].Env = desired.Spec.Template.Spec.Containers[0].Env
update = true
}
}
return update, nil
}

func DeploymentConfigReplicasMutator(desired, existing *appsv1.DeploymentConfig) (bool, error) {
update := false

Expand Down

0 comments on commit 2757379

Please sign in to comment.