rancher2

package
v0.2.0-rc5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const AuthConfigADFSName = "adfs"
View Source
const AuthConfigActiveDirectoryName = "activedirectory"
View Source
const AuthConfigAzureADName = "azuread"
View Source
const AuthConfigFreeIpaName = "freeipa"
View Source
const AuthConfigGithubName = "github"
View Source
const AuthConfigOpenLdapName = "openldap"
View Source
const AuthConfigPingName = "ping"

Variables

View Source
var (
	RKEConfigNodesRoles = []string{"controlplane", "etcd", "worker"}
)

Functions

func DoPost

func DoPost(url, data, cacert string, insecure bool, headers map[string]string) (map[string]interface{}, error)

func DoUserLogin

func DoUserLogin(url, user, pass, ttl, desc, cacert string, insecure bool) (string, string, error)

func FileExist

func FileExist(path string) (bool, error)

func GetRandomPass

func GetRandomPass(n int) string

func HashPasswordString

func HashPasswordString(password string) (string, error)

func IsNotFound

func IsNotFound(err error) bool

func NewListOpts

func NewListOpts(filters map[string]interface{}) *types.ListOpts

func NormalizeURL

func NormalizeURL(url string) string

func Provider

func Provider() terraform.ResourceProvider

Provider returns a terraform.ResourceProvider.

Types

type AmazonElasticContainerServiceConfig

type AmazonElasticContainerServiceConfig struct {
	AMI                         string   `json:"ami,omitempty" yaml:"ami,omitempty"`
	AccessKey                   string   `json:"accessKey,omitempty" yaml:"accessKey,omitempty"`
	AssociateWorkerNodePublicIP *bool    `json:"associateWorkerNodePublicIp,omitempty" yaml:"associateWorkerNodePublicIp,omitempty"`
	DisplayName                 string   `json:"displayName,omitempty" yaml:"displayName,omitempty"`
	InstanceType                string   `json:"instanceType,omitempty" yaml:"instanceType,omitempty"`
	KubernetesVersion           string   `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`
	MaximumNodes                int64    `json:"maximumNodes,omitempty" yaml:"maximumNodes,omitempty"`
	MinimumNodes                int64    `json:"minimumNodes,omitempty" yaml:"minimumNodes,omitempty"`
	NodeVolumeSize              int64    `json:"nodeVolumeSize,omitempty" yaml:"nodeVolumeSize,omitempty"`
	Region                      string   `json:"region,omitempty" yaml:"region,omitempty"`
	SecretKey                   string   `json:"secretKey,omitempty" yaml:"secretKey,omitempty"`
	SecurityGroups              []string `json:"securityGroups,omitempty" yaml:"securityGroups,omitempty"`
	ServiceRole                 string   `json:"serviceRole,omitempty" yaml:"serviceRole,omitempty"`
	SessionToken                string   `json:"sessionToken,omitempty" yaml:"sessionToken,omitempty"`
	Subnets                     []string `json:"subnets,omitempty" yaml:"subnets,omitempty"`
	UserData                    string   `json:"userData,omitempty" yaml:"userData,omitempty"`
	VirtualNetwork              string   `json:"virtualNetwork,omitempty" yaml:"virtualNetwork,omitempty"`
}

type AzureKubernetesServiceConfig

