Slight refactor of Zanzana GRPC Client to use it in the IAM Folder Operator (#110120)

This commit is contained in:
Mihai Turdean
2025-08-26 08:34:15 -06:00
committed by GitHub
parent 60f31342c0
commit 3eebe43c6d
7 changed files with 313 additions and 91 deletions
+6 -6
View File
@@ -8,6 +8,7 @@ import (
"github.com/grafana/grafana-app-sdk/plugin/kubeconfig"
"github.com/grafana/grafana-app-sdk/simple"
"github.com/grafana/grafana/pkg/services/authz"
)
const (
@@ -19,7 +20,7 @@ type Config struct {
OTelConfig simple.OpenTelemetryConfig
WebhookServer WebhookServerConfig
KubeConfig *kubeconfig.NamespacedConfig
ZanzanaClient ZanzanaClientConfig
ZanzanaClient authz.ZanzanaClientConfig
FolderReconciler FolderReconcilerConfig
}
@@ -29,10 +30,6 @@ type WebhookServerConfig struct {
TLSKeyPath string
}
type ZanzanaClientConfig struct {
Addr string
}
type FolderReconcilerConfig struct {
Namespace string
}
@@ -112,7 +109,10 @@ func LoadConfigFromEnv() (*Config, error) {
cfg.KubeConfig = kubeConfig
}
cfg.ZanzanaClient.Addr = os.Getenv("ZANZANA_ADDR")
cfg.ZanzanaClient.Address = os.Getenv("ZANZANA_ADDR")
cfg.ZanzanaClient.Token = os.Getenv("ZANZANA_TOKEN")
cfg.ZanzanaClient.TokenExchangeURL = os.Getenv("ZANZANA_TOKEN_EXCHANGE_URL")
cfg.ZanzanaClient.ServerCertFile = os.Getenv("ZANZANA_SERVER_CERT_FILE")
cfg.FolderReconciler.Namespace = os.Getenv("FOLDER_RECONCILER_NAMESPACE")
+1 -1
View File
@@ -67,7 +67,7 @@ func main() {
// Create app config from operator config
appCfg := app.AppConfig{
ZanzanaAddr: cfg.ZanzanaClient.Addr,
ZanzanaCfg: cfg.ZanzanaClient,
FolderReconcilerNamespace: cfg.FolderReconciler.Namespace,
}