Fallback to defaults when config cannot be loaded
When running the destination controller locally, the Linkerd config files which are typically mounted from a configmap are not available.  To facilitate local development, we fall back to default values in this case instead of failing to start up.
@@ -48,18 +48,23 @@ func Main(args []string) {
}
global, err := config.Global(consts.MountPathGlobalConfig)
- if err != nil {
- log.Fatalf("Failed to load global config: %s", err)
- }
trustDomain := ""
if *disableIdentity {
log.Info("Identity is disabled")
} else {
trustDomain = global.GetIdentityContext().GetTrustDomain()
+ if err != nil || trustDomain == "" {
+ trustDomain = "cluster.local"
+ log.Warnf("failed to load trust domain from global config: [%s] (falling back to %s)", err, trustDomain)
+ }
}
clusterDomain := global.GetClusterDomain()
+ if err != nil || clusterDomain == "" {
+ clusterDomain = "cluster.local"
+ log.Warnf("failed to load cluster domain from global config: [%s] (falling back to %s)", err, clusterDomain)
+ }
server := destination.NewServer(
*addr,
