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

Add support for Hub XMLRPC API container #302

Merged
merged 4 commits into from
May 22, 2024

Conversation

nadvornik
Copy link
Contributor

What does this PR change?

This PR add support for Hub XMLRPC API container.
It creates the systemd service on install and handles it on start, stop, restart,status and uninstall commands.

It includes also a bugfix - restart of postgres after installing new certificate - this is needed for reportdb access from hub.

The service depends on uyuni-project/uyuni#8710

Test coverage

  • No tests: add explanation

  • DONE

Links

#292
uyuni-project/uyuni#8710

  • DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Before you merge

Check How to branch and merge properly!

Copy link
Contributor

@cbosdo cbosdo left a comment

Choose a reason for hiding this comment

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

We would also need to handle the Hub XML-RPC API container for the kubernetes case. This would surely require changes in the server helm chart.

mgradm/cmd/install/shared/flags.go Outdated Show resolved Hide resolved
mgradm/cmd/install/shared/flags.go Outdated Show resolved Hide resolved
mgradm/cmd/install/shared/flags.go Outdated Show resolved Hide resolved
mgradm/cmd/install/shared/flags.go Outdated Show resolved Hide resolved
mgradm/cmd/restart/podman.go Outdated Show resolved Hide resolved
@@ -97,6 +97,11 @@ var ServerVolumes = append([]types.Volume{
{Name: "ca-cert", PersistentVolumeClaim: &types.PersistentVolumeClaim{ClaimName: "ca-cert"}},
}, etcAndPgsqlVolumes[:]...)

// HubXmlrpcVolumeMounts represents volumes used by Hub Xmlrpc container.
var HubXmlrpcVolumeMounts = []types.VolumeMount{
{MountPath: "/etc/pki/trust/anchors", Name: "ca-cert"},
Copy link
Contributor

Choose a reason for hiding this comment

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

How is the SSL key of the Hub XML-RPC API container generated? Does it also need the server key? Just adding this mount looks fishy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This together with uyuni-project/uyuni#8710 is for connection from the Hub XML-RPC API container to Peripheral servers.
I am not sure about the SSL key of the Hub XML-RPC API container.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently we never had SSL support for Hub API. Even 4.3 documentation mentions only http to port 2830.

@nadvornik
Copy link
Contributor Author

I have rebased it and added a fix for utils.Errorf. Now the PR should be complete, except for kubernetes support.

@nadvornik nadvornik requested a review from cbosdo May 16, 2024 09:11
@@ -47,6 +47,29 @@ func setupCocoContainer(flags *podmanInstallFlags) error {
return nil
}

func setupHubXmlrpcContainer(flags *podmanInstallFlags) error {
if flags.HubXmlrpc.Enable {
log.Info().Msg(L("Enabling Hub XMLRPC API container."))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Info().Msg(L("Enabling Hub XMLRPC API container."))
log.Info().Msg(L("Enabling Hub XML-RPC API container."))

Image: image,
}
if err := utils.WriteTemplateToFile(hubXmlrpcData, podman.GetServicePath(podman.HubXmlrpcService), 0555, false); err != nil {
return fmt.Errorf(L("failed to generate systemd service unit file: %s"), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf(L("failed to generate systemd service unit file: %s"), err)
return utils.Errorf(err, L("failed to generate systemd service unit file"))

environment := fmt.Sprintf(`Environment=UYUNI_IMAGE=%s
`, image)
if err := podman.GenerateSystemdConfFile(podman.HubXmlrpcService, "Service", environment); err != nil {
return fmt.Errorf(L("cannot generate systemd conf file: %s"), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf(L("cannot generate systemd conf file: %s"), err)
return utils.Errorf(err, L("cannot generate systemd configuration file"))

@admd admd merged commit 1f6b9c4 into uyuni-project:main May 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants