Skip to content

Commit

Permalink
Refactor Etcdcopybackupstask to eliminate Helm chart (#553)
Browse files Browse the repository at this point in the history
* Refactor the EtcdCopyBackupsTask controller to formulate/create an EtcdCopyBackupsTaskjob using Golang instead of a Helm chart.

* removed helm chart

* Add test case for handling ownerReferences with numeric names and leading 0

* Rename `08foo` to `01234`

* Apply suggestions from code review

Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.com>

* Addressed review comments
- Added function `GetCopyBackupsJobName` which returns the name of the CopyBackups Job.
- Used common constants `GardenerOwnedBy`, `GardenerOwnerType`, `LabelNetworkPolicyToDNS`, `LabelNetworkPolicyToPublicNetworks` instead of static string.
- Added function `GetBackupRestoreImage` which returns the image for `backup-restore` from the given image vector.

* Fix intergration test

* Update api/v1alpha1/types_etcdcopybackupstask.go

Co-authored-by: Madhav Bhargava <madhav.bhargava@sap.com>

* revert changes related to Used common constants ,

* Addressed review comments:
- Renamed functions:
    - `GetCopyBackupsJobName` to `GetJobName`
    - `getVolumes` to `createVolumesFromstore`
    - `getVolumeMounts` to `createVolumeMountsFromStore`
    - `getEnvVarFromValues` to `mapToEnvVar`
    - `getProviderEnvs` to `createEnvVarsFromStore`
    - `setEtcdBackupJobCommands` to `createJobCommandFromStore`
- Refactored code to formulate the job while addressing review comments.

* changed the way Job command is created, removed some methods from image.gog

* Add unit tests

* Apply suggestions from code review

Co-authored-by: Madhav Bhargava <madhav.bhargava@sap.com>

* Addressed review feeback

* Removed duplicate test case

---------

Co-authored-by: Shreyas Rao <42259948+shreyas-s-rao@users.noreply.github.com>
Co-authored-by: Madhav Bhargava <madhav.bhargava@sap.com>
  • Loading branch information
3 people authored Apr 4, 2023
1 parent 03d2826 commit 5a52a5c
Show file tree
Hide file tree
Showing 14 changed files with 1,085 additions and 553 deletions.
11 changes: 10 additions & 1 deletion api/v1alpha1/types_etcdcopybackupstask.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@

package v1alpha1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
"fmt"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down Expand Up @@ -93,3 +97,8 @@ type EtcdCopyBackupsTaskStatus struct {
// +optional
LastError *string `json:"lastError,omitempty"`
}

// GetJobName returns the name of the CopyBackups Job.
func (e *EtcdCopyBackupsTask) GetJobName() string {
return fmt.Sprintf("%s-worker", e.Name)
}
4 changes: 0 additions & 4 deletions charts/etcd-copy-backups/Chart.yaml

This file was deleted.

245 changes: 0 additions & 245 deletions charts/etcd-copy-backups/templates/etcd-copy-backups-job.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions charts/etcd-copy-backups/values.yaml

This file was deleted.

Loading

0 comments on commit 5a52a5c

Please sign in to comment.