config

package
v2.6.0-nightly.20230509 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthConfig        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConfig = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ContextSource_name = map[int32]string{
	0: "NONE",
	1: "CONFIG_V1",
	2: "HUB",
	3: "IMPORTED",
}
View Source
var ContextSource_value = map[string]int32{
	"NONE":      0,
	"CONFIG_V1": 1,
	"HUB":       2,
	"IMPORTED":  3,
}

Functions

func KubeConfig

func KubeConfig(context *Context) clientcmd.ClientConfig

KubeConfig gets the kubernetes config

func RawKubeConfig

func RawKubeConfig() (api.Config, error)

RawKubeConfig gets the "raw" kube config, e.g. without overrides

func WritePachTokenToConfig

func WritePachTokenToConfig(token string, enterpriseContext bool) error

WritePachTokenToConfig sets the auth token for the current pachctl config. Used during tests to ensure we don't lose access to a cluster if a test fails.

func WritePachTokenToConfigPath

func WritePachTokenToConfigPath(token string, path string, enterpriseContext bool) error

Types

type Config

type Config struct {
	UserID string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// Configuration options. Exactly one of these fields should be set
	// (depending on which version of the config is being used)
	V1                   *ConfigV1 `protobuf:"bytes,2,opt,name=v1,proto3" json:"v1,omitempty"`
	V2                   *ConfigV2 `protobuf:"bytes,3,opt,name=v2,proto3" json:"v2,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

Config specifies the pachyderm config that is read and interpreted by the pachctl command-line tool. Right now, this is stored at $HOME/.pachyderm/config.

Different versions of the pachyderm config are specified as subfields of this message (this allows us to make significant changes to the config structure without breaking existing users by defining a new config version).

These structures are stored in a JSON format, so it should be safe to modify fields as long as compatibility is ensured with previous versions.

func Read

func Read(ignoreCache, readOnly bool) (*Config, error)

Read loads the Pachyderm config on this machine. If an existing configuration cannot be found, it sets up the defaults. Read returns a nil Config if and only if it returns a non-nil error.

func (*Config) ActiveContext

func (c *Config) ActiveContext(errorOnNoActive bool) (string, *Context, error)

ActiveContext gets the active context in the config

func (*Config) ActiveEnterpriseContext

func (c *Config) ActiveEnterpriseContext(errorOnNoActive bool) (string, *Context, error)

ActiveEnterpriseContext gets the active enterprise server context in the config. If no enterprise context is configured, this returns the active context.

func (*Config) Descriptor

func (*Config) Descriptor() ([]byte, []int)

func (*Config) GetUserID

func (m *Config) GetUserID() string

func (*Config) GetV1

func (m *Config) GetV1() *ConfigV1

func (*Config) GetV2

func (m *Config) GetV2() *ConfigV2

func (*Config) InitV2

func (c *Config) InitV2() error

InitV2 initializes the V2 object of the config

func (*Config) Marshal

func (m *Config) Marshal() (dAtA []byte, err error)

func (*Config) MarshalLogObject

func (x *Config) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*Config) MarshalTo

func (m *Config) MarshalTo(dAtA []byte) (int, error)

func (*Config) MarshalToSizedBuffer

func (m *Config) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) Size

func (m *Config) Size() (n int)

func (*Config) String

func (m *Config) String() string

func (*Config) Unmarshal

func (m *Config) Unmarshal(dAtA []byte) error

func (*Config) Write

func (c *Config) Write() error

func (*Config) XXX_DiscardUnknown

func (m *Config) XXX_DiscardUnknown()

func (*Config) XXX_Marshal

func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Config) XXX_Merge

func (m *Config) XXX_Merge(src proto.Message)

func (*Config) XXX_Size

func (m *Config) XXX_Size() int

func (*Config) XXX_Unmarshal

func (m *Config) XXX_Unmarshal(b []byte) error

type ConfigV1

type ConfigV1 struct {
	// A host:port pointing pachd at a pachyderm cluster.
	PachdAddress string `protobuf:"bytes,1,opt,name=pachd_address,json=pachdAddress,proto3" json:"pachd_address,omitempty"`
	// Trusted root certificates (overrides installed certificates), formatted
	// as base64-encoded PEM
	ServerCAs string `protobuf:"bytes,2,opt,name=server_cas,json=serverCas,proto3" json:"server_cas,omitempty"`
	// A secret token identifying the current pachctl user within their
	// pachyderm cluster. This is included in all RPCs sent by pachctl, and used
	// to determine if pachctl actions are authorized.
	SessionToken string `protobuf:"bytes,3,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"`
	// The currently active transaction for batching together pachctl commands.
	// This can be set or cleared via many of the `pachctl * transaction` commands.
	// This is the ID of the transaction object stored in the pachyderm etcd.
	ActiveTransaction    string   `protobuf:"bytes,4,opt,name=active_transaction,json=activeTransaction,proto3" json:"active_transaction,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ConfigV1 specifies v1 of the pachyderm config (June 30 2017 - June 2019)

func (*ConfigV1) Descriptor

func (*ConfigV1) Descriptor() ([]byte, []int)

func (*ConfigV1) GetActiveTransaction

func (m *ConfigV1) GetActiveTransaction() string

func (*ConfigV1) GetPachdAddress

func (m *ConfigV1) GetPachdAddress() string

func (*ConfigV1) GetServerCAs

func (m *ConfigV1) GetServerCAs() string

func (*ConfigV1) GetSessionToken

func (m *ConfigV1) GetSessionToken() string

func (*ConfigV1) Marshal

func (m *ConfigV1) Marshal() (dAtA []byte, err error)

func (*ConfigV1) MarshalLogObject

func (x *ConfigV1) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*ConfigV1) MarshalTo

