Skip to content

Commit

Permalink
Improve Error Handling + Code refactor (#891)
Browse files Browse the repository at this point in the history
Fixes: #881

**Error and Metrics Handling:**

- [x] BackupConfiguration Controller:
  - Failed to trigger workload controller:
	- Write event to BackupConfiguration
    - Log error
  - Failed to ensure cronjob:
    - Write event to BackupConfiguration
    - Log error
- [x] BackupSession Controller:
	- Failed to ensure backup job:
      - Write event to BackupSession
      - Log error
      - Fail BackupSeesion
	- Backup session failed:
      - Set BackupSession phase to "Failed"
      - Write event to BackupSession
      - Send backup session specific metrics
	- BackupSession succeeded:
	  - Set BackupSession phase to "Succeeded"
	  - Write event to BackupSession
	  - Send backup session specific metrics
- [x] Auto Backup:
	- Failed/Succeeded to create/delete auto backup resources
	  - Write event to the respective resource
	  - Write log
- [x] Workload Controller:
	- Failed/Succeeded to inject/delete stash sidecar/init-container
	  - Write event to workload
	  - Write log
- [x] RestoreSession Controller:
	- Failed to create restore job
	  - Write event to RestoreSession
	  - Write log
	  - Fail RestoreSession
	- Restore session failed:
		- Set RestoreSession phase to "Failed"
        - Write event to RestoreSession
        - Send restore session specific metrics
	- RestoreSession succeeded:
	  - Set RestoreSession phase to "Succeeded"
	  - Write event to RestoreSession
	  - Send restore session specific metrics
- [x] Sidecar:
	- Failed to start BackupSession controller
		- Write event to BackupConfiguration
		- Write log
		- Fail the container so it restart
	- Succeeded to start BackupSession controller
		- Write event to BackupConfiguration
		- Write log
	- Failed/Succeeded to take backup
		- Update status of the BackupSession
		- Write log
- [x] Init-container/Backup Job:
	- Failed/Succeeded to restore
		- Update status of the RestoreSession
		- Write log
		- Fail the container
  • Loading branch information
hossainemruz authored and tamalsaha committed Sep 10, 2019
1 parent 88c8427 commit 5f49f5d
Show file tree
Hide file tree
Showing 30 changed files with 1,575 additions and 1,078 deletions.
5 changes: 1 addition & 4 deletions Dockerfile.dbg
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ FROM {ARG_FROM}

COPY --from=0 restic /bin/restic
COPY --from=0 restic_{NEW_RESTIC_VER} /bin/restic_{NEW_RESTIC_VER}
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY bin/{ARG_OS}_{ARG_ARCH}/{ARG_BIN} /{ARG_BIN}

# Copy "nice" and "ionice".
COPY --from=0 /usr/bin/nice /bin/nice
COPY --from=0 /usr/bin/ionice /bin/ionice

ENTRYPOINT ["/{ARG_BIN}"]
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ github.com/emicklei/go-restful v2.9.6+incompatible h1:tfrHha8zJ01ywiOEC1miGY8st1
github.com/emicklei/go-restful v2.9.6+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
Expand Down
Loading

0 comments on commit 5f49f5d

Please sign in to comment.