setupuser

package
v0.14.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUsername   = "eksa"
	DefaultGroup      = "EKSAUsers"
	DefaultGlobalRole = "EKSAGlobalRole"
	DefaultUserRole   = "EKSAUserRole"
	DefaultAdminRole  = "EKSACloudAdminRole"
)

Variables

This section is empty.

Functions

func Run

Run sets up a vSphere user with appropriate group, role, and permissions to create EKS-A kubernetes clusters.

func SetupGOVCEnv

func SetupGOVCEnv(ctx context.Context, vsuc *VSphereSetupUserConfig) error

SetupGOVCEnv creates appropriate govc environment variables to build govc client.

func ValidateVSphereObjects

func ValidateVSphereObjects(ctx context.Context, c *VSphereSetupUserConfig, govc GovcClient) error

ValidateVSphereObjects validates objects do not exist before configuring user.

Types

type Connection

type Connection struct {
	Server   string `yaml:"server"`
	Insecure bool   `yaml:"insecure"`
}

type GovcClient

type GovcClient interface {
	CreateUser(ctx context.Context, username string, password string) error
	UserExists(ctx context.Context, username string) (bool, error)
	CreateGroup(ctx context.Context, name string) error
	GroupExists(ctx context.Context, name string) (bool, error)
	AddUserToGroup(ctx context.Context, name string, username string) error
	RoleExists(ctx context.Context, name string) (bool, error)
	CreateRole(ctx context.Context, name string, privileges []string) error
	SetGroupRoleOnObject(ctx context.Context, principal string, role string, object string, domain string) error
}

GovcClient specifies govc functions required to configure a vsphere user.

type Objects

type Objects struct {
	Networks      []string `yaml:"networks"`
	Datastores    []string `yaml:"datastores"`
	ResourcePools []string `yaml:"resourcePools"`
	Folders       []string `yaml:"folders"`
	Templates     []string `yaml:"templates"`
}

type VSphereSetupUserConfig

type VSphereSetupUserConfig struct {
	ApiVersion string          `yaml:"apiVersion"`
	Kind       string          `yaml:"kind"`
	Spec       VSphereUserSpec `yaml:"spec"`
}

func GenerateConfig

func GenerateConfig(ctx context.Context, filepath string) (*VSphereSetupUserConfig, error)

type VSphereUserSpec

type VSphereUserSpec struct {
	Datacenter    string     `yaml:"datacenter"`
	VSphereDomain string     `yaml:"vSphereDomain"`
	Connection    Connection `yaml:"connection"`
	Objects       Objects    `yaml:"objects"`
	// Below are optional fields with defaults
	Username   string `yaml:"username"`
	GroupName  string `yaml:"group"`
	GlobalRole string `yaml:"globalRole"`
	UserRole   string `yaml:"userRole"`
	AdminRole  string `yaml:"adminRole"`
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL