Skip to content

Commit

Permalink
bug fix for allowed proxy template imports
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoferrer committed Feb 26, 2022
1 parent 061f373 commit 77c0749
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions pkg/core/resources/apis/mesh/proxytemplate_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ package mesh
const (
ProfileDefaultProxy = "default-proxy"
)

var AvailableProfiles = []string{ProfileDefaultProxy}
7 changes: 3 additions & 4 deletions pkg/core/resources/apis/mesh/proxytemplate_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ import (
mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
"github.com/kumahq/kuma/pkg/core/validators"
"github.com/kumahq/kuma/pkg/util/envoy"
"github.com/kumahq/kuma/pkg/xds/generator"
)

var availableProfiles map[string]bool
var availableProfilesMsg string

func init() {
profiles := []string{}
availableProfiles = map[string]bool{}
for _, profile := range AvailableProfiles {
for _, profile := range generator.AvailableProfiles {
availableProfiles[profile] = true
profiles = append(profiles, profile)
}
availableProfilesMsg = strings.Join(profiles, ",")
availableProfilesMsg = strings.Join(generator.AvailableProfiles, ",")
}

func (t *ProxyTemplateResource) Validate() error {
Expand Down
3 changes: 3 additions & 0 deletions pkg/xds/generator/proxy_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ var DefaultTemplateResolver template.ProxyTemplateResolver = &template.StaticPro

var predefinedProfiles = make(map[string]ResourceGenerator)

var AvailableProfiles []string

func init() {
RegisterProfile(core_mesh.ProfileDefaultProxy, NewDefaultProxyProfile())
RegisterProfile(IngressProxy, CompositeResourceGenerator{AdminProxyGenerator{}, IngressGenerator{}})
Expand All @@ -126,4 +128,5 @@ func init() {

func RegisterProfile(profileName string, generator ResourceGenerator) {
predefinedProfiles[profileName] = generator
AvailableProfiles = append(AvailableProfiles, profileName)
}

0 comments on commit 77c0749

Please sign in to comment.