diff --git a/pkg/3scale/amp/component/backend.go b/pkg/3scale/amp/component/backend.go index 8e14eb209..dafc32c10 100644 --- a/pkg/3scale/amp/component/backend.go +++ b/pkg/3scale/amp/component/backend.go @@ -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"), ) diff --git a/pkg/reconcilers/deploymentconfig.go b/pkg/reconcilers/deploymentconfig.go index 25738dc46..39b76989b 100644 --- a/pkg/reconcilers/deploymentconfig.go +++ b/pkg/reconcilers/deploymentconfig.go @@ -2,6 +2,7 @@ package reconcilers import ( "fmt" + "reflect" "github.com/google/go-cmp/cmp" @@ -10,6 +11,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" ) @@ -54,9 +56,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