type AzureKubernetesServiceConfig struct {
	AADClientAppID                     string            `json:"addClientAppId,omitempty" yaml:"addClientAppId,omitempty"`
	AADServerAppID                     string            `json:"addServerAppId,omitempty" yaml:"addServerAppId,omitempty"`
	AADServerAppSecret                 string            `json:"addServerAppSecret,omitempty" yaml:"addServerAppSecret,omitempty"`
	AADTenantID                        string            `json:"addTenantId,omitempty" yaml:"addTenantId,omitempty"`
	AdminUsername                      string            `json:"adminUsername,omitempty" yaml:"adminUsername,omitempty"`
	AgentDNSPrefix                     string            `json:"agentDnsPrefix,omitempty" yaml:"agentDnsPrefix,omitempty"`
	AgentOsdiskSizeGB                  int64             `json:"agentOsdiskSize,omitempty" yaml:"agentOsdiskSize,omitempty"`
	AgentPoolName                      string            `json:"agentPoolName,omitempty" yaml:"agentPoolName,omitempty"`
	AgentStorageProfile                string            `json:"agentStorageProfile,omitempty" yaml:"agentStorageProfile,omitempty"`
	AgentVMSize                        string            `json:"agentVmSize,omitempty" yaml:"agentVmSize,omitempty"`
	AuthBaseURL                        string            `json:"authBaseUrl" yaml:"authBaseUrl"`
	BaseURL                            string            `json:"baseUrl,omitempty" yaml:"baseUrl,omitempty"`
	ClientID                           string            `json:"clientId,omitempty" yaml:"clientId,omitempty"`
	ClientSecret                       string            `json:"clientSecret,omitempty" yaml:"clientSecret,omitempty"`
	Count                              int64             `json:"count,omitempty" yaml:"count,omitempty"`
	DisplayName                        string            `json:"displayName,omitempty" yaml:"displayName,omitempty"`
	DNSServiceIP                       string            `json:"dnsServiceIp,omitempty" yaml:"dnsServiceIp,omitempty"`
	DockerBridgeCIDR                   string            `json:"dockerBridgeCidr,omitempty" yaml:"dockerBridgeCidr,omitempty"`
	EnableHTTPApplicationRouting       bool              `json:"enableHttpApplicationRouting,omitempty" yaml:"enableHttpApplicationRouting,omitempty"`
	EnableMonitoring                   bool              `json:"enableMonitoring,omitempty" yaml:"enableMonitoring,omitempty"`
	KubernetesVersion                  string            `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`
	Location                           string            `json:"location,omitempty" yaml:"location,omitempty"`
	LogAnalyticsWorkspace              string            `json:"logAnalyticsWorkspace,omitempty" yaml:"logAnalyticsWorkspace,omitempty"`
	LogAnalyticsWorkspaceResourceGroup string            `json:"logAnalyticsWorkspaceResourceGroup,omitempty" yaml:"logAnalyticsWorkspaceResourceGroup,omitempty"`
	MasterDNSPrefix                    string            `json:"masterDnsPrefix,omitempty" yaml:"masterDnsPrefix,omitempty"`
	MaxPods                            int64             `json:"maxPods,omitempty" yaml:"maxPods,omitempty"`
	Name                               string            `json:"name,omitempty" yaml:"name,omitempty"`
	NetworkPlugin                      string            `json:"networkPlugin,omitempty" yaml:"networkPlugin,omitempty"`
	NetworkPolicy                      string            `json:"networkPolicy,omitempty" yaml:"networkPolicy,omitempty"`
	PodCIDR                            string            `json:"podCidr,omitempty" yaml:"podCidr,omitempty"`
	ResourceGroup                      string            `json:"resourceGroup,omitempty" yaml:"resourceGroup,omitempty"`
	SSHPublicKeyContents               string            `json:"sshPublicKeyContents,omitempty" yaml:"sshPublicKeyContents,omitempty"`
	ServiceCIDR                        string            `json:"serviceCidr,omitempty" yaml:"serviceCidr,omitempty"`
	Subnet                             string            `json:"subnet,omitempty" yaml:"subnet,omitempty"`
	SubscriptionID                     string            `json:"subscriptionId,omitempty" yaml:"subscriptionId,omitempty"`
	Tag                                map[string]string `json:"tags,omitempty" yaml:"tags,omitempty"`
	TenantID                           string            `json:"tenantId,omitempty" yaml:"tenantId,omitempty"`
	VirtualNetwork                     string            `json:"virtualNetwork,omitempty" yaml:"virtualNetwork,omitempty"`
	VirtualNetworkResourceGroup        string            `json:"virtualNetworkResourceGroup,omitempty" yaml:"virtualNetworkResourceGroup,omitempty"`
}

