@@ -16,6 +16,8 @@ limitations under the License.
1616package keystone
1717
1818import (
19+ "strings"
20+
1921 memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
2022 keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
2123 "github.com/openstack-k8s-operators/lib-common/modules/common/env"
@@ -26,11 +28,6 @@ import (
2628 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2729)
2830
29- const (
30- // TrustFlushCommand -
31- TrustFlushCommand = "keystone-manage trust_flush"
32- )
33-
3431// CronJob func
3532func CronJob (
3633 instance * keystonev1.KeystoneAPI ,
@@ -39,7 +36,10 @@ func CronJob(
3936 memcached * memcachedv1.Memcached ,
4037) * batchv1.CronJob {
4138
42- args := []string {"-c" , TrustFlushCommand + instance .Spec .TrustFlushArgs }
39+ cmd := []string {"keystone-manage" , "trust_flush" }
40+ if instance .Spec .TrustFlushArgs != "" {
41+ cmd = append (cmd , strings .Fields (instance .Spec .TrustFlushArgs )... )
42+ }
4343
4444 envVars := map [string ]env.Setter {}
4545 envVars ["KOLLA_CONFIG_STRATEGY" ] = env .SetValue ("COPY_ALWAYS" )
@@ -103,12 +103,9 @@ func CronJob(
103103 Spec : corev1.PodSpec {
104104 Containers : []corev1.Container {
105105 {
106- Name : ServiceName + "-cron" ,
107- Image : instance .Spec .ContainerImage ,
108- Command : []string {
109- "/bin/bash" ,
110- },
111- Args : args ,
106+ Name : ServiceName + "-cron" ,
107+ Image : instance .Spec .ContainerImage ,
108+ Command : cmd ,
112109 Env : env .MergeEnvs ([]corev1.EnvVar {}, envVars ),
113110 VolumeMounts : volumeMounts ,
114111 SecurityContext : baseSecurityContext (),
0 commit comments