Skip to content

Commit

Permalink
feat: add flag to enable LB SVC for kong admin in CLI (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt authored Mar 22, 2022
1 parent 56efc53 commit 96aedc3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/cmd/ktf/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func init() { //nolint:gochecknoinits
// addon configurations
environmentsCreateCmd.PersistentFlags().StringArray("addon", nil, "name of an addon to deploy to the testing environment's cluster")
environmentsCreateCmd.PersistentFlags().Bool("kong-disable-controller", false, "indicate whether the kong addon should have the controller disabled (proxy only)")
environmentsCreateCmd.PersistentFlags().Bool("kong-admin-service-loadbalancer", false, "indicate whether the kong addon should deploy the proxy admin service as a LoadBalancer type")
environmentsCreateCmd.PersistentFlags().String("kong-dbmode", "off", "indicate the backend dbmode to use for kong (default: \"off\" (DBLESS mode))")
}

Expand Down Expand Up @@ -198,6 +199,17 @@ func configureKongAddon(cmd *cobra.Command, envBuilder *environments.Builder) *e
disableController, err := cmd.PersistentFlags().GetBool("kong-disable-controller")
cobra.CheckErr(err)

if disableController {
builder.WithControllerDisabled()
}

enableAdminSvcLB, err := cmd.PersistentFlags().GetBool("kong-admin-service-loadbalancer")
cobra.CheckErr(err)

if enableAdminSvcLB {
builder.WithProxyAdminServiceTypeLoadBalancer()
}

dbmode, err := cmd.PersistentFlags().GetString("kong-dbmode")
cobra.CheckErr(err)

Expand All @@ -210,10 +222,6 @@ func configureKongAddon(cmd *cobra.Command, envBuilder *environments.Builder) *e
cobra.CheckErr(fmt.Errorf("%s is not a valid dbmode for kong, supported modes are \"off\" (DBLESS) or \"postgres\"", dbmode))
}

if disableController {
builder.WithControllerDisabled()
}

return envBuilder.WithAddons(builder.Build())
}

Expand Down

0 comments on commit 96aedc3

Please sign in to comment.