type CLIConfig

type CLIConfig struct {
	AdminPass string `json:"adminpass"`
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	TokenKey  string `json:"tokenKey"`
	CACerts   string `json:"caCerts"`
	Insecure  bool   `json:"insecure,omitempty"`
	URL       string `json:"url"`
	Project   string `json:"project"`
	Path      string `json:"path,omitempty"`
}

CLIConfig used to store data from file.

type Client

type Client struct {
	Management *managementClient.Client
	Cluster    *clusterClient.Client
	Project    *projectClient.Client
}

Client are the client kind for a Rancher v3 API

type CloudCredential

type CloudCredential struct {
	managementClient.CloudCredential
	Amazonec2CredentialConfig     *amazonec2CredentialConfig     `json:"amazonec2credentialConfig,omitempty" yaml:"amazonec2credentialConfig,omitempty"`
	AzureCredentialConfig         *azureCredentialConfig         `json:"azurecredentialConfig,omitempty" yaml:"azurecredentialConfig,omitempty"`
	DigitaloceanCredentialConfig  *digitaloceanCredentialConfig  `json:"digitaloceancredentialConfig,omitempty" yaml:"digitaloceancredentialConfig,omitempty"`
	OpenstackCredentialConfig     *openstackCredentialConfig     `json:"openstackcredentialConfig,omitempty" yaml:"openstackcredentialConfig,omitempty"`
	VmwarevsphereCredentialConfig *vmwarevsphereCredentialConfig `json:"vmwarevspherecredentialConfig,omitempty" yaml:"vmwarevspherecredentialConfig,omitempty"`
}

type Cluster

type Cluster struct {
	managementClient.Cluster
	AmazonElasticContainerServiceConfig *AmazonElasticContainerServiceConfig `json:"amazonElasticContainerServiceConfig,omitempty" yaml:"amazonElasticContainerServiceConfig,omitempty"`
	AzureKubernetesServiceConfig        *AzureKubernetesServiceConfig        `json:"azureKubernetesServiceConfig,omitempty" yaml:"azureKubernetesServiceConfig,omitempty"`
	GoogleKubernetesEngineConfig        *GoogleKubernetesEngineConfig        `json:"googleKubernetesEngineConfig,omitempty" yaml:"googleKubernetesEngineConfig,omitempty"`
}

type Config

type Config struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	TokenKey  string `json:"tokenKey"`
	URL       string `json:"url"`
	CACerts   string `json:"cacert"`
	Insecure  bool   `json:"insecure"`
	Bootstrap bool   `json:"bootstrap"`
	ClusterID string `json:"clusterId"`
	ProjectID string `json:"projectId"`
	Client    Client
}

Config is the configuration parameters for a Rancher v3 API

func (*Config) CheckAuthConfigEnabled

func (c *Config) CheckAuthConfigEnabled(id string) error

func (*Config) ClusterClient

func (c *Config) ClusterClient(id string) (*clusterClient.Client, error)

ClusterClient creates a Rancher client scoped to a Cluster API

func (*Config) ClusterExist

func (c *Config) ClusterExist(id string) error

func (*Config) ClusterRegistrationTokenExist

func (c *Config) ClusterRegistrationTokenExist(id string) error

func (*Config) CreateClientOpts

func (c *Config) CreateClientOpts() *clientbase.ClientOpts

func (*Config) DeleteToken

func (c *Config) DeleteToken(id string) error

func (*Config) GenerateUserToken

func (c *Config) GenerateUserToken(username, desc string, ttl int) (string, string, error)

GenerateUserToken generates token with ttl measured in seconds

func (*Config) GetAuthConfig

