/
registrycredential_types.go
67 lines (51 loc) · 1.7 KB
/
registrycredential_types.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package v1alpha1
import (
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PasswordSecretRef the password secret reference
type PasswordSecretRef struct {
// The Secret to select from.
corev1.LocalObjectReference `json:",inline"`
// Key for Secret data
Key string `json:"key"`
}
// RegistryCredentialSpec is a specification of registry credentials
type RegistryCredentialSpec struct {
// Registry username
Username string `json:"username"`
// Registry user email address
Email string `json:"email"`
// Registry FQDN
Server string `json:"server"`
// The password Secret to select from
PasswordSecretRef PasswordSecretRef `json:"password"`
}
// RegistryCredentialStatus defines the observed state of RegistryCredential
type RegistryCredentialStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
//+genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
type RegistryCredential struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RegistryCredentialSpec `json:"spec"`
Status RegistryCredentialStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// RegistryCredentialList contains a list of RegistryCredential
type RegistryCredentialList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RegistryCredential `json:"items"`
}
func (r *RegistryCredential) GetPasswordSecretName() string {
return fmt.Sprintf("registry-secret-%s", r.Name)
}
func init() {
SchemeBuilder.Register(&RegistryCredential{}, &RegistryCredentialList{})
}