/
authenticator.go
38 lines (28 loc) · 1.33 KB
/
authenticator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package authenticator
import "context"
// DockerAuth Structure for the authentication file
type DockerAuth struct {
Auths map[string]DockerAuthRegistry `json:"auths,omitempty"`
}
type DockerAuthRegistry struct {
Auth string `json:"auth"`
}
//go:generate mockgen -source authenticator.go -destination=mocks/authenticator.go -package=mocks Authenticator
// Authenticator is an interface for creating an authentication file with credentials to private registries
//
// Currently this is used with the Helm Driver which takes credentials in this way
// For this first implementation, kubernetes secrets will be used to pass in a token
type Authenticator interface {
// Initialize Points Authenticator to target cluster
Initialize(clusterName string) error
// AuthFilename Gets Authentication File Path for OCI Registry
AuthFilename() string
// AddToConfigMap Adds Namespace to config map
AddToConfigMap(ctx context.Context, name, namespace string) error
// DelFromConfigMap Removes Namespace from config map
DelFromConfigMap(ctx context.Context, name, namespace string) error
// GetSecretValues Retrieves ImagePullSecrets data to pass to helm chart
GetSecretValues(ctx context.Context, namespace string) (map[string]interface{}, error)
// AddSecretToAllNamespace Add Secrets to all namespaces
AddSecretToAllNamespace(ctx context.Context) error
}