mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-05 16:22:29 -08:00
syn2mas check warnings, such as guest accounts, now stay fatal unless matrixAuthenticationService.syn2mas.acceptWarnings is set. The chart passes --accept-warnings to the syn2mas job only when it is enabled, and a check that only reported warnings without it prints how to opt in. The upgrade integration test sets acceptWarnings when it enables MAS.
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
// Copyright 2025 New Vector Ltd
|
|
// Copyright 2025-2026 Element Creations Ltd
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package syn2mas
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
executor "github.com/element-hq/ess-helm/matrix-tools/internal/pkg/syn2mas"
|
|
"github.com/element-hq/ess-helm/matrix-tools/internal/pkg/util"
|
|
)
|
|
|
|
func Run(options *Syn2MasOptions) {
|
|
clientset, err := util.GetKubernetesClient()
|
|
if err != nil {
|
|
fmt.Println("Error getting Kubernetes client: ", err)
|
|
os.Exit(1)
|
|
}
|
|
namespace := os.Getenv("NAMESPACE")
|
|
if namespace == "" {
|
|
fmt.Println("Error, $NAMESPACE is not defined")
|
|
os.Exit(1)
|
|
}
|
|
|
|
currentMarkerState := os.Getenv("CURRENT_MARKER_STATE")
|
|
// We don't need to consider the `delegated_auth`` state (i.e. after a deployment has happened with syn2mas has been turned off)
|
|
// Because we don't allow transitioning back from `delegated_auth`` -> `syn2mas_migrated``
|
|
// If deploymentMarkers is off then we won't have any record in cluster and we'll have the empty string here and migration will proceed
|
|
if currentMarkerState == "syn2mas_migrated" {
|
|
fmt.Println("The cluster is recording the syn2mas migration as already having occurred. Skipping the migration")
|
|
os.Exit(0)
|
|
}
|
|
|
|
// Dry-run (and check) is always executed before doing a real migration
|
|
executor.DryRunSyn2MAS(options.SynapseConfig, options.MASConfig, options.AcceptWarnings)
|
|
if !options.DryRun {
|
|
executor.RunSyn2MAS(clientset, namespace, options.SynapseConfig, options.MASConfig)
|
|
}
|
|
}
|