mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 05:46:37 +00:00
Merge pull request #541 from skriss/rename-init-container
rename restic-init-container to ark-restic-restore-helper
This commit is contained in:
@@ -16,8 +16,8 @@ FROM alpine:3.7
|
||||
|
||||
MAINTAINER Steve Kriss <steve@heptio.com>
|
||||
|
||||
ADD /bin/linux/amd64/restic-init-container .
|
||||
ADD /bin/linux/amd64/ark-restic-restore-helper .
|
||||
|
||||
USER nobody:nobody
|
||||
|
||||
ENTRYPOINT [ "/restic-init-container" ]
|
||||
ENTRYPOINT [ "/ark-restic-restore-helper" ]
|
||||
6
Makefile
6
Makefile
@@ -60,7 +60,7 @@ IMAGE := $(REGISTRY)/$(BIN)
|
||||
# If you want to build AND push all containers, see the 'all-push' rule.
|
||||
all:
|
||||
@$(MAKE) build
|
||||
@$(MAKE) build BIN=restic-init-container
|
||||
@$(MAKE) build BIN=ark-restic-restore-helper
|
||||
|
||||
build-%:
|
||||
@$(MAKE) --no-print-directory ARCH=$* build
|
||||
@@ -117,7 +117,7 @@ DOTFILE_IMAGE = $(subst :,_,$(subst /,_,$(IMAGE))-$(VERSION))
|
||||
|
||||
all-containers:
|
||||
$(MAKE) container
|
||||
$(MAKE) container BIN=restic-init-container
|
||||
$(MAKE) container BIN=ark-restic-restore-helper
|
||||
|
||||
container: verify test .container-$(DOTFILE_IMAGE) container-name
|
||||
.container-$(DOTFILE_IMAGE): _output/bin/$(GOOS)/$(GOARCH)/$(BIN) $(DOCKERFILE)
|
||||
@@ -130,7 +130,7 @@ container-name:
|
||||
|
||||
all-push:
|
||||
$(MAKE) push
|
||||
$(MAKE) push BIN=restic-init-container
|
||||
$(MAKE) push BIN=ark-restic-restore-helper
|
||||
|
||||
push: .push-$(DOTFILE_IMAGE) push-name
|
||||
.push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE)
|
||||
|
||||
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package restore
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
@@ -25,20 +27,33 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
api "github.com/heptio/ark/pkg/apis/ark/v1"
|
||||
"github.com/heptio/ark/pkg/buildinfo"
|
||||
"github.com/heptio/ark/pkg/restic"
|
||||
"github.com/heptio/ark/pkg/util/kube"
|
||||
)
|
||||
|
||||
type resticRestoreAction struct {
|
||||
logger logrus.FieldLogger
|
||||
logger logrus.FieldLogger
|
||||
initContainerImage string
|
||||
}
|
||||
|
||||
func NewResticRestoreAction(logger logrus.FieldLogger) ItemAction {
|
||||
return &resticRestoreAction{
|
||||
logger: logger,
|
||||
logger: logger,
|
||||
initContainerImage: initContainerImage(),
|
||||
}
|
||||
}
|
||||
|
||||
func initContainerImage() string {
|
||||
tag := buildinfo.Version
|
||||
if tag == "" {
|
||||
tag = "latest"
|
||||
}
|
||||
|
||||
// TODO allow full image URL to be overriden via CLI flag.
|
||||
return fmt.Sprintf("gcr.io/heptio-images/ark-restic-restore-helper:%s", tag)
|
||||
}
|
||||
|
||||
func (a *resticRestoreAction) AppliesTo() (ResourceSelector, error) {
|
||||
return ResourceSelector{
|
||||
IncludedResources: []string{"pods"},
|
||||
@@ -66,7 +81,7 @@ func (a *resticRestoreAction) Execute(obj runtime.Unstructured, restore *api.Res
|
||||
|
||||
initContainer := corev1.Container{
|
||||
Name: restic.InitContainer,
|
||||
Image: "gcr.io/heptio-images/restic-init-container:latest",
|
||||
Image: a.initContainerImage,
|
||||
Args: []string{string(restore.UID)},
|
||||
Env: []corev1.EnvVar{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user