func (c *Config) GetAuthConfig(in *managementClient.AuthConfig) (interface{}, error)

func (*Config) GetClusterByID

func (c *Config) GetClusterByID(id string) (*managementClient.Cluster, error)

func (*Config) GetClusterByName

func (c *Config) GetClusterByName(name string) (*managementClient.Cluster, error)

func (*Config) GetClusterIDByName

func (c *Config) GetClusterIDByName(name string) (string, error)

func (*Config) GetClusterRegistrationTokenByID

func (c *Config) GetClusterRegistrationTokenByID(id string) (*managementClient.ClusterRegistrationToken, error)

func (*Config) GetProjectByID

func (c *Config) GetProjectByID(id string) (*managementClient.Project, error)

func (*Config) GetProjectByName

func (c *Config) GetProjectByName(name, clusterID string) (*managementClient.Project, error)

func (*Config) GetProjectIDByName

func (c *Config) GetProjectIDByName(name, clusterID string) (string, error)

func (*Config) GetProjectNameByID

func (c *Config) GetProjectNameByID(id string) (string, error)

func (*Config) GetProjectRoleTemplateBindingsByProjectID

func (c *Config) GetProjectRoleTemplateBindingsByProjectID(projectID string) ([]managementClient.ProjectRoleTemplateBinding, error)

func (*Config) GetRoleTemplateByID

func (c *Config) GetRoleTemplateByID(id string) (*managementClient.RoleTemplate, error)

func (*Config) GetSetting

func (c *Config) GetSetting(name string) (*managementClient.Setting, error)

func (*Config) GetSettingValue

func (c *Config) GetSettingValue(name string) (string, error)

func (*Config) GetUserByName

func (c *Config) GetUserByName(name string) (*managementClient.User, error)

func (*Config) GetUserIDByName

func (c *Config) GetUserIDByName(name string) (string, error)

func (*Config) IsTokenExpired

func (c *Config) IsTokenExpired(id string) (bool, error)

func (*Config) ManagementClient

func (c *Config) ManagementClient() (*managementClient.Client, error)

ManagementClient creates a Rancher client scoped to the management API

func (*Config) NormalizeURL

func (c *Config) NormalizeURL()

func (*Config) ProjectClient

func (c *Config) ProjectClient(id string) (*projectClient.Client, error)

ProjectClient creates a Rancher client scoped to a Project API

func (*Config) ProjectExist

func (c *Config) ProjectExist(id string) error

func (*Config) RoleTemplateExist

func (c *Config) RoleTemplateExist(id string) error

func (*Config) SetSetting

func (c *Config) SetSetting(name, value string) error

func (*Config) SetUserPassword

func (c *Config) SetUserPassword(user *managementClient.User, pass string) (bool, *managementClient.User, error)

func (*Config) SetUserPasswordByName

func (c *Config) SetUserPasswordByName(username, pass string) (bool, string, *managementClient.User, error)

func (*Config) UpdateAuthConfig

func (c *Config) UpdateAuthConfig(url string, createObj interface{}, respObject interface{}) error

func (*Config) UpdateClusterByID

func (c *Config) UpdateClusterByID(cluster *managementClient.Cluster, update map[string]interface{}) (*managementClient.Cluster, error)

func (*Config) UpdateToken

func (c *Config) UpdateToken(token string) error

UpdateToken update tokenkey and restart client connections

func (*Config) UserPasswordChanged

func (c *Config) UserPasswordChanged(user *managementClient.User, pass string) bool

type GoogleKubernetesEngineConfig

type GoogleKubernetesEngineConfig struct {
	ClusterIpv4Cidr                    string            `json:"clusterIpv4Cidr,omitempty" yaml:"clusterIpv4Cidr,omitempty"`
	Credential                         string            `json:"credential,omitempty" yaml:"credential,omitempty"`
	Description                        string            `json:"description,omitempty" yaml:"description,omitempty"`
	DiskSizeGb                         int64             `json:"diskSizeGb,omitempty" yaml:"diskSizeGb,omitempty"`
	DiskType                           string            `json:"diskType,omitempty" yaml:"diskType,omitempty"`
	DisplayName                        string            `json:"displayName,omitempty" yaml:"displayName,omitempty"`
	EnableAlphaFeature                 bool              `json:"enableAlphaFeature,omitempty" yaml:"enableAlphaFeature,omitempty"`
	EnableAutoRepair                   bool              `json:"enableAutoRepair,omitempty" yaml:"enableAutoRepair,omitempty"`
	EnableAutoUpgrade                  bool              `json:"enableAutoUpgrade,omitempty" yaml:"enableAutoUpgrade,omitempty"`
	EnableHorizontalPodAutoscaling     *bool             `json:"enableHorizontalPodAutoscaling,omitempty" yaml:"enableHorizontalPodAutoscaling,omitempty"`
	EnableHTTPLoadBalancing            *bool             `json:"enableHttpLoadBalancing,omitempty" yaml:"enableHttpLoadBalancing,omitempty"`
	EnableKubernetesDashboard          bool              `json:"enableKubernetesDashboard,omitempty" yaml:"enableKubernetesDashboard,omitempty"`
	EnableLegacyAbac                   bool              `json:"enableLegacyAbac,omitempty" yaml:"enableLegacyAbac,omitempty"`
	EnableMasterAuthorizedNetwork      bool              `json:"enableMasterAuthorizedNetwork,omitempty" yaml:"enableMasterAuthorizedNetwork,omitempty"`
	EnableNetworkPolicyConfig          *bool             `json:"enableNetworkPolicyConfig,omitempty" yaml:"enableNetworkPolicyConfig,omitempty"`
	EnableNodepoolAutoscaling          bool              `json:"enableNodepoolAutoscaling,omitempty" yaml:"enableNodepoolAutoscaling,omitempty"`
	EnablePrivateEndpoint              bool              `json:"enablePrivateEndpoint,omitempty" yaml:"enablePrivateEndpoint,omitempty"`
	EnablePrivateNodes                 bool              `json:"enablePrivateNodes,omitempty" yaml:"enablePrivateNodes,omitempty"`
	EnableStackdriverLogging           *bool             `json:"enableStackdriverLogging,omitempty" yaml:"enableStackdriverLogging,omitempty"`
	EnableStackdriverMonitoring        *bool             `json:"enableStackdriverMonitoring,omitempty" yaml:"enableStackdriverMonitoring,omitempty"`
	ImageType                          string            `json:"imageType,omitempty" yaml:"imageType,omitempty"`
	IPPolicyClusterIpv4CidrBlock       string            `json:"ipPolicyClusterIpv4CidrBlock,omitempty" yaml:"ipPolicyClusterIpv4CidrBlock,omitempty"`
	IPPolicyClusterSecondaryRangeName  string            `json:"ipPolicyClusterSecondaryRangeName,omitempty" yaml:"ipPolicyClusterSecondaryRangeName,omitempty"`
	IPPolicyCreateSubnetwork           bool              `json:"ipPolicyCreateSubnetwork,omitempty" yaml:"ipPolicyCreateSubnetwork,omitempty"`
	IPPolicyNodeIpv4CidrBlock          string            `json:"ipPolicyNodeIpv4CidrBlock,omitempty" yaml:"ipPolicyNodeIpv4CidrBlock,omitempty"`
	IPPolicyServicesIpv4CidrBlock      string            `json:"ipPolicyServicesIpv4CidrBlock,omitempty" yaml:"ipPolicyServicesIpv4CidrBlock,omitempty"`
	IPPolicyServicesSecondaryRangeName string            `json:"ipPolicyServicesSecondaryRangeName,omitempty" yaml:"ipPolicyServicesSecondaryRangeName,omitempty"`
	IPPolicySubnetworkName             string            `json:"ipPolicySubnetworkName,omitempty" yaml:"ipPolicySubnetworkName,omitempty"`
	IssueClientCertificate             bool              `json:"issueClientCertificate,omitempty" yaml:"issueClientCertificate,omitempty"`
	KubernetesDashboard                bool              `json:"kubernetesDashboard,omitempty" yaml:"kubernetesDashboard,omitempty"`
	Labels                             map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	LocalSsdCount                      int64             `json:"localSsdCount,omitempty" yaml:"localSsdCount,omitempty"`
	Locations                          []string          `json:"locations,omitempty" yaml:"locations,omitempty"`
	MachineType                        string            `json:"machineType,omitempty" yaml:"machineType,omitempty"`
	MaintenanceWindow                  string            `json:"maintenanceWindow,omitempty" yaml:"maintenanceWindow,omitempty"`
	MasterAuthorizedNetworkCidrBlocks  []string          `json:"masterAuthorizedNetworkCidrBlocks,omitempty" yaml:"masterAuthorizedNetworkCidrBlocks,omitempty"`
	MasterIpv4CidrBlock                string            `json:"masterIpv4CidrBlock,omitempty" yaml:"masterIpv4CidrBlock,omitempty"`
	MasterVersion                      string            `json:"masterVersion,omitempty" yaml:"masterVersion,omitempty"`
	MaxNodeCount                       int64             `json:"maxNodeCount,omitempty" yaml:"maxNodeCount,omitempty"`
	MinNodeCount                       int64             `json:"minNodeCount,omitempty" yaml:"minNodeCount,omitempty"`
	Name                               string            `json:"name,omitempty" yaml:"name,omitempty"`
	Network                            string            `json:"network,omitempty" yaml:"network,omitempty"`
	NodeCount                          int64             `json:"nodeCount,omitempty" yaml:"nodeCount,omitempty"`
	NodePool                           string            `json:"nodePool,omitempty" yaml:"nodePool,omitempty"`
	NodeVersion                        string            `json:"nodeVersion,omitempty" yaml:"nodeVersion,omitempty"`
	OauthScopes                        []string          `json:"oauthScopes,omitempty" yaml:"oauthScopes,omitempty"`
	Preemptible                        bool              `json:"preemptible,omitempty" yaml:"preemptible,omitempty"`
	ProjectID                          string            `json:"projectId,omitempty" yaml:"projectId,omitempty"`
	ResourceLabels                     map[string]string `json:"resourceLabels,omitempty" yaml:"resourceLabels,omitempty"`
	ServiceAccount                     string            `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"`
	SubNetwork                         string            `json:"subNetwork,omitempty" yaml:"subNetwork,omitempty"`
	UseIPAliases                       bool              `json:"useIpAliases,omitempty" yaml:"useIpAliases,omitempty"`
	Taints                             []string          `json:"taints,omitempty" yaml:"taints,omitempty"`
	Zone                               string            `json:"zone,omitempty" yaml:"zone,omitempty"`
}

type NodeTemplate

type NodeTemplate struct {
	managementClient.NodeTemplate
	Amazonec2Config     *amazonec2Config     `json:"amazonec2Config,omitempty" yaml:"amazonec2Config,omitempty"`
	AzureConfig         *azureConfig         `json:"azureConfig,omitempty" yaml:"azureConfig,omitempty"`
	DigitaloceanConfig  *digitaloceanConfig  `json:"digitaloceanConfig,omitempty" yaml:"digitaloceanConfig,omitempty"`
	OpenstackConfig     *openstackConfig     `json:"openstackConfig,omitempty" yaml:"openstackConfig,omitempty"`
	VmwarevsphereConfig *vmwarevsphereConfig `json:"vmwarevsphereConfig,omitempty" yaml:"vmwarevsphereConfig,omitempty"`
}

Source Files

Jump to

Keyboard shortcuts

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