func (m *ConfigV1) MarshalTo(dAtA []byte) (int, error)

func (*ConfigV1) MarshalToSizedBuffer

func (m *ConfigV1) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ConfigV1) ProtoMessage

func (*ConfigV1) ProtoMessage()

func (*ConfigV1) Reset

func (m *ConfigV1) Reset()

func (*ConfigV1) Size

func (m *ConfigV1) Size() (n int)

func (*ConfigV1) String

func (m *ConfigV1) String() string

func (*ConfigV1) Unmarshal

func (m *ConfigV1) Unmarshal(dAtA []byte) error

func (*ConfigV1) XXX_DiscardUnknown

func (m *ConfigV1) XXX_DiscardUnknown()

func (*ConfigV1) XXX_Marshal

func (m *ConfigV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConfigV1) XXX_Merge

func (m *ConfigV1) XXX_Merge(src proto.Message)

func (*ConfigV1) XXX_Size

func (m *ConfigV1) XXX_Size() int

func (*ConfigV1) XXX_Unmarshal

func (m *ConfigV1) XXX_Unmarshal(b []byte) error

type ConfigV2

type ConfigV2 struct {
	ActiveContext           string              `protobuf:"bytes,1,opt,name=active_context,json=activeContext,proto3" json:"active_context,omitempty"`
	ActiveEnterpriseContext string              `` /* 132-byte string literal not displayed */
	Contexts                map[string]*Context `` /* 157-byte string literal not displayed */
	Metrics                 bool                `protobuf:"varint,4,opt,name=metrics,proto3" json:"metrics,omitempty"`
	MaxShellCompletions     int64               `protobuf:"varint,5,opt,name=max_shell_completions,json=maxShellCompletions,proto3" json:"max_shell_completions,omitempty"`
	XXX_NoUnkeyedLiteral    struct{}            `json:"-"`
	XXX_unrecognized        []byte              `json:"-"`
	XXX_sizecache           int32               `json:"-"`
}

ConfigV2 specifies v2 of the pachyderm config (June 2019 - present)

func (*ConfigV2) Descriptor

func (*ConfigV2) Descriptor() ([]byte, []int)

func (*ConfigV2) GetActiveContext

func (m *ConfigV2) GetActiveContext() string

func (*ConfigV2) GetActiveEnterpriseContext

func (m *ConfigV2) GetActiveEnterpriseContext() string

func (*ConfigV2) GetContexts

func (m *ConfigV2) GetContexts() map[string]*Context

func (*ConfigV2) GetMaxShellCompletions

func (m *ConfigV2) GetMaxShellCompletions() int64

func (*ConfigV2) GetMetrics

func (m *ConfigV2) GetMetrics() bool

func (*ConfigV2) Marshal

func (m *ConfigV2) Marshal() (dAtA []byte, err error)

func (*ConfigV2) MarshalLogObject

func (x *ConfigV2) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*ConfigV2) MarshalTo

func (m *ConfigV2) MarshalTo(dAtA []byte) (int, error)

func (*ConfigV2) MarshalToSizedBuffer

func (m *ConfigV2) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ConfigV2) ProtoMessage

func (*ConfigV2) ProtoMessage()

func (*ConfigV2) Reset

func (m *ConfigV2) Reset()

func (*ConfigV2) Size

func (m *ConfigV2) Size() (n int)

func (*ConfigV2) String

func (m *ConfigV2) String() string

func (*ConfigV2) Unmarshal

func (m *ConfigV2) Unmarshal(dAtA []byte) error

func (*ConfigV2) XXX_DiscardUnknown

func (m *ConfigV2) XXX_DiscardUnknown()

func (*ConfigV2) XXX_Marshal

func (m *ConfigV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConfigV2) XXX_Merge

func (m *ConfigV2) XXX_Merge(src proto.Message)

func (*ConfigV2) XXX_Size

func (m *ConfigV2) XXX_Size() int

func (*ConfigV2) XXX_Unmarshal

func (m *ConfigV2) XXX_Unmarshal(b []byte) error

type Context

