-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
types.go
149 lines (115 loc) · 6.28 KB
/
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package v1
import (
"github.com/rancher/wrangler/v2/pkg/genericcondition"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +kubebuilder:skipversion
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterRepo struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RepoSpec `json:"spec"`
Status RepoStatus `json:"status"`
}
// SecretReference a reference to a secret object
type SecretReference struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
}
// ExponentialBackOffValues are values in seconds for the ratelimiting func when OCI registry sends 429 http response code.
type ExponentialBackOffValues struct {
MinWait int `json:"minWait,omitempty"`
MaxWait int `json:"maxWait,omitempty"`
MaxRetries int `json:"maxRetries,omitempty"`
}
type RepoSpec struct {
// URL can be a HTTP URL i.e https://charts.rancher.io or an OCI URL i.e oci://dp.apps.rancher.io/charts/etcd.
URL string `json:"url,omitempty"`
// InsecurePlainHTTP is only valid for OCI URL's and allows insecure connections to registries without enforcing TLS checks.
InsecurePlainHTTP bool `json:"insecurePlainHttp,omitempty"`
// GitRepo a git repo to clone and index as the helm repo
GitRepo string `json:"gitRepo,omitempty"`
// GitBranch The git branch to follow
GitBranch string `json:"gitBranch,omitempty"`
// ExponentialBackOffValues are values given to the Rancher manager to handle
// 429 TOOMANYREQUESTS response code from the OCI registry.
ExponentialBackOffValues *ExponentialBackOffValues `json:"exponentialBackOffValues,omitempty"`
// CABundle is a PEM encoded CA bundle which will be used to validate the repo's certificate.
// If unspecified, system trust roots will be used.
CABundle []byte `json:"caBundle,omitempty"`
// InsecureSkipTLSverify will use insecure HTTPS to download the repo's index.
InsecureSkipTLSverify bool `json:"insecureSkipTLSVerify,omitempty"`
// ClientSecretName is the client secret to be used to connect to the repo
// It is expected the secret be of type "kubernetes.io/basic-auth" or "kubernetes.io/tls" for Helm repos
// and "kubernetes.io/basic-auth" or "kubernetes.io/ssh-auth" for git repos.
// For a repo the Namespace file will be ignored
ClientSecret *SecretReference `json:"clientSecret,omitempty"`
// BasicAuthSecretName is the client secret to be used to connect to the repo
BasicAuthSecretName string `json:"basicAuthSecretName,omitempty"`
// ForceUpdate will cause the repo index to be downloaded if it was last download before the specified time
// If ForceUpdate is greater than time.Now() it will not trigger an update
ForceUpdate *metav1.Time `json:"forceUpdate,omitempty"`
// ServiceAccount this service account will be used to deploy charts instead of the end users credentials
ServiceAccount string `json:"serviceAccount,omitempty"`
// ServiceAccountNamespace namespace of the service account to use. This value is used only on
// ClusterRepo and will be ignored on Repo
ServiceAccountNamespace string `json:"serviceAccountNamespace,omitempty"`
// If disabled the repo clone will not be updated or allowed to be installed from
Enabled *bool `json:"enabled,omitempty"`
// DisableSameOriginCheck attaches the Basic Auth Header to all helm client API calls, regardless of whether the destination of the API call matches the origin of the repository's URL
// This field is not supported for OCI based URLs
DisableSameOriginCheck bool `json:"disableSameOriginCheck,omitempty"`
}
type RepoCondition string
const (
RepoDownloaded RepoCondition = "Downloaded"
FollowerRepoDownloaded RepoCondition = "FollowerDownloaded"
OCIDownloaded RepoCondition = "OCIDownloaded"
)
type RepoStatus struct {
ObservedGeneration int64 `json:"observedGeneration"`
// IndexConfigMapName is the configmap with the store index in it
IndexConfigMapName string `json:"indexConfigMapName,omitempty"`
IndexConfigMapNamespace string `json:"indexConfigMapNamespace,omitempty"`
IndexConfigMapResourceVersion string `json:"indexConfigMapResourceVersion,omitempty"`
// DownloadTime the time when the index was last downloaded
DownloadTime metav1.Time `json:"downloadTime,omitempty"`
// The URL used for the last successful index
URL string `json:"url,omitempty"`
// The branch used for the last successful index
Branch string `json:"branch,omitempty"`
// The git commit used to generate the index
Commit string `json:"commit,omitempty"`
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
// Number of times the handler will retry if it gets a 429 error
NumberOfRetries int `json:"numberOfRetries,omitempty"`
// The time the next retry will happen
NextRetryAt metav1.Time `json:"nextRetryAt,omitempty"`
// If the handler should be skipped or not
ShouldNotSkip bool `json:"shouldNotSkip,omitempty"`
}
// +genclient
// +kubebuilder:skipversion
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Operation struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Status OperationStatus `json:"status"`
}
type OperationStatus struct {
ObservedGeneration int64 `json:"observedGeneration"`
Action string `json:"action,omitempty"`
Chart string `json:"chart,omitempty"`
Version string `json:"version,omitempty"`
Release string `json:"releaseName,omitempty"`
Namespace string `json:"namespace,omitempty"`
ProjectID string `json:"projectId,omitempty"`
Token string `json:"token,omitempty"`
Command []string `json:"command,omitempty"`
PodName string `json:"podName,omitempty"`
PodNamespace string `json:"podNamespace,omitempty"`
PodCreated bool `json:"podCreated,omitempty"`
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
}