Skip to content

Commit 86d701c

Browse files
Merge pull request #1523 from hongkailiu/fix_dptp
Check app.ci's kubeconfig after loading InClusterConfig
2 parents 1662c68 + 5599513 commit 86d701c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/dptp-controller-manager/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ func main() {
256256
if err != nil {
257257
logrus.WithError(err).Fatal("failed to load kubeconfigs")
258258
}
259-
if _, hasRegistryCluster := kubeconfigs[opts.registryClusterName]; !hasRegistryCluster {
260-
logrus.Fatalf("--kubeconfig must include a context named `%s`", opts.registryClusterName)
261-
}
262259
if _, hasAppCi := kubeconfigs[appCIContextName]; !hasAppCi {
263260
kubeconfigs[appCIContextName], err = rest.InClusterConfig()
264261
if err != nil {
@@ -267,6 +264,10 @@ func main() {
267264
logrus.Infof("Loaded %q context from in-cluster config", appCIContextName)
268265
}
269266

267+
if _, hasRegistryCluster := kubeconfigs[opts.registryClusterName]; !hasRegistryCluster {
268+
logrus.Fatalf("--kubeconfig must include a context named `%s`", opts.registryClusterName)
269+
}
270+
270271
ciOPConfigAgent, err := agents.NewConfigAgent(opts.ciOperatorconfigPath)
271272
if err != nil {
272273
logrus.WithError(err).Fatal("Failed to construct ci-operator config agent")

0 commit comments

Comments
 (0)