mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-26 09:54:23 +00:00
add restic integration for doing pod volume backups/restores
Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Copyright 2018 the Heptio Ark contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package install
|
||||
|
||||
import (
|
||||
@@ -8,27 +24,44 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type deploymentOption func(*deploymentConfig)
|
||||
type podTemplateOption func(*podTemplateConfig)
|
||||
|
||||
type deploymentConfig struct {
|
||||
type podTemplateConfig struct {
|
||||
image string
|
||||
withoutCredentialsVolume bool
|
||||
envVars []corev1.EnvVar
|
||||
}
|
||||
|
||||
func WithImage(image string) deploymentOption {
|
||||
return func(c *deploymentConfig) {
|
||||
func WithImage(image string) podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.image = image
|
||||
}
|
||||
}
|
||||
|
||||
func WithoutCredentialsVolume() deploymentOption {
|
||||
return func(c *deploymentConfig) {
|
||||
func WithoutCredentialsVolume() podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.withoutCredentialsVolume = true
|
||||
}
|
||||
}
|
||||
|
||||
func Deployment(namespace string, opts ...deploymentOption) *appsv1beta1.Deployment {
|
||||
c := &deploymentConfig{
|
||||
func WithEnvFromSecretKey(varName, secret, key string) podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.envVars = append(c.envVars, corev1.EnvVar{
|
||||
Name: varName,
|
||||
ValueFrom: &corev1.EnvVarSource{
|
||||
SecretKeyRef: &corev1.SecretKeySelector{
|
||||
LocalObjectReference: corev1.LocalObjectReference{
|
||||
Name: secret,
|
||||
},
|
||||
Key: key,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Deployment(namespace string, opts ...podTemplateOption) *appsv1beta1.Deployment {
|
||||
c := &podTemplateConfig{
|
||||
image: "gcr.io/heptio-images/ark:latest",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user