generated from cybozu-go/neco-template
/
job_types.go
137 lines (117 loc) · 4.71 KB
/
job_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
package v1beta2
import (
"encoding/json"
"k8s.io/apimachinery/pkg/api/resource"
corev1ac "k8s.io/client-go/applyconfigurations/core/v1"
)
// JobConfig is a set of parameters for backup and restore job Pods.
type JobConfig struct {
// ServiceAccountName specifies the ServiceAccount to run the Pod.
// +kubebuilder:validation:MinLength=1
ServiceAccountName string `json:"serviceAccountName"`
// Specifies how to access an object storage bucket.
BucketConfig BucketConfig `json:"bucketConfig"`
// WorkVolume is the volume source for the working directory.
// Since the backup or restore task can use a lot of bytes in the working directory,
// You should always give a volume with enough capacity.
//
// The recommended volume source is a generic ephemeral volume.
// https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes
WorkVolume VolumeSourceApplyConfiguration `json:"workVolume"`
// Threads is the number of threads used for backup or restoration.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=4
// +optional
Threads int `json:"threads,omitempty"`
// Memory is the amount of memory requested for the Pod.
// +kubebuilder:default="4Gi"
// +nullable
// +optional
Memory *resource.Quantity `json:"memory,omitempty"`
// MaxMemory is the amount of maximum memory for the Pod.
// +nullable
// +optional
MaxMemory *resource.Quantity `json:"maxMemory,omitempty"`
// List of sources to populate environment variables in the container.
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
// will be reported as an event when the container is starting. When a key exists in multiple
// sources, the value associated with the last source will take precedence.
// Values defined by an Env with a duplicate key will take precedence.
//
// You can configure S3 bucket access parameters through environment variables.
// See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/config#EnvConfig
//
// +optional
EnvFrom []EnvFromSourceApplyConfiguration `json:"envFrom,omitempty"`
// List of environment variables to set in the container.
//
// You can configure S3 bucket access parameters through environment variables.
// See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/config#EnvConfig
//
// +optional
Env []EnvVarApplyConfiguration `json:"env,omitempty"`
}
// VolumeSourceApplyConfiguration is the type defined to implement the DeepCopy method.
type VolumeSourceApplyConfiguration corev1ac.VolumeSourceApplyConfiguration
// DeepCopy is copying the receiver, creating a new VolumeSourceApplyConfiguration.
func (in *VolumeSourceApplyConfiguration) DeepCopy() *VolumeSourceApplyConfiguration {
out := new(VolumeSourceApplyConfiguration)
bytes, err := json.Marshal(in)
if err != nil {
panic("Failed to marshal")
}
err = json.Unmarshal(bytes, out)
if err != nil {
panic("Failed to unmarshal")
}
return out
}
// EnvFromSourceApplyConfiguration is the type defined to implement the DeepCopy method.
type EnvFromSourceApplyConfiguration corev1ac.EnvFromSourceApplyConfiguration
// DeepCopy is copying the receiver, creating a new EnvFromSourceApplyConfiguration.
func (in *EnvFromSourceApplyConfiguration) DeepCopy() *EnvFromSourceApplyConfiguration {
out := new(EnvFromSourceApplyConfiguration)
bytes, err := json.Marshal(in)
if err != nil {
panic("Failed to marshal")
}
err = json.Unmarshal(bytes, out)
if err != nil {
panic("Failed to unmarshal")
}
return out
}
// EnvVarApplyConfiguration is the type defined to implement the DeepCopy method.
type EnvVarApplyConfiguration corev1ac.EnvVarApplyConfiguration
// DeepCopy is copying the receiver, creating a new EnvVarApplyConfiguration.
func (in *EnvVarApplyConfiguration) DeepCopy() *EnvVarApplyConfiguration {
out := new(EnvVarApplyConfiguration)
bytes, err := json.Marshal(in)
if err != nil {
panic("Failed to marshal")
}
err = json.Unmarshal(bytes, out)
if err != nil {
panic("Failed to unmarshal")
}
return out
}
// BucketConfig is a set of parameter to access an object storage bucket.
type BucketConfig struct {
// The name of the bucket
// +kubebuilder:validation:MinLength=1
BucketName string `json:"bucketName"`
// The region of the bucket.
// This can also be set through `AWS_REGION` environment variable.
// +optional
Region string `json:"region,omitempty"`
// The API endpoint URL. Set this for non-S3 object storages.
// +kubebuilder:validation:Pattern="^https?://.*"
// +optional
EndpointURL string `json:"endpointURL,omitempty"`
// Allows you to enable the client to use path-style addressing, i.e.,
// https?://ENDPOINT/BUCKET/KEY. By default, a virtual-host addressing
// is used (https?://BUCKET.ENDPOINT/KEY).
// +optional
UsePathStyle bool `json:"usePathStyle,omitempty"`
}