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
7 changes: 6 additions & 1 deletion internal/heatapi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ func Deployment(
{
Name: heat.ServiceName + "-" + heat.APIComponent,
Command: []string{
"/usr/bin/dumb-init",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand we don't need Command here. Setting only Args: ["/usr/sbin/httpd", "-DFOREGROUND"] keeps the image ENTRYPOINT and replaces CMD.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that’s true. We set both Command and Args so the pod spec shows the full process invocation without needing to check the Containerfile.

The behavior should be the same either way. If you want to drop the Command part, I can do that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's duplication and something that does not have to repeated in all services as base image has it. But I see it's repeated in every operator, so we can leave it here too. Is there a jira reference you can add to the PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack! updated the jira ref in the description

},
Args: []string{
"--single-child",
"--",
"/usr/sbin/httpd",
"-DFOREGROUND",
},
Args: []string{"-DFOREGROUND"},
Image: instance.Spec.ContainerImage,
SecurityContext: pod.RestrictiveSecurityContext(users.HeatUID, users.HeatGID),
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
Expand Down
7 changes: 6 additions & 1 deletion internal/heatcfnapi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ func Deployment(
{
Name: heat.ServiceName + "-" + heat.CfnAPIComponent,
Command: []string{
"/usr/bin/dumb-init",
},
Args: []string{
"--single-child",
"--",
"/usr/sbin/httpd",
"-DFOREGROUND",
},
Args: []string{"-DFOREGROUND"},
Image: instance.Spec.ContainerImage,
SecurityContext: pod.RestrictiveSecurityContext(users.HeatUID, users.HeatGID),
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
Expand Down
5 changes: 5 additions & 0 deletions internal/heatengine/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func Deployment(instance *heatv1beta1.HeatEngine, configHash string, labels map[
{
Name: fmt.Sprintf("%s-%s", heat.ServiceName, heat.EngineComponent),
Command: []string{
"/usr/bin/dumb-init",
},
Args: []string{
"--single-child",
"--",
"/usr/bin/heat-engine",
"--config-dir", "/etc/heat/heat.conf.d",
},
Expand Down
19 changes: 19 additions & 0 deletions test/functional/heat_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,25 @@ var _ = Describe("Heat controller", func() {
th.SimulateJobSuccess(heatDbSyncName)
})

It("should wrap all service commands with dumb-init", func() {
for _, service := range []struct {
name string
args []string
}{
{"heat-api", []string{"--single-child", "--", "/usr/sbin/httpd", "-DFOREGROUND"}},
{"heat-cfnapi", []string{"--single-child", "--", "/usr/sbin/httpd", "-DFOREGROUND"}},
{"heat-engine", []string{"--single-child", "--", "/usr/bin/heat-engine", "--config-dir", "/etc/heat/heat.conf.d"}},
} {
Eventually(func(g Gomega) {
deployment := th.GetDeployment(types.NamespacedName{Namespace: namespace, Name: service.name})
g.Expect(deployment.Spec.Template.Spec.Containers).NotTo(BeEmpty())
container := deployment.Spec.Template.Spec.Containers[0]
g.Expect(container.Command).To(Equal([]string{"/usr/bin/dumb-init"}))
g.Expect(container.Args).To(Equal(service.args))
}, timeout, interval).Should(Succeed(), service.name)
}
})

It("should add the consumer finalizer to the transport secret", func() {
Eventually(func(g Gomega) {
secret := th.GetSecret(types.NamespacedName{
Expand Down
14 changes: 12 additions & 2 deletions test/kuttl/tests/heat_tls/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ spec:
spec:
containers:
- command:
- /usr/sbin/httpd
- /usr/bin/dumb-init
args:
- --single-child
- --
- /usr/sbin/httpd
- -DFOREGROUND
volumeMounts:
- mountPath: /etc/heat/heat.conf.d
Expand Down Expand Up @@ -166,8 +169,11 @@ spec:
spec:
containers:
- command:
- /usr/sbin/httpd
- /usr/bin/dumb-init
args:
- --single-child
- --
- /usr/sbin/httpd
- -DFOREGROUND
volumeMounts:
- mountPath: /etc/heat/heat.conf.d
Expand Down Expand Up @@ -245,6 +251,10 @@ spec:
spec:
containers:
- command:
- /usr/bin/dumb-init
args:
- --single-child
- --
- /usr/bin/heat-engine
- --config-dir
- /etc/heat/heat.conf.d
Expand Down
Loading