-
Notifications
You must be signed in to change notification settings - Fork 69
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
Cleanup dapper and code #626
Draft
alexandreLamarre
wants to merge
21
commits into
main
Choose a base branch
from
cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9fb7eb7
skeleton framework for e2e tests
alexandreLamarre 9be3896
add delve debug configuration
alexandreLamarre 896cb51
add testdata
alexandreLamarre 10fcecb
fix accidental test data corruption
alexandreLamarre dc42848
tweak granularity of backup statements
alexandreLamarre 5f9c157
minor main() refactor
alexandreLamarre c560d38
end to end programmatic tests
alexandreLamarre 53157c7
simplify build script
alexandreLamarre 8b08579
squas me, satisfy golangci-lint
alexandreLamarre 79dec0b
remove dapper from Makefile
alexandreLamarre a2a573a
Add deprecation warning to integration script
alexandreLamarre 27436a8
fix directory reference when directly invoked
alexandreLamarre 174a355
remove Dapperfile
alexandreLamarre 7949066
test flags squash me
alexandreLamarre cf55c8f
keep backup folders
alexandreLamarre 30703cf
scripts and CI change
alexandreLamarre 615ce2e
hardcode k3s versions
alexandreLamarre baec5da
avoid importing image
alexandreLamarre 20ff879
fix helm chart reference version
alexandreLamarre 7b843b4
remove duplicate test environment creation
alexandreLamarre 010f271
update golangci-version lint
alexandreLamarre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh | ||
|
||
helm plugin install https://github.com/quintush/helm-unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug Operator", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "${workspaceFolder}/main.go", | ||
"env": { | ||
"CHART_NAMESPACE": "cattle-resources-system", | ||
// uncomment if using remote backup locations, like s3 | ||
"CATTLE_DEV_MODE": "true", | ||
}, | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
TARGETS := $(shell ls scripts) | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
@curl -sL https://releases.rancher.com/dapper/latest/dapper-$$(uname -s)-$$(uname -m) > .dapper.tmp | ||
@@chmod +x .dapper.tmp | ||
@./.dapper.tmp -v | ||
@mv .dapper.tmp .dapper | ||
|
||
$(TARGETS): .dapper | ||
./.dapper $@ | ||
$(TARGETS): | ||
./scripts/$@ | ||
|
||
.DEFAULT_GOAL := ci | ||
|
||
.PHONY: $(TARGETS) | ||
.PHONY: $(TARGETS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
|
||
"github.com/rancher/backup-restore-operator/pkg/operator" | ||
"github.com/rancher/wrangler/v3/pkg/kubeconfig" | ||
"github.com/rancher/wrangler/v3/pkg/signals" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
LogFormat = "2006/01/02 15:04:05" | ||
) | ||
|
||
var ( | ||
Version = "v0.0.0-dev" | ||
GitCommit = "HEAD" | ||
LocalBackupStorageLocation = "/var/lib/backups" // local within the pod, this is the mountPath for PVC | ||
KubeConfig string | ||
OperatorPVEnabled string | ||
OperatorS3BackupStorageLocation string | ||
ChartNamespace string | ||
Debug bool | ||
Trace bool | ||
) | ||
|
||
func init() { | ||
flag.StringVar(&KubeConfig, "kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.") | ||
flag.BoolVar(&Debug, "debug", false, "Enable debug logging.") | ||
flag.BoolVar(&Trace, "trace", false, "Enable trace logging.") | ||
|
||
flag.Parse() | ||
OperatorPVEnabled = os.Getenv("DEFAULT_PERSISTENCE_ENABLED") | ||
OperatorS3BackupStorageLocation = os.Getenv("DEFAULT_S3_BACKUP_STORAGE_LOCATION") | ||
ChartNamespace = os.Getenv("CHART_NAMESPACE") | ||
} | ||
|
||
func main() { | ||
logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true, ForceColors: true, TimestampFormat: LogFormat}) | ||
if Debug { | ||
logrus.SetLevel(logrus.DebugLevel) | ||
logrus.Debugf("Loglevel set to [%v]", logrus.DebugLevel) | ||
} | ||
if Trace { | ||
logrus.SetLevel(logrus.TraceLevel) | ||
logrus.Tracef("Loglevel set to [%v]", logrus.TraceLevel) | ||
} | ||
|
||
logrus.Infof("Starting backup-restore controller version %s (%s)", Version, GitCommit) | ||
ctx := signals.SetupSignalContext() | ||
restKubeConfig, err := kubeconfig.GetNonInteractiveClientConfig(KubeConfig).ClientConfig() | ||
if err != nil { | ||
logrus.Fatalf("failed to find kubeconfig: %v", err) | ||
} | ||
|
||
dm := os.Getenv("CATTLE_DEV_MODE") | ||
runOptions := operator.RunOptions{ | ||
OperatorPVCEnabled: OperatorPVEnabled != "", | ||
OperatorS3BackupStorageLocation: OperatorS3BackupStorageLocation, | ||
ChartNamespace: ChartNamespace, | ||
UseLocalDriver: dm != "", | ||
LocalDriverPath: "", | ||
} | ||
|
||
if err := operator.Run(ctx, restKubeConfig, runOptions); err != nil { | ||
logrus.Fatalf("Error running operator: %s", err.Error()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
backups/ |
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update goreleaser and release CI as well