type Context struct {
	// Where this context came from
	Source ContextSource `protobuf:"varint,1,opt,name=source,proto3,enum=config_v2.ContextSource" json:"source,omitempty"`
	// The hostname or IP address pointing pachd at a pachyderm cluster.
	PachdAddress string `protobuf:"bytes,2,opt,name=pachd_address,json=pachdAddress,proto3" json:"pachd_address,omitempty"`
	// Trusted root certificates (overrides installed certificates), formatted
	// as base64-encoded PEM.
	ServerCAs string `protobuf:"bytes,3,opt,name=server_cas,json=serverCas,proto3" json:"server_cas,omitempty"`
	// A secret token identifying the current pachctl user within their
	// pachyderm cluster. This is included in all RPCs sent by pachctl, and used
	// to determine if pachctl actions are authorized.
	SessionToken string `protobuf:"bytes,4,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"`
	// The currently active transaction for batching together pachctl commands.
	// This can be set or cleared via many of the `pachctl * transaction` commands.
	// This is the ID of the transaction object stored in the pachyderm etcd.
	ActiveTransaction string `protobuf:"bytes,5,opt,name=active_transaction,json=activeTransaction,proto3" json:"active_transaction,omitempty"`
	// The k8s cluster name - used to construct a k8s context.
	ClusterName string `protobuf:"bytes,6,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"`
	// The k8s auth info - used to construct a k8s context.
	AuthInfo string `protobuf:"bytes,7,opt,name=auth_info,json=authInfo,proto3" json:"auth_info,omitempty"`
	// The k8s namespace - used to construct a k8s context.
	Namespace string `protobuf:"bytes,8,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// A mapping of service -> port number, when port forwarding is
	// running for this context.
	PortForwarders map[string]uint32 `` /* 192-byte string literal not displayed */
	// A unique ID for the cluster deployment. At client initialization time,
	// we ensure this is the same as what the cluster reports back, to prevent
	// us from connecting to the wrong cluster.
	ClusterDeploymentID string `protobuf:"bytes,10,opt,name=cluster_deployment_id,json=clusterDeploymentId,proto3" json:"cluster_deployment_id,omitempty"`
	// A boolean that records whether the context points at an enterprise server.
	// If false, the context points at a stand-alone pachd.
	EnterpriseServer bool `protobuf:"varint,11,opt,name=enterprise_server,json=enterpriseServer,proto3" json:"enterprise_server,omitempty"`
	// The current project.
	Project              string   `protobuf:"bytes,12,opt,name=project,proto3" json:"project,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Context) Descriptor

func (*Context) Descriptor() ([]byte, []int)

func (*Context) GetActiveTransaction

func (m *Context) GetActiveTransaction() string

func (*Context) GetAuthInfo

func (m *Context) GetAuthInfo() string

func (*Context) GetClusterDeploymentID

func (m *Context) GetClusterDeploymentID() string

func (*Context) GetClusterName

func (m *Context) GetClusterName() string

func (*Context) GetEnterpriseServer

func (m *Context) GetEnterpriseServer() bool

func (*Context) GetNamespace

func (m *Context) GetNamespace() string

func (*Context) GetPachdAddress

func (m *Context) GetPachdAddress() string

func (*Context) GetPortForwarders

func (m *Context) GetPortForwarders() map[string]uint32

func (*Context) GetProject

func (m *Context) GetProject() string

func (*Context) GetServerCAs

func (m *Context) GetServerCAs() string

func (*Context) GetSessionToken

func (m *Context) GetSessionToken() string

func (*Context) GetSource

func (m *Context) GetSource() ContextSource

func (*Context) Marshal

func (m *Context) Marshal() (dAtA []byte, err error)

func (*Context) MarshalLogObject

func (x *Context) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*Context) MarshalTo

func (m *Context) MarshalTo(dAtA []byte) (int, error)

func (*Context) MarshalToSizedBuffer

func (m *Context) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Context) ProtoMessage

func (*Context) ProtoMessage()

func (*Context) Reset

func (m *Context) Reset()

func (*Context) Size

func (m *Context) Size() (n int)

func (*Context) String

func (m *Context) String() string

func (*Context) Unmarshal

func (m *Context) Unmarshal(dAtA []byte) error

func (*Context) XXX_DiscardUnknown

func (m *Context) XXX_DiscardUnknown()

func (*Context) XXX_Marshal

func (m *Context) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Context) XXX_Merge

func (m *Context) XXX_Merge(src proto.Message)

func (*Context) XXX_Size

func (m *Context) XXX_Size() int

func (*Context) XXX_Unmarshal

func (m *Context) XXX_Unmarshal(b []byte) error

type ContextSource

type ContextSource int32
const (
	ContextSource_NONE      ContextSource = 0
	ContextSource_CONFIG_V1 ContextSource = 1
	ContextSource_HUB       ContextSource = 2
	ContextSource_IMPORTED  ContextSource = 3
)

func (ContextSource) EnumDescriptor

func (ContextSource) EnumDescriptor() ([]byte, []int)

func (ContextSource) String

func (x ContextSource) String() string

Jump to

Keyboard shortcuts

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