Skip to content

Commit ba61b05

Browse files
committed
fix(controller): panic in OCI provider build
1 parent 1da86e8 commit ba61b05

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

controller/execute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ func buildProvider(
285285
} else {
286286
config, err = oci.LoadOCIConfig(cfg.OCIConfigFile)
287287
}
288-
config.ZoneCacheDuration = cfg.OCIZoneCacheDuration
289288
if err == nil {
289+
config.ZoneCacheDuration = cfg.OCIZoneCacheDuration
290290
p, err = oci.NewOCIProvider(*config, domainFilter, zoneIDFilter, cfg.OCIZoneScope, cfg.DryRun)
291291
}
292292
case "rfc2136":

controller/execute_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,15 @@ func TestBuildProvider(t *testing.T) {
264264
},
265265
expectedType: "*provider.CachedProvider",
266266
},
267+
{
268+
name: "oci provider instance principal without compartment OCID",
269+
cfg: &externaldns.Config{
270+
Provider: "oci",
271+
OCIAuthInstancePrincipal: true,
272+
OCICompartmentOCID: "",
273+
},
274+
expectedError: "instance principal authentication requested, but no compartment OCID provided",
275+
},
267276
{
268277
name: "coredns provider",
269278
cfg: &externaldns.Config{

0 commit comments

Comments
 (0)