-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: danehans <[email protected]>
- Loading branch information
Showing
7 changed files
with
86 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package infrastructure | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
clicfg "sigs.k8s.io/controller-runtime/pkg/client/config" | ||
|
||
"github.com/envoyproxy/gateway/api/config/v1alpha1" | ||
"github.com/envoyproxy/gateway/internal/envoygateway/config" | ||
"github.com/envoyproxy/gateway/internal/infrastructure/kubernetes" | ||
) | ||
|
||
// Manager provides the scaffolding for managing infrastructure. | ||
type Manager struct { | ||
Kubernetes *kubernetes.Infra | ||
} | ||
|
||
// NewManager returns a new infrastructure Manager. | ||
func NewManager(cfg *config.Server) (*Manager, error) { | ||
if cfg == nil { | ||
return nil, errors.New("server config is nil") | ||
} | ||
|
||
mgr := new(Manager) | ||
|
||
switch { | ||
case cfg.EnvoyGateway == nil || | ||
cfg.EnvoyGateway.Provider == nil || | ||
cfg.EnvoyGateway.Provider.Type == v1alpha1.ProviderTypeKubernetes: | ||
cli, err := client.New(clicfg.GetConfigOrDie(), client.Options{}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
mgr.Kubernetes = kubernetes.NewInfra(cli, cfg) | ||
default: | ||
// Unsupported provider type. | ||
return nil, fmt.Errorf("unsupported provider type %v", cfg.EnvoyGateway.Provider.Type) | ||
} | ||
|
||
return mgr, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters