Documentation
¶
Index ¶
- Constants
- func Version(deploy *appsv1.Deployment) string
- type Agent
- type Client
- type MockClient
- func (m *MockClient) Agent(ctx context.Context) (*Agent, error)
- func (m *MockClient) ClusterRole(ctx context.Context) (*rbacv1.ClusterRole, error)
- func (m *MockClient) ClusterRoleBinding(ctx context.Context) (*rbacv1.ClusterRoleBinding, error)
- func (m *MockClient) Deployment(ctx context.Context, name string) (*appsv1.Deployment, error)
- func (m *MockClient) Namespace(ctx context.Context) (*v1.Namespace, error)
- func (m *MockClient) Pods(ctx context.Context, labelSelector string) (*v1.PodList, error)
- func (m *MockClient) Resources(ctx context.Context) ([]string, error)
- func (m *MockClient) Secret(ctx context.Context) (*v1.Secret, error)
- func (m *MockClient) ServiceAccount(ctx context.Context) (*v1.ServiceAccount, error)
Constants ¶
const (
// Namespace is the namespace where the Buoyant Cloud agent is installed.
Namespace = "buoyant-cloud"
// AgentName is the name of the Buoyant Cloud Agent deployment.
AgentName = "buoyant-cloud-agent"
// MetricsName is the name of the Buoyant Cloud Metrics deployment.
MetricsName = "buoyant-cloud-metrics"
// VersionLabel is the label key for the agent's version
VersionLabel = "app.kubernetes.io/version"
)
const (
// PartOfKey is the label key found on all Buoyant Cloud resources.
PartOfKey = "app.kubernetes.io/part-of"
// PartOfVal is the label value found on all Buoyant Cloud resources.
PartOfVal = "buoyant-cloud"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
Name string
Version string
URL string
}
Agent represents the Buoyant Cloud agent. Any of these fields may not be present, depending on which resources are already on the cluster.
type Client ¶
type Client interface {
// Namespace retrieves the buoyant-cloud Namespace.
Namespace(ctx context.Context) (*v1.Namespace, error)
// ClusterRole retrieves the buoyant-cloud-agent CR.
ClusterRole(ctx context.Context) (*rbacv1.ClusterRole, error)
// ClusterRoleBinding retrieves the buoyant-cloud-agent CRB.
ClusterRoleBinding(ctx context.Context) (*rbacv1.ClusterRoleBinding, error)
// Secret retrieves the buoyant-cloud-id Secret.
Secret(ctx context.Context) (*v1.Secret, error)
// ServiceAccount retrieves the buoyant-cloud-agent ServiceAccount.
ServiceAccount(ctx context.Context) (*v1.ServiceAccount, error)
// Deployment retrieves a Deployment by name in the buoyant-cloud namespace.
Deployment(ctx context.Context, name string) (*appsv1.Deployment, error)
// Pods retrieves a PodList by labelSelector from the buoyant-cloud
// namespace.
Pods(ctx context.Context, labelSelector string) (*v1.PodList, error)
// Agent retrieves the Buoyant Cloud agent from Kubernetes, and returns the
// agent's name, version, and url. If Agent is not found, it will return a
// nil Agent with no error.
Agent(ctx context.Context) (*Agent, error)
// Resources returns all linkerd-buoyant resources required for deletion.
// Specifically, these three resource types matching the label
// app.kubernetes.io/part-of=buoyant-cloud:
// - ClusterRole
// - ClusterRoleBinding
// - Namespace
Resources(ctx context.Context) ([]string, error)
}
Client defines the interface for linkerd-buoyant's Kubernetes client
type MockClient ¶
type MockClient struct {
MockNamespace *v1.Namespace
MockClusterRole *rbacv1.ClusterRole
MockClusterRoleBinding *rbacv1.ClusterRoleBinding
MockSecret *v1.Secret
MockServiceAccount *v1.ServiceAccount
MockDeployment *appsv1.Deployment
MockPods *v1.PodList
MockAgent *Agent
MockResources []string
}
MockClient provides a mock Kubernetes client for testing
func (*MockClient) Agent ¶
func (m *MockClient) Agent(ctx context.Context) (*Agent, error)
Agent returns a mock Buoyant Cloud agent.
func (*MockClient) ClusterRole ¶
func (m *MockClient) ClusterRole(ctx context.Context) (*rbacv1.ClusterRole, error)
ClusterRole returns a mock ClusterRole object.
func (*MockClient) ClusterRoleBinding ¶
func (m *MockClient) ClusterRoleBinding(ctx context.Context) (*rbacv1.ClusterRoleBinding, error)
ClusterRoleBinding returns a mock ClusterRoleBinding object.
func (*MockClient) Deployment ¶
func (m *MockClient) Deployment(ctx context.Context, name string) (*appsv1.Deployment, error)
Deployment returns a mock Deployment object.
func (*MockClient) Namespace ¶
func (m *MockClient) Namespace(ctx context.Context) (*v1.Namespace, error)
Namespace returns a mock Namespace object.
func (*MockClient) Pods ¶
func (m *MockClient) Pods(ctx context.Context, labelSelector string) (*v1.PodList, error)
Pods returns a mock Pod List.
func (*MockClient) Resources ¶
func (m *MockClient) Resources(ctx context.Context) ([]string, error)
Resources returns mock Buoyant Cloud agent resources.
func (*MockClient) Secret ¶
func (m *MockClient) Secret(ctx context.Context) (*v1.Secret, error)
Secret returns a mock Secret object.
func (*MockClient) ServiceAccount ¶
func (m *MockClient) ServiceAccount(ctx context.Context) (*v1.ServiceAccount, error)
ServiceAccount returns a mock ServiceAccount object.