Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/bases/keystone.openstack.org_keystoneapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,7 @@ spec:
default: ""
description: TrustFlushArgs - Arguments added to keystone-manage trust_flush
command
pattern: ^[A-Za-z0-9 =._/-]*$
type: string
trustFlushSchedule:
default: 1 * * * *
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/keystoneapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ type KeystoneAPISpecCore struct {

// +kubebuilder:validation:Optional
// +kubebuilder:default=""
// +kubebuilder:validation:Pattern=`^[A-Za-z0-9 =._/-]*$`
// TrustFlushArgs - Arguments added to keystone-manage trust_flush command
TrustFlushArgs string `json:"trustFlushArgs"`

Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/keystone.openstack.org_keystoneapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,7 @@ spec:
default: ""
description: TrustFlushArgs - Arguments added to keystone-manage trust_flush
command
pattern: ^[A-Za-z0-9 =._/-]*$
type: string
trustFlushSchedule:
default: 1 * * * *
Expand Down
21 changes: 9 additions & 12 deletions internal/keystone/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ limitations under the License.
package keystone

import (
"strings"

memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
Expand All @@ -26,11 +28,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// TrustFlushCommand -
TrustFlushCommand = "keystone-manage trust_flush"
)

// CronJob func
func CronJob(
instance *keystonev1.KeystoneAPI,
Expand All @@ -39,7 +36,10 @@ func CronJob(
memcached *memcachedv1.Memcached,
) *batchv1.CronJob {

args := []string{"-c", TrustFlushCommand + instance.Spec.TrustFlushArgs}
cmd := []string{"keystone-manage", "trust_flush"}
if instance.Spec.TrustFlushArgs != "" {
cmd = append(cmd, strings.Fields(instance.Spec.TrustFlushArgs)...)
}

envVars := map[string]env.Setter{}
envVars["KOLLA_CONFIG_STRATEGY"] = env.SetValue("COPY_ALWAYS")
Expand Down Expand Up @@ -103,12 +103,9 @@ func CronJob(
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: ServiceName + "-cron",
Image: instance.Spec.ContainerImage,
Command: []string{
"/bin/bash",
},
Args: args,
Name: ServiceName + "-cron",
Image: instance.Spec.ContainerImage,
Command: cmd,
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
VolumeMounts: volumeMounts,
SecurityContext: baseSecurityContext(),
Expand Down
Loading