Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: Added oportuniy set ImagePullSecret #923

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
24fd0fb
add image pull secret
namesoname Feb 14, 2024
6fb8446
fix(deps): update module github.com/go-logr/logr to v1.3.0
renovate[bot] Oct 27, 2023
b6c68c4
chore: Ignore commented-out targets in `make help`
mhutter Oct 27, 2023
f539e43
chore: remove commented-out code
mhutter Oct 27, 2023
1fc86b4
[ADD] Add root project tmp folder in gitignore
poyaz Nov 25, 2023
14da0b2
[FIX] Fix using in 'yq' command when yq not contain eval flag
poyaz Nov 25, 2023
c6d30bb
[FIX] Fix restore single file snapshot (when using backupcomamnd anno…
poyaz Nov 25, 2023
63d9271
[CHANGE] Better handling error for json unmarshal when check `isResto…
poyaz Nov 29, 2023
bea82e6
[ADD] Add e2e test for backupcommand
poyaz Nov 29, 2023
c568367
[BUG] Fix problem when make backup from pod (becuase when create pod …
poyaz Dec 11, 2023
784be18
[ADD] Add new fucntion for test pod annotation
poyaz Dec 11, 2023
8fe6b82
[ADD] Add new e2e test for single pod backup command
poyaz Dec 11, 2023
9d92d3b
feat: Add optional path field for Azure backend
l0wl3vel Dec 13, 2023
665862b
fix: Add Tests
l0wl3vel Dec 13, 2023
0365175
document k8up slack channel
tobru Feb 1, 2024
530d1a3
clearly state project maturity
tobru Feb 1, 2024
cc20913
clarify maintainers of the project
tobru Feb 1, 2024
d27cf54
introduce monthly community meeting
tobru Feb 1, 2024
f8d2303
adopt the CNCF CoC
tobru Feb 1, 2024
dddd804
update governance documentation to the latest state
tobru Feb 1, 2024
76e9544
add link to google docs agenda for community meeting
tobru Mar 4, 2024
aaa05c4
set credentials in rest server url
JcGKitten Feb 27, 2024
be87d54
ensure that REPOSITORY env var is set after credentials
JcGKitten Feb 27, 2024
4ae6c47
Go 1.21 fixes for e2e tests
Kidswiss Mar 6, 2024
9841342
Fix deprecations
Kidswiss Mar 7, 2024
7300536
Update dependencies
Kidswiss Mar 7, 2024
a7f6dac
Increase the timeout for the restic command
Kidswiss Mar 7, 2024
3def0fd
Update all renovate dependencies
Kidswiss Mar 15, 2024
0f1179f
Update kind
Kidswiss Mar 15, 2024
4626ef2
Fix chart go.mod
Kidswiss Mar 15, 2024
0e6de56
Add debug info to e2e tests
Kidswiss Mar 15, 2024
547a589
Fix scorecard action version
Kidswiss Mar 18, 2024
6e0d6d0
Update Chart.yaml
eunames Mar 18, 2024
0468b67
Update README.md
eunames Mar 18, 2024
57585fa
Make e2e tests more reliable
Kidswiss Mar 19, 2024
7c01625
Bump chart version
Kidswiss Mar 19, 2024
1d8ed20
Add option to ignore PVCs without annotation
Stogas Mar 19, 2024
9d11705
Generate chart docs for 4.5.1
Stogas Mar 19, 2024
27dd45c
Fix chart tests for new envVar in 4.5.1
Stogas Mar 19, 2024
ca719c0
Fix chart tests for new envVar in 4.5.1, pt2
Stogas Mar 20, 2024
2bdcc08
Update ADOPTERS.md
halil-bugol Apr 3, 2024
8c5e704
[ADD] Ignoring vagrant dir in git
poyaz Mar 18, 2024
261d268
[ADD] Add GO_EXEC variable for using multiply version of go binary
poyaz Mar 18, 2024
5e50d5b
[ADD] Add Volume for using secret or configmap in k8s, Add VolumeMoun…
poyaz Mar 18, 2024
4828ce6
[ADD] Add vardir command option for mount emptyDir in pod
poyaz Mar 18, 2024
ba2e447
[ADD] Supporting self certificate authority and mTls when using S3 ob…
poyaz Mar 18, 2024
cf762cb
[ADD] Adding container volumes when they are mounting
poyaz Mar 22, 2024
cc15101
[UPDATE] Generating new crd according to adding VolumeMounts to Backe…
poyaz Mar 22, 2024
c882ab6
[UPDATE] Addin VolumeMounts to BackendSpec and RestoreMethod
poyaz Mar 22, 2024
634fdba
[UPDATE] Generating new crd according to adding VolumeMounts to Backe…
poyaz Mar 22, 2024
052ab03
[ADD] Adding new resource definitions for e2e test in TLS and mTls mode
poyaz Mar 22, 2024
fbafee7
[ADD] Add some fucntions for checking e2e test
poyaz Mar 22, 2024
c771ac2
[ADD] Adding new e2e test for supporting self-signed issuer
poyaz Mar 22, 2024
4729a04
[FIX] Fixning problem in attach mode when failer happend in pod
poyaz Mar 22, 2024
b6edefe
[ADD] Adding RESTORE_CA_CERT_FILE, RESTORE_CA_CERT_FILE, RESTORE_CLIE…
poyaz Mar 23, 2024
c4f5247
[UPDATE] Update operator and restic cli help according to new values …
poyaz Mar 23, 2024
e8ec276
[FIX] Removing unnecessary snipped tag (tag: <SNIP>)
poyaz Mar 23, 2024
57b803e
[ADD] Adding document about how to use TLS and mTls in api refrence
poyaz Mar 23, 2024
2df32d7
[UPDATE] Update api-refrence according to supporting volume, volumeMo…
poyaz Mar 23, 2024
647813a
[UPDATE] Update cert-manager to v1.14.4
poyaz Mar 23, 2024
5236ed4
[ADD] Adding e2e definitaions for using env for TLS and mTls
poyaz Mar 23, 2024
02f0727
ADD] Adding e2e test over using env for TLS and mTls
poyaz Mar 23, 2024
d09ce0a
[FIX] Fixing integration test for restic s3. Missing CaCert arguments
poyaz Mar 23, 2024
0608fa1
[ADD] Adding variable GO_EXEC in Makefile to choose different version…
poyaz Mar 23, 2024
8e5b8d9
[FIX] Fix test for expected args
poyaz Mar 23, 2024
9b2e68c
[DELETE] Delete command "sleep 3"
poyaz Apr 6, 2024
a0b7ea1
[UPDATE] Formatting go files to old style (Remove idea customziation …
poyaz Apr 6, 2024
8724437
[FIX] Fix typo and document's grammers
poyaz Apr 6, 2024
d7acc11
[DELETE] Delete unnecessary error param in setupArgs function
poyaz Apr 8, 2024
7b1c32c
[CHANGE] Rename options to tlsOptions
poyaz Apr 8, 2024
e32e093
[UPDATE] Update documents because of changing options to tlsOptions
poyaz Apr 10, 2024
e28b806
[UPDATE] Refactoring code for duplciate fucntions in operators
poyaz Apr 10, 2024
0fbb522
[ADD] Add cmctl command for check cert-manager is ready
poyaz Apr 10, 2024
c7908e0
[ADD] Add two e2e test for restore and archive
poyaz Apr 10, 2024
e6d41a3
[DELETE] Delete e2e test self signed tls becuase it has too many test…
poyaz Apr 10, 2024
bb22b38
[UPDATE] Add unit test for utils file and refactoring ZeroLen function
poyaz Apr 11, 2024
d751035
[UPDATE] Rename argument "--varDir" to "-varDir"
poyaz Apr 11, 2024
6eebda5
[FIX] Fix execute ps for alpine and BusyBox
poyaz Apr 11, 2024
0f7e073
[ADD] Add integration test for TLS and Mutual TLS options
poyaz Apr 11, 2024
0e3b4e2
feat: add support for dual stack clusters
M0NsTeRRR Apr 6, 2024
424b2b4
Squashed commit of the following:
eunames Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
`bug`, `enhancement`, `documentation`, `change`, `breaking`, `dependency`
as they show up in the changelog
- [ ] PR contains the label `area:operator`
- [ ] Commits are [signed off](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
- [ ] Link this PR to related issues
- [ ] I have not made _any_ changes in the `charts/` directory.

Expand All @@ -21,6 +22,7 @@
as they show up in the changelog
- [ ] PR contains the label `area:chart`
- [ ] PR contains the chart label, e.g. `chart:k8up`
- [ ] Commits are [signed off](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
- [ ] Variables are documented in the values.yaml using the format required by [Helm-Docs](https://github.com/norwoodj/helm-docs#valuesyaml-metadata).
- [ ] Chart Version bumped if immediate release after merging is planned
- [ ] I have run `make chart-docs`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/chart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download cr
uses: giantswarm/install-binary-action@v1.0.0
uses: giantswarm/install-binary-action@v1.1.0
with:
binary: cr
version: "1.4.0"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
uses: actions/checkout@v3
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
uses: ossf/scorecard-action@v2.3.1
with:
results_file: results.sarif
results_format: sarif
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ jobs:
${{ runner.os }}-go-

- name: Run tests
run: make test

- name: Run integration tests
run: make integration-test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ coverage/
.cache
_public/
_archive/
tmp/

.github/release-notes.md

Expand All @@ -41,3 +42,11 @@ e2e/debug
# Charts
.cr-release-packages/
.cr-index/

# Vagrant
.vagrant/

# Container volumes mount
.config/
.kube/
.npm/
1 change: 1 addition & 0 deletions ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ This list is sorted in the order that organizations were added to it.
| [VSHN](https://www.vshn.ch) | [@tobru](https://github.com/tobru/) | K8up was born at VSHN because at that time there was no other mature enough backup operator around. Today, K8up is integral part of the service offering and protects precious data every day. |
| [amazee.io](https://www.amazee.io) | [@dasrecht](https://github.com/dasrecht/) | We use K8up as an integral part of our Disaster Recovery procedures. |
| [Lagoon](https://github.com/uselagoon) | [@tobybellwood](https://github.com/tobybellwood/) | We've adopted K8up within [Lagoon](https://github.com/uselagoon). This keeps the data of all Lagoon customers safe and restorable. |
| [Kubezy](https://kubezy.com) | [@halil-bugol](https://github.com/halil-bugol/) | We use K8up as Backup Operator in our Kubernetes Management product.|
6 changes: 6 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Community Code of Conduct

K8up observes the [CNCF Community Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).

The code of conduct is overseen by the K8up project maintainers.
Possible code of conduct violations should be emailed to the project maintainers [email protected].
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/library/alpine:3.17 as restic
FROM docker.io/library/alpine:3.19 as restic

RUN apk add --update --no-cache \
bash \
Expand All @@ -7,9 +7,9 @@ RUN apk add --update --no-cache \

COPY go.mod fetch_restic.sh ./
RUN ./fetch_restic.sh /usr/local/bin/restic \
&& /usr/local/bin/restic version
&& /usr/local/bin/restic version

FROM docker.io/library/alpine:3.17 as k8up
FROM docker.io/library/alpine:3.19 as k8up

ENTRYPOINT ["k8up"]

Expand Down
11 changes: 5 additions & 6 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# K8up Project Governance

Please note: K8up is a young Open Source project, evolved from the project sponsor [VSHN](https://www.vshn.ch/).
As such we're in the process of setting up a proper project governance.
As such, we're in the process of setting up a proper project governance.
If you have any wish, let use know via a [GitHub Discussion](https://github.com/k8up-io/k8up/discussions).

## Principles
Expand All @@ -11,7 +11,7 @@ The K8up community adheres to the following principles:
- Open: K8up is open source.
- Welcoming and respectful: See [Code of Conduct](#code-of-conduct).
- Transparent and accessible: Changes to the K8up organization, K8up code repositories,
and CNCF related activities (e.g. level, involvement, etc) are done in public.
and CNCF related activities (e.g. level, involvement, etc.) are done in public.
- Merit: Ideas and contributions are accepted according to their technical merit and alignment with
project objectives, scope, and design principles.

Expand All @@ -24,7 +24,7 @@ The K8up roadmap is on GitHub, see [Projects -> Roadmap](https://github.com/k8up
Every contribution is welcome.
Please see our [Contribution Guide](https://k8up.io/k8up/about/contribution_guide.html) how to best contribute.

## Github Project Administration
## GitHub Project Administration

The __k8up-io__ GitHub project maintainers team reflects the list of Maintainers.

Expand All @@ -35,12 +35,12 @@ As such, K8up might be involved in CNCF (or other CNCF projects) related marketi

## Code of Conduct

Please read our code of conduct here: https://k8up.io/k8up/about/code_of_conduct.html
Please read our code of conduct here: [CODE_OF_CONDUCT.md](https://github.com/k8up-io/k8up/blob/master/CODE_OF_CONDUCT.md).

The code of conduct is overseen by the K8up project maintainers.
Possible code of conduct violations should be emailed to the project maintainers [email protected].

If the possible violation is against one of the project maintainers that member will be recused from voting on the issue.
If the possible violation is against one of the project maintainers, that member will be recused from voting on the issue.
Such issues must be escalated to the appropriate CNCF contact, and CNCF may choose to intervene.

## DCO and Licenses
Expand All @@ -49,4 +49,3 @@ The following licenses and contributor agreements will be used for K8up projects

* [Apache 2.0](https://opensource.org/licenses/Apache-2.0) for code
* [Developer Certificate of Origin](https://developercertificate.org/) for new contributions

19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAKEFLAGS += --no-builtin-variables

.PHONY: help
help: ## Show this help
@grep -E -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@grep -E -h '^[^#].+\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

# extensible array of targets. Modules can add target to this variable for the all-in-one target.
clean_targets := build-clean
Expand All @@ -27,21 +27,22 @@ include Makefile.restic-integration.mk envtest/integration.mk
# E2E tests
-include e2e/Makefile

go_build ?= go build -o $(BIN_FILENAME) $(K8UP_MAIN_GO)
go_build ?= $(GO_EXEC) build -o $(BIN_FILENAME) $(K8UP_MAIN_GO)

.PHONY: test
test: ## Run tests
go test ./... -coverprofile cover.out
$(GO_EXEC) test ./... -coverprofile cover.out

.PHONY: build
build: generate fmt vet $(BIN_FILENAME) docs-update-usage ## Build manager binary

.PHONY: run
run: export ARGS := $(ARGS) operator
run: export BACKUP_ENABLE_LEADER_ELECTION = $(ENABLE_LEADER_ELECTION)
run: export K8UP_DEBUG = true
run: export BACKUP_OPERATOR_NAMESPACE = default
run: fmt vet ## Run against the configured Kubernetes cluster in ~/.kube/config. Use ARGS to pass arguments to the command, e.g. `make run ARGS="--help"`
go run $(K8UP_MAIN_GO) $(ARGS) $(CMD) $(CMD_ARGS)
$(GO_EXEC) run $(K8UP_MAIN_GO) $(ARGS) $(CMD) $(CMD_ARGS)

.PHONY: run-operator
run-operator: CMD := operator
Expand All @@ -54,7 +55,7 @@ run-restic: run ## Run the restic module. Use ARGS to pass arguments to the com
.PHONY: install
install: export KUBECONFIG = $(KIND_KUBECONFIG)
install: generate kind-setup ## Install CRDs into a cluster
kubectl apply $(KIND_KUBECTL_ARGS) -f $(CRD_ROOT_DIR)/v1
kubectl apply $(KIND_KUBECTL_ARGS) -f $(CRD_ROOT_DIR)/v1 --server-side

.PHONY: uninstall
uninstall: export KUBECONFIG = $(KIND_KUBECONFIG)
Expand All @@ -80,21 +81,21 @@ deploy: kind-load-image install ## Deploy controller in the configured Kubernete
.PHONY: generate
generate: ## Generate manifests e.g. CRD, RBAC etc.
# Generate code
go run sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=".github/boilerplate.go.txt" paths="./..."
$(GO_EXEC) run sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=".github/boilerplate.go.txt" paths="./..."
# Generate CRDs
go run sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=$(CRD_ROOT_DIR)/v1 crd:crdVersions=v1
$(GO_EXEC) run sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=$(CRD_ROOT_DIR)/v1 crd:crdVersions=v1

.PHONY: crd
crd: generate ## Generate CRD to file
@yq $(CRD_ROOT_DIR)/v1/*.yaml > $(CRD_FILE)

.PHONY: fmt
fmt: ## Run go fmt against code
go fmt ./...
$(GO_EXEC) fmt ./...

.PHONY: vet
vet: ## Run go vet against code
go vet ./...
$(GO_EXEC) vet ./...

.PHONY: lint
lint: fmt vet golangci-lint ## Invokes all linting targets
Expand Down
2 changes: 1 addition & 1 deletion Makefile.restic-integration.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ restore_dir ?= $(integrationtest_dir)/restore

stats_url ?= http://localhost:8091

restic_version ?= $(shell go mod edit -json | jq -r '.Require[] | select(.Path == "github.com/restic/restic").Version' | sed "s/v//")
restic_version ?= $(shell $(GO_EXEC) mod edit -json | jq -r '.Require[] | select(.Path == "github.com/restic/restic").Version' | sed "s/v//")
restic_path ?= $(go_bin)/restic
restic_pid ?= $(integrationtest_dir)/restic.pid
restic_url ?= https://github.com/restic/restic/releases/download/v$(restic_version)/restic_$(restic_version)_$(os)_$(arch).bz2
Expand Down
5 changes: 3 additions & 2 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
IMG_TAG ?= latest

GO_EXEC ?= go
K8UP_MAIN_GO ?= cmd/k8up/main.go
K8UP_GOOS ?= linux
K8UP_GOARCH ?= amd64
Expand All @@ -24,7 +25,7 @@ CRD_DOCS_REF_PATH ?= docs/modules/ROOT/pages/references/api-reference.adoc
SAMPLES_ROOT_DIR ?= config/samples
minio_sentinel = $(e2etest_dir)/minio_sentinel

KIND_NODE_VERSION ?= v1.24.4
KIND_NODE_VERSION ?= v1.26.6
KIND_KUBECONFIG ?= $(e2etest_dir)/kind-kubeconfig-$(KIND_NODE_VERSION)
KIND_CLUSTER ?= k8up-$(KIND_NODE_VERSION)
KIND_KUBECTL_ARGS ?= --validate=true
Expand All @@ -46,4 +47,4 @@ K8UP_QUAY_IMG ?= quay.io/k8up-io/k8up:$(IMG_TAG)
ENVTEST_ADDITIONAL_FLAGS ?= --bin-dir "$(go_bin)"
INTEGRATION_TEST_DEBUG_OUTPUT ?= false
# See https://storage.googleapis.com/kubebuilder-tools/ for list of supported K8s versions
ENVTEST_K8S_VERSION = 1.24.x
ENVTEST_K8S_VERSION = 1.26.x
8 changes: 7 additions & 1 deletion OWNERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ This will be built up when time comes.

## Maintainers

We document the list of maintainers in the [GitHub team "Maintainer"](https://github.com/orgs/k8up-io/teams/maintainer/members).
* Tobias Brunner <[email protected]> ([tobru](https://github.com/tobru))
* Simon Beck <[email protected]> ([Kidswiss](https://github.com/Kidswiss))
* Nicolas Bigler <[email protected]> ([TheBigLee](https://github.com/TheBigLee))
* Łukasz Widera <[email protected]> ([wejdross](https://github.com/wejdross))
* Gabriel Saratura <[email protected]> ([zugao](https://github.com/zugao))

We also document the list of maintainers in the [GitHub team "Maintainer"](https://github.com/orgs/k8up-io/teams/maintainer/members).

## Reviewers

Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ K8up is a Kubernetes backup operator based on [Restic](https://restic.readthedoc
Just create a `schedule` and a `credentials` object in the namespace you’d like to backup.
It’s that easy. K8up takes care of the rest. It also provides a Prometheus endpoint for monitoring.

K8up is production ready. It is used in production deployments since 2019.

## Documentation

The documentation is written in AsciiDoc and published with Antora to [k8up.io](https://k8up.io/).
Expand Down Expand Up @@ -141,7 +143,19 @@ make clean
There are a number of example configurations in [`config/samples`](config/samples).
Apply them using `kubectl apply -f config/samples/somesample.yaml`

### Code of Conduct
# Community

Read more about our community [in the documentation](https://k8up.io/k8up/about/community.html).

## Chat with us

The K8up project is present in the [CNCF Slack Workspace](https://slack.cncf.io/) in the [#k8up channel](https://app.slack.com/client/T08PSQ7BQ/C06GP0D5FEF).

## Monthly community meeting

We host a monthly community meeting. For more information, head over to [the community documentation](https://k8up.io/k8up/about/community.html).

## Code of Conduct

Our code of conduct can be read at [k8up.io](https://k8up.io/k8up/about/code_of_conduct.html).

Expand Down
9 changes: 9 additions & 0 deletions api/v1/archive_types.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package v1

import (
"context"
"reflect"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// ArchiveSpec defines the desired state of Archive.
Expand Down Expand Up @@ -87,6 +89,13 @@ func (a *Archive) GetSuccessfulJobsHistoryLimit() *int {
return a.Spec.KeepJobs
}

func (a *Archive) GetPodConfig(ctx context.Context, c client.Client) (*PodConfig, error) {
if a.Spec.RunnableSpec.PodConfigRef == nil {
return nil, nil
}
return NewPodConfig(ctx, a.Spec.RunnableSpec.PodConfigRef.Name, a.GetNamespace(), c)
}

// GetJobObjects returns a sortable list of jobs
func (a *ArchiveList) GetJobObjects() JobObjectList {
items := make(JobObjectList, len(a.Items))
Expand Down
23 changes: 20 additions & 3 deletions api/v1/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v1
import (
"fmt"
"reflect"
"strings"

corev1 "k8s.io/api/core/v1"

Expand All @@ -24,6 +25,9 @@ type (
Swift *SwiftSpec `json:"swift,omitempty"`
B2 *B2Spec `json:"b2,omitempty"`
Rest *RestServerSpec `json:"rest,omitempty"`

TLSOptions *TLSOptions `json:"tlsOptions,omitempty"`
VolumeMounts *[]corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// +k8s:deepcopy-gen=false
Expand Down Expand Up @@ -204,6 +208,7 @@ func (in *GCSSpec) String() string {

type AzureSpec struct {
Container string `json:"container,omitempty"`
Path string `json:"path,omitempty"`
AccountNameSecretRef *corev1.SecretKeySelector `json:"accountNameSecretRef,omitempty"`
AccountKeySecretRef *corev1.SecretKeySelector `json:"accountKeySecretRef,omitempty"`
}
Expand All @@ -215,9 +220,14 @@ func (in *AzureSpec) EnvVars(vars map[string]*corev1.EnvVarSource) map[string]*c
return vars
}

// String returns "azure:container:/"
// String returns "azure:container:path"
// If Path is empty, the default value "/" will be used as path
func (in *AzureSpec) String() string {
return fmt.Sprintf("azure:%s:/", in.Container)
path := "/"
if in.Path != "" {
path = in.Path
}
return fmt.Sprintf("azure:%s:%s", in.Container, path)
}

type SwiftSpec struct {
Expand Down Expand Up @@ -269,5 +279,12 @@ func (in *RestServerSpec) EnvVars(vars map[string]*corev1.EnvVarSource) map[stri

// String returns "rest:URL"
func (in *RestServerSpec) String() string {
return fmt.Sprintf("rest:%s", in.URL)
protocol, url, _ := strings.Cut(in.URL, "://")
return fmt.Sprintf("rest:%s://%s:%s@%s", protocol, "$(USER)", "$(PASSWORD)", url)
}

type TLSOptions struct {
CACert string `json:"caCert,omitempty"`
ClientCert string `json:"clientCert,omitempty"`
ClientKey string `json:"clientKey,omitempty"`
}
Loading