-
Notifications
You must be signed in to change notification settings - Fork 19
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
Improved Hub XML-RPC support #357
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
46377c8
Kubernetes support for Hub XML-RPC
nadvornik e76a340
Backup the pgsql data after rsyncing them
cbosdo 6d22ffe
Refresh the connection after the k8s migration
cbosdo b2a7d85
Wait for 3 hours when running a pod
cbosdo 92c9e2b
Add crds.keep value for cert-manager to keep feature parity with inst…
cbosdo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ func Deploy( | |
cnx *shared.Connection, | ||
registry string, | ||
imageFlags *types.ImageFlags, | ||
hubXmlrpcFlags *cmd_utils.HubXmlrpcFlags, | ||
helmFlags *cmd_utils.HelmFlags, | ||
clusterInfos *kubernetes.ClusterInfos, | ||
fqdn string, | ||
|
@@ -39,10 +40,11 @@ func Deploy( | |
isK3s := clusterInfos.IsK3s() | ||
IsRke2 := clusterInfos.IsRke2() | ||
if !prepare { | ||
tcpPorts, udpPorts := GetPortLists(hubXmlrpcFlags.Replicas > 0, debug) | ||
if isK3s { | ||
InstallK3sTraefikConfig(debug) | ||
kubernetes.InstallK3sTraefikConfig(tcpPorts, udpPorts) | ||
} else if IsRke2 { | ||
kubernetes.InstallRke2NginxConfig(utils.TCPPorts, utils.UDPPorts, helmFlags.Uyuni.Namespace) | ||
kubernetes.InstallRke2NginxConfig(tcpPorts, udpPorts, helmFlags.Uyuni.Namespace) | ||
} | ||
} | ||
|
||
|
@@ -51,9 +53,15 @@ func Deploy( | |
return utils.Errorf(err, L("failed to compute image URL")) | ||
} | ||
|
||
hubXmlrpcImage, err := utils.ComputeImage(registry, imageFlags.Tag, hubXmlrpcFlags.Image) | ||
if err != nil { | ||
return utils.Errorf(err, L("failed to compute image URL")) | ||
} | ||
|
||
// Install the uyuni server helm chart | ||
if err := UyuniUpgrade( | ||
serverImage, imageFlags.PullPolicy, helmFlags, clusterInfos.GetKubeconfig(), fqdn, clusterInfos.Ingress, helmArgs..., | ||
serverImage, imageFlags.PullPolicy, hubXmlrpcFlags.Replicas, hubXmlrpcImage, helmFlags, | ||
clusterInfos.GetKubeconfig(), fqdn, clusterInfos.Ingress, helmArgs..., | ||
); err != nil { | ||
return utils.Errorf(err, L("cannot upgrade")) | ||
} | ||
|
@@ -66,7 +74,7 @@ func Deploy( | |
return cnx.WaitForServer() | ||
} | ||
|
||
// DeployCertificate executre a deploy a new certificate given an helm. | ||
// DeployCertificate deploys a new SSL certificate. | ||
func DeployCertificate(helmFlags *cmd_utils.HelmFlags, sslFlags *cmd_utils.InstallSSLFlags, rootCa string, | ||
ca *types.SSLPair, kubeconfig string, fqdn string, imagePullPolicy string) ([]string, error) { | ||
helmArgs := []string{} | ||
|
@@ -107,8 +115,17 @@ func DeployExistingCertificate( | |
} | ||
|
||
// UyuniUpgrade runs an helm upgrade using images and helm configuration as parameters. | ||
func UyuniUpgrade(serverImage string, pullPolicy string, helmFlags *cmd_utils.HelmFlags, kubeconfig string, | ||
fqdn string, ingress string, helmArgs ...string) error { | ||
func UyuniUpgrade( | ||
serverImage string, | ||
pullPolicy string, | ||
hubXmlrpcReplicas int, | ||
hubXmlrpcImage string, | ||
helmFlags *cmd_utils.HelmFlags, | ||
kubeconfig string, | ||
fqdn string, | ||
ingress string, | ||
helmArgs ...string, | ||
) error { | ||
log.Info().Msg(L("Installing Uyuni")) | ||
|
||
// The guessed ingress is passed before the user's value to let the user override it in case we got it wrong. | ||
|
@@ -127,6 +144,12 @@ func UyuniUpgrade(serverImage string, pullPolicy string, helmFlags *cmd_utils.He | |
"--set", "pullPolicy="+kubernetes.GetPullPolicy(pullPolicy), | ||
"--set", "fqdn="+fqdn) | ||
|
||
if hubXmlrpcReplicas > 0 { | ||
log.Info().Msg(L("Enabling Hub XMLRPC API container.")) | ||
helmParams = append(helmParams, | ||
"--set", fmt.Sprintf("hub.api.replicas=%v", hubXmlrpcReplicas), | ||
"--set", "images.hub_xmlrpc="+hubXmlrpcImage) | ||
} | ||
helmParams = append(helmParams, helmArgs...) | ||
|
||
namespace := helmFlags.Uyuni.Namespace | ||
|
@@ -140,6 +163,7 @@ func Upgrade( | |
_ *types.GlobalFlags, | ||
image *types.ImageFlags, | ||
upgradeImage *types.ImageFlags, | ||
hubXmlrpcImage *types.ImageFlags, | ||
helm cmd_utils.HelmFlags, | ||
_ *cobra.Command, | ||
_ []string, | ||
|
@@ -156,6 +180,11 @@ func Upgrade( | |
return utils.Errorf(err, L("failed retrieving namespace")) | ||
} | ||
|
||
origHubXmlrpcImage, err := kubernetes.GetRunningImage("hub-xmlrpc-api") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would work for Hub XML-RPC API since we can have at most 1 replica, but I would see a |
||
if err != nil { | ||
return utils.Errorf(err, L("failed to find Hub XML-RPC API container")) | ||
} | ||
|
||
serverImage, err := utils.ComputeImage(image.Registry, utils.DefaultTag, *image) | ||
if err != nil { | ||
return utils.Errorf(err, L("failed to compute image URL")) | ||
|
@@ -238,7 +267,20 @@ func Upgrade( | |
helmArgs = append(helmArgs, "--set", "registrySecret="+pullSecret) | ||
} | ||
|
||
err = UyuniUpgrade(serverImage, image.PullPolicy, &helm, kubeconfig, fqdn, clusterInfos.Ingress, helmArgs...) | ||
hubXmlrpcImageName, err := utils.ComputeImage(image.Registry, image.Tag, *hubXmlrpcImage) | ||
if err != nil { | ||
return utils.Errorf(err, L("failed to compute image URL")) | ||
} | ||
|
||
hubXmlrpcReplicas := 0 | ||
if origHubXmlrpcImage != "" { | ||
hubXmlrpcReplicas = 1 | ||
} | ||
|
||
err = UyuniUpgrade( | ||
serverImage, image.PullPolicy, hubXmlrpcReplicas, hubXmlrpcImageName, &helm, kubeconfig, fqdn, | ||
clusterInfos.Ingress, helmArgs..., | ||
) | ||
if err != nil { | ||
return utils.Errorf(err, L("cannot upgrade to image %s"), serverImage) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want to setup traefik / nginx with hub ports in all cases or not. The problem is that if the user decides to scale the number of replicas of the hub API, then traefik / nginx config is not ready.