Skip to content

Commit

Permalink
Check if organisation exists only dashboard bootstrap is enabled.
Browse files Browse the repository at this point in the history
Discover dashboard svc while kubernetes secrets are populated as well

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
  • Loading branch information
buraksekili committed Nov 22, 2023
1 parent f1f6968 commit 7e0c8e1
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions cmd/bootstrap-post/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,42 @@ func main() {
exit(log, err)
}

if conf.BootstrapDashboard {
if conf.BootstrapDashboard || conf.OperatorKubernetesSecretName != "" || conf.DevPortalKubernetesSecretName != "" {
conf.K8s.DashboardSvcUrl, err = k8sClient.DiscoverDashboardSvc()
if err != nil {
exit(log, err)
}
}

tykSvc := tyk.NewClient(conf, log.WithField("Client", "Tyk"))
var orgExists bool

orgExists, err := tykSvc.OrgExists()
if err != nil {
exit(log, err)
}
if conf.BootstrapDashboard {
orgExists, err = tykSvc.OrgExists()
if err != nil {
exit(log, err)
}

if !orgExists {
if conf.BootstrapDashboard {
log.Info("Bootstrapping Tyk Dashboard")
log.Info("Bootstrapping Tyk Dashboard")

if err = tykSvc.CreateOrganisation(); err != nil {
exit(log, err)
}
if err = tykSvc.CreateOrganisation(); err != nil {
exit(log, err)
}

if err = tykSvc.CreateAdmin(); err != nil {
exit(log, err)
}
if err = tykSvc.CreateAdmin(); err != nil {
exit(log, err)
}
}

if conf.BootstrapPortal {
log.Info("Bootstrapping Tyk Classic Portal")
if conf.BootstrapPortal {
log.Info("Bootstrapping Tyk Classic Portal")

if err = tykSvc.BootstrapClassicPortal(); err != nil {
exit(log, err)
}
if err = tykSvc.BootstrapClassicPortal(); err != nil {
exit(log, err)
}

if err = k8sClient.RestartDashboard(); err != nil {
exit(log, err)
}
if err = k8sClient.RestartDashboard(); err != nil {
exit(log, err)
}
}

Expand Down

0 comments on commit 7e0c8e1

Please sign in to comment.