Skip to content

Commit

Permalink
reduce changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbussolotto committed Feb 7, 2024
1 parent f82c138 commit 782f48a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion mgradm/cmd/install/shared/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package shared

import (
"github.com/spf13/cobra"
cmd_utils "github.com/uyuni-project/uyuni-tools/mgradm/shared/utils"
"github.com/uyuni-project/uyuni-tools/shared/types"
"github.com/uyuni-project/uyuni-tools/shared/utils"
cmd_utils "github.com/uyuni-project/uyuni-tools/mgradm/shared/utils"
)

type DbFlags struct {
Expand Down
2 changes: 1 addition & 1 deletion mgradm/cmd/upgrade/kubernetes/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func upgradeKubernetes(
return fmt.Errorf("Cannot upgrade to image %s: %s", serverImage, err)
}

//shared_kubernetes.WaitForDeployment(flags.Helm.Uyuni.Namespace, "uyuni", "uyuni")
shared_kubernetes.WaitForDeployment(flags.Helm.Uyuni.Namespace, "uyuni", "uyuni")

shared_kubernetes.ReplicasTo(1)

Expand Down
16 changes: 8 additions & 8 deletions mgradm/shared/kubernetes/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/uyuni-project/uyuni-tools/mgradm/shared/ssl"
adm_utils "github.com/uyuni-project/uyuni-tools/mgradm/shared/utils"
cmd_utils "github.com/uyuni-project/uyuni-tools/mgradm/shared/utils"
"github.com/uyuni-project/uyuni-tools/shared"
"github.com/uyuni-project/uyuni-tools/shared/kubernetes"
"github.com/uyuni-project/uyuni-tools/shared/types"
Expand All @@ -22,7 +22,7 @@ import (
const HELM_APP_NAME = "uyuni"

func Deploy(cnx *shared.Connection, imageFlags *types.ImageFlags,
helmFlags *adm_utils.HelmFlags, sslFlags *adm_utils.SslCertFlags, clusterInfos *kubernetes.ClusterInfos,
helmFlags *cmd_utils.HelmFlags, sslFlags *cmd_utils.SslCertFlags, clusterInfos *kubernetes.ClusterInfos,
fqdn string, debug bool, helmArgs ...string) error {

// If installing on k3s, install the traefik helm config in manifests
Expand All @@ -49,7 +49,7 @@ func Deploy(cnx *shared.Connection, imageFlags *types.ImageFlags,
return nil
}

func DeployCertificate(helmFlags *adm_utils.HelmFlags, sslFlags *adm_utils.SslCertFlags, rootCa string,
func DeployCertificate(helmFlags *cmd_utils.HelmFlags, sslFlags *cmd_utils.SslCertFlags, rootCa string,
ca *ssl.SslPair, kubeconfig string, fqdn string, imagePullPolicy string) []string {

helmArgs := []string{}
Expand All @@ -67,7 +67,7 @@ func DeployCertificate(helmFlags *adm_utils.HelmFlags, sslFlags *adm_utils.SslCe
return helmArgs
}

func DeployExistingCertificate(helmFlags *adm_utils.HelmFlags, sslFlags *adm_utils.SslCertFlags, kubeconfig string) {
func DeployExistingCertificate(helmFlags *cmd_utils.HelmFlags, sslFlags *cmd_utils.SslCertFlags, kubeconfig string) {

// Deploy the SSL Certificate secret and CA configmap
serverCrt, rootCaCrt := ssl.OrderCas(&sslFlags.Ca, &sslFlags.Server)
Expand All @@ -78,7 +78,7 @@ func DeployExistingCertificate(helmFlags *adm_utils.HelmFlags, sslFlags *adm_uti
extractCaCertToConfig()
}

func UyuniUpgrade(serverImage string, pullPolicy string, helmFlags *adm_utils.HelmFlags, kubeconfig string,
func UyuniUpgrade(serverImage string, pullPolicy string, helmFlags *cmd_utils.HelmFlags, kubeconfig string,
fqdn string, ingress string, helmArgs ...string) error {

log.Info().Msg("Installing Uyuni")
Expand Down Expand Up @@ -109,7 +109,7 @@ func UyuniUpgrade(serverImage string, pullPolicy string, helmFlags *adm_utils.He

// updateIssuer replaces the temporary SSL certificate issuer with the source server CA.
// Return additional helm args to use the SSL certificates
func SetupSsl(helm *adm_utils.HelmFlags, kubeconfig string, scriptDir string, password string, pullPolicy string) []string {
func SetupSsl(helm *cmd_utils.HelmFlags, kubeconfig string, scriptDir string, password string, pullPolicy string) []string {
caCert := path.Join(scriptDir, "RHN-ORG-TRUSTED-SSL-CERT")
caKey := path.Join(scriptDir, "RHN-ORG-PRIVATE-SSL-KEY")

Expand All @@ -125,11 +125,11 @@ func SetupSsl(helm *adm_utils.HelmFlags, kubeconfig string, scriptDir string, pa
ca := ssl.SslPair{Cert: cert, Key: key}

// An empty struct means no third party certificate
sslFlags := adm_utils.SslCertFlags{}
sslFlags := cmd_utils.SslCertFlags{}
return DeployCertificate(helm, &sslFlags, cert, &ca, kubeconfig, "", pullPolicy)
} else {
// Handle third party certificates and CA
sslFlags := adm_utils.SslCertFlags{
sslFlags := cmd_utils.SslCertFlags{
Ca: ssl.CaChain{Root: caCert},
Server: ssl.SslPair{
Key: path.Join(scriptDir, "spacewalk.key"),
Expand Down
2 changes: 0 additions & 2 deletions mgradm/shared/templates/pgsqlMigrationScriptTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ fi
echo "Running initdb using postgres user"
echo "Any suggested command from the console should be run using postgres user"
chown -R postgres:postgres /var/lib/pgsql
su -s /bin/bash - postgres -c "initdb -D /var/lib/pgsql/data --locale=$POSTGRES_LANG"
echo "Successfully initialized new postgresql $NEW_VERSION database."
chown -R postgres:postgres /var/lib/pgsql
su -s /bin/bash - postgres -c "pg_upgrade --old-bindir=/usr/lib/postgresql$OLD_VERSION/bin --new-bindir=/usr/lib/postgresql$NEW_VERSION/bin --old-datadir=/var/lib/pgsql/data-pg$OLD_VERSION --new-datadir=/var/lib/pgsql/data $FAST_UPGRADE"
echo "DONE"`
Expand Down
5 changes: 0 additions & 5 deletions mgradm/shared/templates/pgsqlPostMigrationScriptTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import (
const postgresFinalizeScriptTemplate = `#!/bin/bash
set -e
echo "Create new database directory..."
mkdir -p /var/lib/pgsql/data
chown -R postgres:postgres /var/lib/pgsql
chown postgres:postgres /etc/pki/tls/private/pg-spacewalk.key
{{ if .RunAutotune }}
echo "Running smdba system-check autotuning..."
smdba system-check autotuning
Expand Down
2 changes: 1 addition & 1 deletion uyuni-tools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export GOFLAGS=-mod=vendor
mkdir -p bin
UTILS_PATH="%{provider_prefix}/shared/utils"

tag=%{!?_default_tag:2023.12}
tag=%{!?_default_tag:latest}
%if "%{?_default_tag}" != ""
tag='%{_default_tag}'
%endif
Expand Down

0 comments on commit 782f48a

Please sign in to comment.