Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch tls certs for redis and memcached #269

Merged
merged 1 commit into from
Sep 9, 2024
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
2 changes: 1 addition & 1 deletion controllers/memcached/memcached_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ct
instance.Status.Conditions.MarkTrue(condition.ExposeServiceReadyCondition, condition.ExposeServiceReadyMessage)

// Statefulset for stable names
commonstatefulset := commonstatefulset.NewStatefulSet(memcached.StatefulSet(instance), time.Duration(5)*time.Second)
commonstatefulset := commonstatefulset.NewStatefulSet(memcached.StatefulSet(instance, hashOfHashes), time.Duration(5)*time.Second)
sfres, sferr := commonstatefulset.CreateOrPatch(ctx, helper)
if sferr != nil {
return sfres, sferr
Expand Down
2 changes: 1 addition & 1 deletion controllers/redis/redis_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ct
//

// Statefulset
commonstatefulset := commonstatefulset.NewStatefulSet(redis.StatefulSet(instance), 5)
commonstatefulset := commonstatefulset.NewStatefulSet(redis.StatefulSet(instance, hashOfHashes), 5)
sfres, sferr := commonstatefulset.CreateOrPatch(ctx, helper)
if sferr != nil {
return sfres, sferr
Expand Down
8 changes: 7 additions & 1 deletion pkg/memcached/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import (
)

// StatefulSet returns a Stateful resource for the Memcached CR
func StatefulSet(m *memcachedv1.Memcached) *appsv1.StatefulSet {
func StatefulSet(
m *memcachedv1.Memcached,
configHash string,
) *appsv1.StatefulSet {
matchls := map[string]string{
common.AppSelector: m.Name,
"cr": m.Name,
Expand Down Expand Up @@ -75,6 +78,9 @@ func StatefulSet(m *memcachedv1.Memcached) *appsv1.StatefulSet {
FieldPath: "status.podIPs",
},
},
}, {
Name: "CONFIG_HASH",
Value: configHash,
},
},
VolumeMounts: getVolumeMounts(m),
Expand Down
73 changes: 0 additions & 73 deletions pkg/redis/deployment.go

This file was deleted.

8 changes: 7 additions & 1 deletion pkg/redis/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import (
)

// Deployment returns a Deployment resource for the Redis CR
func StatefulSet(r *redisv1.Redis) *appsv1.StatefulSet {
func StatefulSet(
r *redisv1.Redis,
configHash string,
) *appsv1.StatefulSet {
matchls := map[string]string{
common.AppSelector: "redis",
common.OwnerSelector: r.Name,
Expand Down Expand Up @@ -68,6 +71,9 @@ func StatefulSet(r *redisv1.Redis) *appsv1.StatefulSet {
// Headless services only publish dns entries that include cluster domain.
// For the time being, assume this is .cluster.local
Value: name + "." + r.GetNamespace() + ".svc.cluster.local",
}, {
Name: "CONFIG_HASH",
Value: configHash,
}}

sts := &appsv1.StatefulSet{
Expand Down
Loading