-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin_types.go
99 lines (78 loc) · 2.64 KB
/
plugin_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
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PluginSpec defines the desired state of Plugin
type PluginSpec struct {
// ShortDescription of the plugin.
// +required
ShortDescription string `json:"shortDescription"`
// Description of the plugin.
// +optional
Description string `json:"description,omitempty"`
// Caveats of using the plugin.
// +optional
Caveats string `json:"caveats,omitempty"`
// Homepage of the plugin.
// +optional
Homepage string `json:"homepage,omitempty"`
// Version of the plugin.
// +required
Version string `json:"version"`
// Platforms the plugin supports.
// +required
Platforms []PluginPlatform `json:"platforms"`
}
// PluginPlatform defines per-OS and per-Arch binaries for the given plugin.
type PluginPlatform struct {
// Platform for the given binary (i.e. linux/amd64, darwin/amd64, windows/amd64).
// +required
Platform string `json:"platform"`
// Image containing plugin.
// +required
Image string `json:"image"`
// ImagePullSecret to use when connecting to an image registry that requires authentication.
// +optional
ImagePullSecret string `json:"imagePullSecret,omitempty"`
// Files is a list of file locations within the image that need to be extracted.
// +required
Files []FileLocation `json:"files"`
// Bin specifies the path to the plugin executable.
// The path is relative to the root of the installation folder.
// The binary will be linked after all FileOperations are executed.
// +required
Bin string `json:"bin"`
}
// FileLocation specifies a file copying operation from plugin archive to the
// installation directory.
type FileLocation struct {
// From is the absolute file path within the image to copy from.
// Directories and wildcards are not currently supported.
// +required
From string `json:"from"`
// To is the relative path within the root of the installation folder to place the file.
// +required
To string `json:"to"`
}
// PluginStatus defines the observed state of Plugin.
type PluginStatus struct{}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=Plugins,scope=Cluster
// Plugin is the Schema for the plugins API
type Plugin struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PluginSpec `json:"spec,omitempty"`
Status PluginStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// PluginList contains a list of Plugin
type PluginList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Plugin `json:"items"`
}
func init() {
SchemeBuilder.Register(&Plugin{}, &PluginList{})
}