backup init steps might need env from secrets or configmaps
This commit is contained in:
parent
e61c7e4c4e
commit
737f0e78c2
@ -30,8 +30,6 @@ const (
|
|||||||
type Step struct {
|
type Step struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
// +optional
|
// +optional
|
||||||
Env []corev1.EnvVar `json:"env,omitempty"`
|
|
||||||
// +optional
|
|
||||||
Finalize *bool `json:"finalize,omitempty"`
|
Finalize *bool `json:"finalize,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -569,13 +569,6 @@ func (in *S3) DeepCopy() *S3 {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Step) DeepCopyInto(out *Step) {
|
func (in *Step) DeepCopyInto(out *Step) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Env != nil {
|
|
||||||
in, out := &in.Env, &out.Env
|
|
||||||
*out = make([]v1.EnvVar, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in.Finalize != nil {
|
if in.Finalize != nil {
|
||||||
in, out := &in.Finalize, &out.Finalize
|
in, out := &in.Finalize, &out.Finalize
|
||||||
*out = new(bool)
|
*out = new(bool)
|
||||||
|
|||||||
@ -51,6 +51,8 @@ var _ reconcile.Reconciler = &BackupConfigurationReconciler{}
|
|||||||
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
|
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
|
||||||
// +kubebuilder:rbac:groups=apps,resources=replicasets,verbs=get;list;watch;create;update;patch;delete
|
// +kubebuilder:rbac:groups=apps,resources=replicasets,verbs=get;list;watch;create;update;patch;delete
|
||||||
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch
|
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch
|
||||||
|
// +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch
|
||||||
|
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch
|
||||||
// +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch;create;update;patch;delete
|
// +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch;create;update;patch;delete
|
||||||
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch;create;update;patch;delete
|
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch;create;update;patch;delete
|
||||||
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete
|
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete
|
||||||
|
|||||||
@ -62,12 +62,6 @@ var _ = Describe("Testing BackupConf controller", func() {
|
|||||||
Steps: []formolv1alpha1.Step{
|
Steps: []formolv1alpha1.Step{
|
||||||
formolv1alpha1.Step{
|
formolv1alpha1.Step{
|
||||||
Name: TestBackupFuncName,
|
Name: TestBackupFuncName,
|
||||||
Env: []corev1.EnvVar{
|
|
||||||
corev1.EnvVar{
|
|
||||||
Name: "foo",
|
|
||||||
Value: "bar",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -212,7 +212,7 @@ func (r *BackupSessionReconciler) Reconcile(ctx context.Context, req reconcile.R
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
function.Spec.Name = function.Name
|
function.Spec.Name = function.Name
|
||||||
function.Spec.Env = append(step.Env, backupSessionEnv...)
|
function.Spec.Env = append(function.Spec.Env, backupSessionEnv...)
|
||||||
function.Spec.VolumeMounts = append(function.Spec.VolumeMounts, output)
|
function.Spec.VolumeMounts = append(function.Spec.VolumeMounts, output)
|
||||||
job.Spec.Template.Spec.InitContainers = append(job.Spec.Template.Spec.InitContainers, function.Spec)
|
job.Spec.Template.Spec.InitContainers = append(job.Spec.Template.Spec.InitContainers, function.Spec)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -200,7 +200,7 @@ func (r *RestoreSessionReconciler) Reconcile(ctx context.Context, req reconcile.
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
function.Spec.Name = function.Name
|
function.Spec.Name = function.Name
|
||||||
function.Spec.Env = append(step.Env, restoreSessionEnv...)
|
function.Spec.Env = append(function.Spec.Env, restoreSessionEnv...)
|
||||||
function.Spec.VolumeMounts = append(function.Spec.VolumeMounts, output)
|
function.Spec.VolumeMounts = append(function.Spec.VolumeMounts, output)
|
||||||
job.Spec.Template.Spec.InitContainers = append(job.Spec.Template.Spec.InitContainers, function.Spec)
|
job.Spec.Template.Spec.InitContainers = append(job.Spec.Template.Spec.InitContainers, function.Spec)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,6 +159,12 @@ var (
|
|||||||
Name: "backup-func",
|
Name: "backup-func",
|
||||||
Image: "myimage",
|
Image: "myimage",
|
||||||
Args: []string{"a", "set", "of", "args"},
|
Args: []string{"a", "set", "of", "args"},
|
||||||
|
Env: []corev1.EnvVar{
|
||||||
|
corev1.EnvVar{
|
||||||
|
Name: "foo",
|
||||||
|
Value: "bar",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
testBackupConf = &formolv1alpha1.BackupConfiguration{
|
testBackupConf = &formolv1alpha1.BackupConfiguration{
|
||||||
@ -201,12 +207,6 @@ var (
|
|||||||
},
|
},
|
||||||
formolv1alpha1.Step{
|
formolv1alpha1.Step{
|
||||||
Name: TestBackupFuncName,
|
Name: TestBackupFuncName,
|
||||||
Env: []corev1.EnvVar{
|
|
||||||
corev1.EnvVar{
|
|
||||||
Name: "foo",
|
|
||||||
Value: "bar",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -217,7 +217,7 @@ func CreateFormolRBAC(cl client.Client, saName string, namespace string) error {
|
|||||||
rbacv1.PolicyRule{
|
rbacv1.PolicyRule{
|
||||||
Verbs: []string{"get", "list", "watch"},
|
Verbs: []string{"get", "list", "watch"},
|
||||||
APIGroups: []string{""},
|
APIGroups: []string{""},
|
||||||
Resources: []string{"pods"},
|
Resources: []string{"pods", "secrets", "configmaps"},
|
||||||
},
|
},
|
||||||
rbacv1.PolicyRule{
|
rbacv1.PolicyRule{
|
||||||
Verbs: []string{"get", "list", "watch"},
|
Verbs: []string{"get", "list", "watch"},
|
||||||
@ -281,7 +281,7 @@ func CreateBackupSessionListenerRBAC(cl client.Client, saName string, namespace
|
|||||||
rbacv1.PolicyRule{
|
rbacv1.PolicyRule{
|
||||||
Verbs: []string{"get", "list", "watch"},
|
Verbs: []string{"get", "list", "watch"},
|
||||||
APIGroups: []string{""},
|
APIGroups: []string{""},
|
||||||
Resources: []string{"pods"},
|
Resources: []string{"pods", "secrets", "configmaps"},
|
||||||
},
|
},
|
||||||
rbacv1.PolicyRule{
|
rbacv1.PolicyRule{
|
||||||
Verbs: []string{"get", "list", "watch"},
|
Verbs: []string{"get", "list", "watch"},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user