Skip to content

Commit

Permalink
feat: add subdomain/hostname to pods created (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
PFC-developer authored Sep 25, 2023
1 parent dce3b8b commit f240661
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/fullnode/pod_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func NewPodBuilder(crd *cosmosv1.CosmosFullNode) PodBuilder {
FSGroupChangePolicy: ptr(corev1.FSGroupChangeOnRootMismatch),
SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault},
},
Subdomain: crd.Name,
Containers: []corev1.Container{
// Main start container.
{
Expand Down Expand Up @@ -180,6 +181,9 @@ func (b PodBuilder) WithOrdinal(ordinal int32) PodBuilder {
pod.Name = name
pod.Spec.InitContainers = initContainers(b.crd, name)

pod.Spec.Hostname = pod.Name
pod.Spec.Subdomain = b.crd.Name

pod.Spec.Volumes = []corev1.Volume{
{
Name: volChainHome,
Expand Down
3 changes: 3 additions & 0 deletions internal/fullnode/pod_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func TestPodBuilder(t *testing.T) {
require.Equal(t, "test", pod.Namespace)
require.Equal(t, "osmosis-5", pod.Name)

require.Equal(t, "osmosis", pod.Spec.Subdomain)
require.Equal(t, "osmosis-5", pod.Spec.Hostname)

wantLabels := map[string]string{
"app.kubernetes.io/instance": "osmosis-5",
"app.kubernetes.io/component": "CosmosFullNode",
Expand Down

0 comments on commit f240661

Please sign in to comment.