From 181cf4759a61c37a194937ad9cb4f6e2896a3e92 Mon Sep 17 00:00:00 2001 From: Vijay Bhargav Eshappa Date: Tue, 19 Mar 2024 12:54:27 +0530 Subject: [PATCH] Support env var to accept dev env host endpoint --- pkg/server/server.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/server/server.go b/pkg/server/server.go index fd833801..db807116 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -53,6 +53,11 @@ import ( "github.com/oracle/oci-native-ingress-controller/pkg/podreadiness" ) +const ( + // OkeHostOverrideEnvVar is a hidden flag that allows NIC to hit another containerengine endpoint + okeHostOverrideEnvVar = "OKE_HOST_OVERRIDE" +) + func BuildConfig(kubeconfig string) (*rest.Config, error) { if kubeconfig != "" { cfg, err := clientcmd.BuildConfigFromFlags("", kubeconfig) @@ -200,6 +205,11 @@ func setupClient(ctx context.Context, opts types.IngressOpts, k8client clientset klog.Fatalf("failed to load container engine client configuration provider: %v", err) } + // undocumented endpoint for testing in dev + if os.Getenv(okeHostOverrideEnvVar) != "" { + containerEngineClient.BaseClient.Host = os.Getenv(okeHostOverrideEnvVar) + } + lbClient := loadbalancer.New(&ociLBClient) certificatesClient := certificate.New(&ociCertificatesMgmtClient, ociclient.NewCertificateClient(&ociCertificatesClient))