mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 06:43:48 +02:00
Allow disabling access to the DB and the Teams API.
Command-line options --nodatabaseaccess and --noteamsapi disable all teams api interaction and access to the Postgres database. This is useful for debugging purposes when the operator runs out of cluster (with --outofcluster flag). The same effect can be achieved by setting enable_db_access and/or enable_teams_api to false.
This commit is contained in:
+10
@@ -19,12 +19,16 @@ var (
|
||||
podNamespace string
|
||||
configMapName spec.NamespacedName
|
||||
OutOfCluster bool
|
||||
noTeamsAPI bool
|
||||
noDBAccess bool
|
||||
version string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&KubeConfigFile, "kubeconfig", "", "Path to kubeconfig file with authorization and master location information.")
|
||||
flag.BoolVar(&OutOfCluster, "outofcluster", false, "Whether the operator runs in- our outside of the Kubernetes cluster.")
|
||||
flag.BoolVar(&noDBAccess, "nodatabaseaccess", false, "Disable all access to the database from the operator side.")
|
||||
flag.BoolVar(&noTeamsAPI, "noteamsapi", false, "Disable all access to the teams API")
|
||||
flag.Parse()
|
||||
|
||||
podNamespace = os.Getenv("MY_POD_NAMESPACE")
|
||||
@@ -87,6 +91,12 @@ func main() {
|
||||
if configMapData["namespace"] == "" { // Namespace in ConfigMap has priority over env var
|
||||
configMapData["namespace"] = podNamespace
|
||||
}
|
||||
if noDBAccess {
|
||||
configMapData["enable_db_access"] = "false"
|
||||
}
|
||||
if noTeamsAPI {
|
||||
configMapData["enable_teams_api"] = "false"
|
||||
}
|
||||
cfg := config.NewFromMap(configMapData)
|
||||
|
||||
log.Printf("Config: %s", cfg.MustMarshal())
|
||||
|
||||
Reference in New Issue
Block a user