This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
/
types.go
64 lines (56 loc) · 2.02 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
package bind
// YAML represents a addon plan bind.yaml structure
type YAML struct {
Credential []CredentialVar `json:"credential"`
CredentialFrom []CredentialFromSource `json:"credentialFrom"`
}
// CredentialVar represents an credential variable.
type CredentialVar struct {
// Required
Name string `json:"name"`
// Optional: no more than one of the following may be specified.
Value string `json:"value"`
// Optional: Specifies a source the value of this var should come from.
ValueFrom *CredentialVarSource `json:"valueFrom,omitempty"`
}
// CredentialVarSource represents a source for the value of an CredentialVar.
// ONLY ONE of its fields may be set.
type CredentialVarSource struct {
// Selects a key of a ConfigMap.
// +optional
ConfigMapKeyRef *KeySelector `json:"configMapKeyRef,omitempty"`
// Selects a key of a Secret in the helm release namespace.
// +optional
SecretKeyRef *KeySelector `json:"secretKeyRef,omitempty"`
// Selects a field from a Service.
// +optional
ServiceRef *JSONPathSelector `json:"serviceRef,omitempty"`
}
// KeySelector selects a key of a k8s resource.
type KeySelector struct {
NameSelector `json:",inline"`
// The key of the resource to select from.
Key string `json:"key"`
}
// JSONPathSelector select a field of a k8s resource by defining JSONPath
type JSONPathSelector struct {
NameSelector `json:",inline"`
// JSONPath template for extracting given value from resource.
JSONPath string `json:"jsonpath"`
}
// CredentialFromSource represents list of sources to populate credentials variables.
type CredentialFromSource struct {
// The ConfigMap to select from
// + optional
ConfigMapRef *NameSelector `json:"configMapRef,omitempty"`
// The Secret to select from
// +optional
SecretRef *NameSelector `json:"secretRef,omitempty"`
}
// NameSelector selects by the name of k8s resource.
type NameSelector struct {
// Name the name of k8s resource.
Name string `json:"name"`
}
// RenderedBindYAML is used to represent already rendered YAML for binding.
type RenderedBindYAML []byte