Skip to content

Commit

Permalink
Use dns cluster info from lib common get function
Browse files Browse the repository at this point in the history
Openshift coreDNS creates the domain name using an string
located in dnses.operator.openshift.io. This string can
change in the future, calling lib-common/GetDNSClusterDomain
the responsability of gathering this information correctly
only falls under lib-common intead of all operators.

Resolves: OSPRH-3627
Depends-on: openstack-k8s-operators/lib-common#580
  • Loading branch information
averdagu committed Dec 10, 2024
1 parent 70981ed commit 36d54fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openstack-k8s-operators/infra-operator/apis v0.3.0
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241113144931-ff1fd2dcd04a
github.com/openstack-k8s-operators/lib-common/modules/common v0.5.1-0.20241114091812-6dc9fd0961dc
github.com/openstack-k8s-operators/lib-common/modules/test v0.5.1-0.20241025164019-30baa23bf6f1
github.com/rabbitmq/cluster-operator/v2 v2.9.0
go.uber.org/zap v1.27.0
Expand Down
5 changes: 3 additions & 2 deletions pkg/redis/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
common "github.com/openstack-k8s-operators/lib-common/modules/common"
cluster "github.com/openstack-k8s-operators/lib-common/modules/clusterdns"
labels "github.com/openstack-k8s-operators/lib-common/modules/common/labels"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -61,6 +62,7 @@ func StatefulSet(
Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(26379)},
}
name := r.Name + "-" + "redis"
clusterDomain := coredns.GetDNSClusterDomain()

commonEnvVars := []corev1.EnvVar{{
Name: "KOLLA_CONFIG_STRATEGY",
Expand All @@ -69,8 +71,7 @@ func StatefulSet(
Name: "SVC_FQDN",
// https://github.com/kubernetes/dns/blob/master/docs/specification.md
// 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",
Value: name + "." + r.GetNamespace() + ".svc." + clusterDomain,
}, {
Name: "CONFIG_HASH",
Value: configHash,
Expand Down

0 comments on commit 36d54fd

Please sign in to comment.