Skip to content
Closed
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 docs/examples/vault-default-user/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ helm repo update
# For OpenShift deployments, also set the following:
# --set "global.openshift=true"
helm install vault hashicorp/vault \
--version 0.19.0 \
--version 0.31.0 \
--set='server.dev.enabled=true' \
--set='server.logLevel=debug' \
--set='injector.logLevel=debug' \
Expand Down
9 changes: 9 additions & 0 deletions internal/resource/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ func (builder *ServerConfigMapBuilder) Update(object client.Object) error {
}
}

// the way vault launches the rabbitmq container overrides the logging configuration
// this results in rabbitmq attempting to log to file, which breaks the securityContext
// when vault is enabled, explicitly configure console logging
if builder.Instance.VaultEnabled() {
if _, err := defaultSection.NewKey("log.console", "true"); err != nil {
return err
}
}

userConfiguration := ini.Empty()
userConfigurationSection := userConfiguration.Section("")

Expand Down
16 changes: 16 additions & 0 deletions internal/resource/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,22 @@ CONSOLE_LOG=new`
})
})

When("the vault secret backend is configured", func() {
// the way vault launches the rabbitmq container overrides the logging configuration
// this results in rabbitmq attempting to log to file, which breaks the securityContext
// in order to ensure rabbitmq behaves correctly and logs to the console, explicitly configure it
It("configures console logging", func() {
instance.Spec.SecretBackend.Vault = &rabbitmqv1beta1.VaultSpec{
Role: "rabbitmq",
DefaultUserPath: "secret/data/rabbitmq/config",
}
Expect(configMapBuilder.Update(configMap)).To(Succeed())
Expect(configMap.Data).To(HaveKey("operatorDefaults.conf"))
operatorDefaults := configMap.Data["operatorDefaults.conf"]
Expect(operatorDefaults).To(ContainSubstring("log.console"))
})
})

// this is to ensure that pods are not restarted when instance labels are updated
It("does not update labels on the config map", func() {
configMap.Labels = map[string]string{
Expand Down