Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 0
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
name: Build
runs-on: ubuntu-24.04
steps:
- name: Set up Go 1.25
- name: Set up Go 1.27
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: '1.25'
go-version: '1.27'
id: go

- name: Check out code into the Go module directory
Expand All @@ -32,7 +32,7 @@ jobs:

- name: Prepare Host
run: |
curl -LO https://dl.k8s.io/release/v1.32.1/bin/linux/amd64/kubectl
curl -LO https://dl.k8s.io/release/v1.37.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
name: Build
runs-on: ubuntu-24.04
steps:
- name: Set up Go 1.25
- name: Set up Go 1.27
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: '1.25'
go-version: '1.27'
id: go

- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dbg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:12
FROM debian:13

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))

BASEIMAGE_PROD ?= busybox:latest
BASEIMAGE_DBG ?= debian:12
BASEIMAGE_DBG ?= debian:13

IMAGE := $(REGISTRY)/$(BIN)
VERSION_PROD := $(VERSION)
Expand All @@ -72,7 +72,7 @@ TAG := $(VERSION)_$(OS)_$(ARCH)
TAG_PROD := $(TAG)
TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH)

GO_VERSION ?= 1.25
GO_VERSION ?= 1.27
BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)
TEST_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)-stash

Expand Down
6 changes: 4 additions & 2 deletions pkg/cmds/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ func NewCmdRestore() *cobra.Command {

err := opt.Restore(inv, targetInfo)
if err != nil {
klog.Errorf("Failed to complete restore process for %s %s/%s. Reason: %v",
klog.Errorf(
"Failed to complete restore process for %s %s/%s. Reason: %v",
inv.GetTypeMeta().Kind,
inv.GetObjectMeta().Namespace,
inv.GetObjectMeta().Name,
err,
)
return err
}
klog.Infof("Restore completed successfully for %s %s/%s",
klog.Infof(
"Restore completed successfully for %s %s/%s",
inv.GetTypeMeta().Kind,
inv.GetObjectMeta().Namespace,
inv.GetObjectMeta().Name,
Expand Down
6 changes: 4 additions & 2 deletions pkg/cmds/run_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ func (opt *hookOptions) executeBackupHook() error {

targetInfo := opt.getBackupTargetInfo(inv)
if targetInfo == nil {
return fmt.Errorf("backup target %s/%s did not matched with any target of the %s %s/%s",
return fmt.Errorf(
"backup target %s/%s did not matched with any target of the %s %s/%s",
opt.targetRef.Kind,
opt.targetRef.Name,
opt.invokerKind,
Expand Down Expand Up @@ -181,7 +182,8 @@ func (opt *hookOptions) executeRestoreHook() error {

targetInfo := opt.getRestoreTargetInfo(inv)
if targetInfo == nil {
return fmt.Errorf("restore target %s/%s did not matched with any target of the %s %s/%s",
return fmt.Errorf(
"restore target %s/%s did not matched with any target of the %s %s/%s",
opt.targetRef.Kind,
opt.targetRef.Name,
opt.invokerKind,
Expand Down
27 changes: 18 additions & 9 deletions pkg/controller/backup_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,16 @@ func (c *StashController) runBackupConfigurationProcessor(v any) error {
key := v.(string)
obj, exists, err := c.bcInformer.GetIndexer().GetByKey(key)
if err != nil {
klog.ErrorS(err, "Failed to fetch object from indexer",
klog.ErrorS(
err, "Failed to fetch object from indexer",
apis.ObjectKind, api_v1beta1.ResourceKindBackupConfiguration,
apis.ObjectKey, key,
)
return err
}
if !exists {
klog.V(4).InfoS("Object does not exit anymore",
klog.V(4).InfoS(
"Object does not exit anymore",
apis.ObjectKind, api_v1beta1.ResourceKindBackupConfiguration,
apis.ObjectKey, key,
)
Expand Down Expand Up @@ -205,7 +207,8 @@ func (r *backupInvokerReconciler) reconcile() error {
tref := targetInfo.Target.Ref
targetExist, err := util.IsTargetExist(r.ctrl.clientConfig, tref)
if err != nil {
r.logger.Error(err, "Failed to check target existence",
r.logger.Error(
err, "Failed to check target existence",
apis.KeyTargetKind, tref.Kind,
apis.KeyTargetName, tref.Name,
apis.KeyTargetNamespace, tref.Namespace,
Expand All @@ -216,7 +219,8 @@ func (r *backupInvokerReconciler) reconcile() error {
if !targetExist {
// Target does not exist. Log the information.
someTargetMissing = true
r.logger.Info("Backup target does not exist.",
r.logger.Info(
"Backup target does not exist.",
apis.KeyTargetKind, tref.Kind,
apis.KeyTargetName, tref.Name,
apis.KeyTargetNamespace, tref.Namespace,
Expand Down Expand Up @@ -337,7 +341,8 @@ func (r *backupInvokerReconciler) handleCronJobCreationFailure(invRef *core.Obje
invRef,
core.EventTypeWarning,
eventer.EventReasonCronJobCreationFailed,
fmt.Sprintf("failed to ensure CronJob for %s %s/%s. Reason: %v", invRef.Kind, invRef.Namespace, invRef.Name, err))
fmt.Sprintf("failed to ensure CronJob for %s %s/%s. Reason: %v", invRef.Kind, invRef.Namespace, invRef.Name, err),
)
return errors.NewAggregate([]error{err, err2})
}

Expand All @@ -353,7 +358,8 @@ func (c *StashController) handleWorkloadControllerTriggerFailure(logger klog.Log
eventSource = eventer.EventSourceRestoreSessionController
}

logger.Error(err, "Failed to trigger workload controller",
logger.Error(
err, "Failed to trigger workload controller",
apis.KeyTargetKind, tref.Kind,
apis.KeyTargetName, tref.Name,
apis.KeyTargetNamespace, tref.Namespace,
Expand All @@ -377,7 +383,8 @@ func (r *backupInvokerReconciler) requeue() error {
case api_v1beta1.ResourceKindBackupConfiguration:
r.ctrl.bcQueue.GetQueue().AddAfter(r.key, requeueTimeInterval)
default:
return fmt.Errorf("unable to requeue. Reason: Backup invoker %s %s is not supported",
return fmt.Errorf(
"unable to requeue. Reason: Backup invoker %s %s is not supported",
r.invoker.GetTypeMeta().APIVersion,
r.invoker.GetTypeMeta().Kind,
)
Expand Down Expand Up @@ -436,7 +443,8 @@ func (c *StashController) checkForResticSnapshotterRequirements(logger klog.Logg
}

if repository == nil {
logger.Info("Repository does not exist",
logger.Info(
"Repository does not exist",
apis.KeyRepositoryName, r.GetRepoRef().Name,
apis.KeyRepositoryNamespace, r.GetRepoRef().Namespace,
)
Expand All @@ -448,7 +456,8 @@ func (c *StashController) checkForResticSnapshotterRequirements(logger klog.Logg
return false, err
}
if secret == nil {
klog.InfoS("Secret does not exist",
klog.InfoS(
"Secret does not exist",
"secret_name", repository.Spec.Backend.StorageSecretName,
"secret_namespace", repository.Namespace,
apis.KeyRepositoryName, repository.Name,
Expand Down
36 changes: 24 additions & 12 deletions pkg/controller/backup_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ func (c *StashController) processBackupSessionEvent(v any) error {
key := v.(string)
obj, exists, err := c.backupSessionInformer.GetIndexer().GetByKey(key)
if err != nil {
klog.ErrorS(err, "Failed to fetch object from indexer",
klog.ErrorS(
err, "Failed to fetch object from indexer",
apis.ObjectKind, api_v1beta1.ResourceKindBackupSession,
apis.ObjectKey, key,
)
return err
}
if !exists {
klog.V(4).InfoS("Object does not exist anymore",
klog.V(4).InfoS(
"Object does not exist anymore",
apis.ObjectKind, api_v1beta1.ResourceKindBackupSession,
apis.ObjectKey, key,
)
Expand Down Expand Up @@ -153,15 +155,17 @@ func (r *backupSessionReconciler) reconcile() error {
return r.requeueAfterRetryDelay()
}

r.logger.V(4).Info("Skipping processing event",
r.logger.V(4).Info(
"Skipping processing event",
apis.KeyReason, fmt.Sprintf("Backup has been completed already with phase %q", r.session.GetStatus().Phase),
)
return nil
}

if r.isSessionCompleted() {
if r.shouldWaitForTargetPostBackupHookExecution() {
r.logger.Info("Waiting for target specific postBackup hook to be executed",
r.logger.Info(
"Waiting for target specific postBackup hook to be executed",
apis.KeyInvokerKind, r.invoker.GetTypeMeta().Kind,
apis.KeyInvokerName, r.invoker.GetObjectMeta().Name,
apis.KeyInvokerNamespace, r.invoker.GetObjectMeta().Namespace,
Expand Down Expand Up @@ -245,7 +249,8 @@ func (r *backupSessionReconciler) reconcile() error {
return err
}
if pendingReason != "" {
r.logger.Info("Keeping backup pending",
r.logger.Info(
"Keeping backup pending",
apis.KeyReason, pendingReason,
apis.KeyTargetKind, targetInfo.Target.Ref.Kind,
apis.KeyTargetName, targetInfo.Target.Ref.Name,
Expand All @@ -259,7 +264,8 @@ func (r *backupSessionReconciler) reconcile() error {
}

if err := r.ensureBackupExecutor(targetInfo, i); err != nil {
r.logger.Error(err, "Failed to ensure backup executor",
r.logger.Error(
err, "Failed to ensure backup executor",
apis.KeyTargetKind, targetInfo.Target.Ref.Kind,
apis.KeyTargetName, targetInfo.Target.Ref.Name,
apis.KeyTargetNamespace, targetInfo.Target.Ref.Namespace,
Expand Down Expand Up @@ -383,7 +389,8 @@ func (r *backupSessionReconciler) ensureBackupExecutor(targetInfo invoker.Backup
return err
}
if verb != kutil.VerbUnchanged {
r.logger.Info("Successfully ensured backup executor",
r.logger.Info(
"Successfully ensured backup executor",
apis.KeyTargetKind, targetInfo.Target.Ref.Kind,
apis.KeyTargetName, targetInfo.Target.Ref.Name,
apis.KeyTargetNamespace, targetInfo.Target.Ref.Namespace,
Expand Down Expand Up @@ -523,7 +530,8 @@ func (r *backupSessionReconciler) initiateTargetBackup(index int) error {
}
}
if r.session.GetStatus().Phase != api_v1beta1.BackupSessionRunning {
r.logger.Info("Initiating target backup",
r.logger.Info(
"Initiating target backup",
apis.KeyTargetKind, target.Ref.Kind,
apis.KeyTargetName, target.Ref.Name,
apis.KeyTargetNamespace, target.Ref.Namespace,
Expand Down Expand Up @@ -681,7 +689,8 @@ func (r *backupSessionReconciler) executeGlobalPostBackupHook() error {
}

if !stashHooks.IsAllowedByExecutionPolicy(executionPolicy, summary) {
reason := fmt.Sprintf("Skipping executing %s. Reason: executionPolicy is %q but phase is %q.",
reason := fmt.Sprintf(
"Skipping executing %s. Reason: executionPolicy is %q but phase is %q.",
apis.PostBackupHook,
executionPolicy,
summary.Status.Phase,
Expand Down Expand Up @@ -724,7 +733,8 @@ func (r *backupSessionReconciler) executeGlobalPreBackupHook() error {
func (r *backupSessionReconciler) checkIfBackupShouldBeSkipped() (string, error) {
// Skip if the respective backup invoker is not in ready state
if r.invoker.GetPhase() != api_v1beta1.BackupInvokerReady {
return fmt.Sprintf("Skipped taking backup. Reason: %s %s/%s is not ready.",
return fmt.Sprintf(
"Skipped taking backup. Reason: %s %s/%s is not ready.",
r.invoker.GetTypeMeta().Kind,
r.invoker.GetObjectMeta().Namespace,
r.invoker.GetObjectMeta().Name,
Expand All @@ -737,7 +747,8 @@ func (r *backupSessionReconciler) checkIfBackupShouldBeSkipped() (string, error)
return "", err
}
if r.isBackupPending() && runningBS != nil {
return fmt.Sprintf("Skipped taking new backup. Reason: Previous BackupSession: %s is %q.",
return fmt.Sprintf(
"Skipped taking new backup. Reason: Previous BackupSession: %s is %q.",
runningBS.Name,
runningBS.Status.Phase,
), nil
Expand Down Expand Up @@ -769,7 +780,8 @@ func (r *backupSessionReconciler) checkIfBackupShouldBePending(targetRef api_v1b
}

if shouldKeepCurrentSessionPending(r.session.GetBackupSession(), otherSession) {
return fmt.Sprintf("Found another incomplete BackupSession %s/%s invoked by %s/%s",
return fmt.Sprintf(
"Found another incomplete BackupSession %s/%s invoked by %s/%s",
otherSession.Namespace,
otherSession.Name,
otherSession.Spec.Invoker.Kind,
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func (c Config) LicenseProvided() bool {
ok, _ := discovery.HasGVK(
c.KubeClient.Discovery(),
proxyserver.SchemeGroupVersion.String(),
proxyserver.ResourceKindLicenseRequest)
proxyserver.ResourceKindLicenseRequest,
)
return ok
}

Expand Down
6 changes: 4 additions & 2 deletions pkg/controller/daemonsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,17 @@ func (c *StashController) processDaemonSetEvent(v any) error {
key := v.(string)
obj, exists, err := c.dsInformer.GetIndexer().GetByKey(key)
if err != nil {
klog.ErrorS(err, "Failed to fetch object from indexer",
klog.ErrorS(
err, "Failed to fetch object from indexer",
apis.ObjectKind, apis.KindDaemonSet,
apis.ObjectKey, key,
)
return err
}

if !exists {
klog.V(4).InfoS("Object doesn't exist anymore",
klog.V(4).InfoS(
"Object doesn't exist anymore",
apis.ObjectKind, apis.KindDaemonSet,
apis.ObjectKey, key,
)
Expand Down
6 changes: 4 additions & 2 deletions pkg/controller/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ func (c *StashController) processDeploymentEvent(v any) error {
key := v.(string)
obj, exists, err := c.dpInformer.GetIndexer().GetByKey(key)
if err != nil {
klog.ErrorS(err, "Failed to fetch object from indexer",
klog.ErrorS(
err, "Failed to fetch object from indexer",
apis.ObjectKind, apis.KindDeployment,
apis.ObjectKey, key,
)
return err
}

if !exists {
klog.V(4).InfoS("Object doesn't exist anymore",
klog.V(4).InfoS(
"Object doesn't exist anymore",
apis.ObjectKind, apis.KindDeployment,
apis.ObjectKey, key,
)
Expand Down
6 changes: 4 additions & 2 deletions pkg/controller/deploymentconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,17 @@ func (c *StashController) processDeploymentConfigEvent(v any) error {
key := v.(string)
obj, exists, err := c.dcInformer.GetIndexer().GetByKey(key)
if err != nil {
klog.ErrorS(err, "Failed to fetch object from indexer",
klog.ErrorS(
err, "Failed to fetch object from indexer",
apis.ObjectKind, apis.KindDeploymentConfig,
apis.ObjectKey, key,
)
return err
}

if !exists {
klog.V(4).InfoS("Object doesn't exist anymore",
klog.V(4).InfoS(
"Object doesn't exist anymore",
apis.ObjectKind, apis.KindDeploymentConfig,
apis.ObjectKey, key,
)
Expand Down
Loading
Loading