Skip to content

Commit

Permalink
feat(common): add velero objects (#596)
Browse files Browse the repository at this point in the history
**Description**
We want the velero custom objects in Common, to do some additional
processing for its secret generation.

⚒️ Fixes  #594

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [x] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [x] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning

**➕ App addition**

If this PR is an app addition please make sure you have done the
following.

- [x] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [x] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Co-authored-by: Stavros kois <[email protected]>
Co-authored-by: Stavros Kois <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2023
1 parent 236fe5c commit 6f907a2
Show file tree
Hide file tree
Showing 28 changed files with 2,003 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
words:
- tailscale
- tailscale
- Velero
2 changes: 1 addition & 1 deletion library/common-test/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: ""
dependencies:
- name: common
repository: file://../common
version: ~15.2.0
version: ~15.3.0
deprecated: false
description: Helper chart to test different use cases of the common library
home: https://github.com/truecharts/apps/tree/master/charts/library/common-test
Expand Down
76 changes: 76 additions & 0 deletions library/common-test/ci/backupstoragelocation-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
service:
main:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
protocol: http
port: 8080

workload:
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
args:
- --port
- "8080"
probes:
liveness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"

manifestManager:
enabled: false

# Parameters for the BackupStorageLocation(s). Configure multiple by adding other element(s) to the backupStorageLocation slice.
# See https://velero.io/docs/v1.6/api-types/backupstoragelocation/
backupStorageLocation:
# name is the name of the backup storage location where backups should be stored. If a name is not provided,
# a backup storage location will be created with the name "default". Optional.
- name: test
enabled: true
# provider is the name for the backup storage location provider.
provider: aws
objectStorage:
# bucket is the name of the bucket to store backups in. Required.
bucket: test
credential:
# AWS/s3 credentials to be put into secret (mandatory if provider == aws/s3)
aws:
id: fdgsdfghsdfgh
key: dfgdfhsdfgh
# Additional provider-specific configuration. See link above
# for details of required/optional fields for your provider.
config: {}
# region:
# s3ForcePathStyle:
# s3Url:
# kmsKeyId:
# resourceGroup:
# The ID of the subscription containing the storage account, if different from the cluster’s subscription. (Azure only)
# subscriptionId:
# storageAccount:
# publicUrl:
# Name of the GCP service account to use for this backup storage location. Specify the
# service account here if you want to use workload identity instead of providing the key file.(GCP only)
# serviceAccount:
# Option to skip certificate validation or not if insecureSkipTLSVerify is set to be true, the client side should set the
# flag. For Velero client Command like velero backup describe, velero backup logs needs to add the flag --insecure-skip-tls-verify
# insecureSkipTLSVerify:
55 changes: 55 additions & 0 deletions library/common-test/ci/schedule-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
service:
main:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
protocol: http
port: 8080

workload:
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
args:
- --port
- "8080"
probes:
liveness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"

manifestManager:
enabled: false

schedules:
- name:
enabled: true
labels:
myenv: foo
annotations:
myenv: foo
schedule: "0 0 * * *"
useOwnerReferencesInBackup: false
template:
ttl: "240h"
storageLocation: default
includedNamespaces:
- foo
58 changes: 58 additions & 0 deletions library/common-test/ci/volumesnapshotlocation-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
service:
main:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
protocol: http
port: 8080

workload:
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
args:
- --port
- "8080"
probes:
liveness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
readiness:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"
startup:
enabled: true
type: http
port: "{{ .Values.service.main.ports.main.port }}"

manifestManager:
enabled: false


# Parameters for the VolumeSnapshotLocation(s). Configure multiple by adding other element(s) to the volumeSnapshotLocation slice.
# See https://velero.io/docs/v1.6/api-types/volumesnapshotlocation/
volumeSnapshotLocation:
# name is the name of the volume snapshot location where snapshots are being taken. Required.
- name: test
enabled: true
# provider is the name for the volume snapshot provider.
provider: aws
credential:
# AWS/s3 credentials to be put into secret (mandatory if provider == aws/s3)
aws:
id: fdgsdfghsdfgh
key: dfgdfhsdfgh
# Additional provider-specific configuration. See link above
# for details of required/optional fields for your provider.
config: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
suite: velero backupStorageLocation metadata test
templates:
- common.yaml
chart:
appVersion: &appVer v9.9.9
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should pass with storageClass created with labels and annotations
set:
label1: label1
label2: global_label2
annotation1: annotation1
annotation2: global_annotation2
global:
labels:
g_label1: global_label1
g_label2: "{{ .Values.label2 }}"
annotations:
g_annotation1: global_annotation1
g_annotation2: "{{ .Values.annotation2 }}"
backupStorageLocation:
- enabled: true
name: my-snap
labels:
label1: "{{ .Values.label1 }}"
label2: label2
annotations:
annotation1: "{{ .Values.annotation1 }}"
annotation2: annotation2
objectStorage:
bucket: my-bucket
provider: aws
credential:
aws:
id: my-id
key: my-key
asserts:
- documentIndex: &secretDoc 0
isKind:
of: Secret
- documentIndex: *secretDoc
isAPIVersion:
of: v1
- documentIndex: *secretDoc
equal:
path: metadata.annotations
value:
annotation1: annotation1
annotation2: annotation2
g_annotation1: global_annotation1
g_annotation2: global_annotation2
- documentIndex: *secretDoc
equal:
path: metadata.labels
value:
app: common-test-1.0.0
release: test-release-name
helm-revision: "0"
helm.sh/chart: common-test-1.0.0
app.kubernetes.io/name: common-test
app.kubernetes.io/instance: test-release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/version: *appVer
g_label1: global_label1
g_label2: global_label2
label1: label1
label2: label2

- documentIndex: &backStoreLocDoc 1
isKind:
of: BackupStorageLocation
- documentIndex: *backStoreLocDoc
isAPIVersion:
of: velero.io/v1
- documentIndex: *backStoreLocDoc
equal:
path: metadata.annotations
value:
annotation1: annotation1
annotation2: annotation2
g_annotation1: global_annotation1
g_annotation2: global_annotation2
- documentIndex: *backStoreLocDoc
equal:
path: metadata.labels
value:
app: common-test-1.0.0
release: test-release-name
helm-revision: "0"
helm.sh/chart: common-test-1.0.0
app.kubernetes.io/name: common-test
app.kubernetes.io/instance: test-release-name
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/version: *appVer
g_label1: global_label1
g_label2: global_label2
label1: label1
label2: label2
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
suite: velero backupStorageLocation name test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct name
set:
backupStorageLocation:
- enabled: true
name: my-snap1
objectStorage:
bucket: my-bucket
provider: aws
credential:
aws:
id: my-id
key: my-key
- enabled: true
name: my-snap2
objectStorage:
bucket: my-bucket
provider: aws
credential:
aws:
id: my-id
key: my-key
asserts:
- documentIndex: &secretDoc 0
isKind:
of: Secret
- documentIndex: *secretDoc
isAPIVersion:
of: v1
- documentIndex: *secretDoc
equal:
path: metadata.name
value: bsl-test-release-name-common-test-my-snap1
- documentIndex: &backStoreLocDoc 1
isKind:
of: BackupStorageLocation
- documentIndex: *backStoreLocDoc
isAPIVersion:
of: velero.io/v1
- documentIndex: *backStoreLocDoc
equal:
path: metadata.name
value: test-release-name-common-test-my-snap1
- documentIndex: &otherSecretDoc 2
isKind:
of: Secret
- documentIndex: *otherSecretDoc
isAPIVersion:
of: v1
- documentIndex: *otherSecretDoc
equal:
path: metadata.name
value: bsl-test-release-name-common-test-my-snap2
- documentIndex: &otherbackStoreLocDoc 3
isKind:
of: BackupStorageLocation
- documentIndex: *otherbackStoreLocDoc
isAPIVersion:
of: velero.io/v1
- documentIndex: *otherbackStoreLocDoc
equal:
path: metadata.name
value: test-release-name-common-test-my-snap2
Loading

0 comments on commit 6f907a2

Please sign in to comment.