- 
                Notifications
    
You must be signed in to change notification settings  - Fork 12
 
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem statement
#845 introduces an ability to deploy multiple kong addons into a cluster.
environment.Builder allows adding addons via WithAddons()
The problem with the current implementation is that it silently overwrites already added addons by name. So for instance if based on #845 we were to write:
	testNS1 := "kong-test-1"
	kong1 := kongaddon.NewBuilder().WithNamespace(testNS1).WithProxyServiceType(corev1.ServiceTypeClusterIP).Build()
	testNS2 := "kong-test-2"
	kong2 := kongaddon.NewBuilder().WithNamespace(testNS2).WithProxyServiceType(corev1.ServiceTypeClusterIP).Build()
	t.Log("configuring the testing environment")
	builder := environment.NewBuilder().WithAddons(kong1, kong2)
	t.Log("building the testing environment and Kubernetes cluster")
	env, err := builder.Build(ctx)
	require.NoError(t, err)
This would silently pass but the cluster would only get 1 addon deployed.
func (b *Builder) WithAddons(addons ...clusters.Addon) *Builder doesn't return an error so it cannot act when called with an addon that has a name that's already added.
Proposed solution
We have several options to address this:
- make 
Builder.addonsa slice not amap(of typetype Addons map[AddonName]Addon) - make 
Builder.addonsreturn anerrorwhen an addon with the same name (and type?) already exists 
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working