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

[Draft] Remove glibc dependency long term #477

Closed
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
3 changes: 1 addition & 2 deletions Dockerfile-backup-driver
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/distroless/base-debian10:nonroot
COPY /bin/linux/amd64/lib/vmware-vix-disklib/lib64/* /vddkLibs/
FROM gcr.io/distroless/static-debian10:nonroot
ADD /bin/linux/amd64/backup-driver* /backup-driver
USER nonroot:nonroot
ENTRYPOINT ["/backup-driver"]
3 changes: 1 addition & 2 deletions Dockerfile-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

FROM busybox:1.33.1 AS busybox

FROM gcr.io/distroless/base-debian10:nonroot
FROM gcr.io/distroless/static-debian10:nonroot
ADD /bin/linux/amd64/velero-* /plugins/
ADD /bin/linux/amd64/data-* /
ADD /bin/linux/amd64/backup-driver* /
COPY /bin/linux/amd64/install.sh /scripts/
COPY /bin/linux/amd64/lib/vmware-vix-disklib/lib64/* /plugins/
ENV LD_LIBRARY_PATH=/plugins
COPY --from=busybox /bin/sh /bin/sh
COPY --from=busybox /bin/chmod /bin/chmod
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ PLUGIN_DOCKERFILE ?= Dockerfile-plugin
DATAMGR_DOCKERFILE ?= Dockerfile-datamgr
BACKUPDRIVER_DOCKERFILE ?= Dockerfile-backup-driver

all: dep plugin vsphere-astrolabe
all: dep datamgr backup-driver plugin vsphere-astrolabe

dep:
ifeq (,$(wildcard $(GOPATH)/src/$(VDDK_LIBS)))
$(error "$(GOPATH)/src/$(VDDK_LIBS) cannot find vddk libs in path. Please refer to: https://github.com/vmware/virtual-disks#dependency, download the VDDK tarball to the directory $(GOPATH)/src/$(LIB_DIR)/ and untar it")
endif

plugin: datamgr backup-driver
plugin:
@echo "making: $@"
$(MAKE) build BIN=$(PLUGIN_BIN) VERSION=$(VERSION)

Expand Down Expand Up @@ -166,15 +166,15 @@ copy-vix-libs:
copy-install-script:
cp $$(pwd)/scripts/install.sh _output/bin/$(GOOS)/$(GOARCH)

build-container: copy-vix-libs container-name
build-container: container-name
cp $(DOCKERFILE) _output/bin/$(GOOS)/$(GOARCH)/$(DOCKERFILE)
docker build -t $(IMAGE):$(VERSION) -f _output/bin/$(GOOS)/$(GOARCH)/$(DOCKERFILE) _output

plugin-container: all copy-install-script
plugin-container: dep plugin vsphere-astrolabe copy-install-script
$(MAKE) build-container IMAGE=$(PLUGIN_IMAGE) DOCKERFILE=$(PLUGIN_DOCKERFILE) VERSION=$(VERSION)

datamgr-container: datamgr
$(MAKE) build-container BIN=$(DATAMGR_BIN) IMAGE=$(DATAMGR_IMAGE) DOCKERFILE=$(DATAMGR_DOCKERFILE) VERSION=$(VERSION)
$(MAKE) copy-vix-libs build-container BIN=$(DATAMGR_BIN) IMAGE=$(DATAMGR_IMAGE) DOCKERFILE=$(DATAMGR_DOCKERFILE) VERSION=$(VERSION)

backup-driver-container: backup-driver
$(MAKE) build-container BIN=$(BACKUPDRIVER_BIN) IMAGE=$(BACKUPDRIVER_IMAGE) DOCKERFILE=$(BACKUPDRIVER_DOCKERFILE) VERSION=$(VERSION)
Expand Down
36 changes: 36 additions & 0 deletions cmd/data-manager-for-plugin-install/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2020 the Velero contributors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"os"
"path/filepath"

"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd/datamgr_install"

"k8s.io/klog"
)

func main() {
defer klog.Flush()

baseName := filepath.Base(os.Args[0])

err := datamgr_install.NewCommand(baseName).Execute()
cmd.CheckError(err)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"path/filepath"

"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd/datamgr"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd/datamgr_server"

"k8s.io/klog"
)
Expand All @@ -31,6 +31,6 @@ func main() {

baseName := filepath.Base(os.Args[0])

err := datamgr.NewCommand(baseName).Execute()
err := datamgr_server.NewCommand(baseName).Execute()
cmd.CheckError(err)
}
2 changes: 0 additions & 2 deletions deployment/create-deployment-for-backupdriver-guest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ spec:
value: velero
- name: VELERO_SCRATCH_DIR
value: /scratch
- name: LD_LIBRARY_PATH
value: /vddkLibs
image: dpcpinternal/backup-driver:<backup-driver image tag>
imagePullPolicy: IfNotPresent
name: backup-driver
Expand Down
2 changes: 0 additions & 2 deletions deployment/create-deployment-for-backupdriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ spec:
value: velero
- name: VELERO_SCRATCH_DIR
value: /scratch
- name: LD_LIBRARY_PATH
value: /vddkLibs
image: dpcpinternal/backup-driver:<backup-driver image tag>
imagePullPolicy: IfNotPresent
name: backup-driver
Expand Down
60 changes: 60 additions & 0 deletions pkg/cmd/datamgr_install/datamgr_install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
Copyright 2020 the Velero contributors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package datamgr_install

import (
"flag"
"fmt"
"os"

"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd/datamgr_install/cli/install"
"github.com/spf13/cobra"
"k8s.io/klog"

"github.com/vmware-tanzu/velero/pkg/client"
//"github.com/vmware-tanzu/velero/pkg/features"
)

func NewCommand(name string) *cobra.Command {
// Load the config here so that we can extract features from it.
config, err := client.LoadConfig()
if err != nil {
fmt.Fprintf(os.Stderr, "WARNING: Error reading config file: %v\n", err)
}

c := &cobra.Command{
Use: name,
Short: "Upload and download snapshots of persistent volume on vSphere kubernetes cluster",
Long: `Data manager is a component in Velero vSphere plugin for
moving local snapshotted data from/to remote durable persistent storage.
Specifically, the data manager component is supposed to be running
in separate container from the velero server`,
}

f := client.NewFactory(name, config)
f.BindFlags(c.PersistentFlags())

c.AddCommand(
install.NewCommand(f),
)

// init and add the klog flags
klog.InitFlags(flag.CommandLine)
c.PersistentFlags().AddGoFlagSet(flag.CommandLine)

return c
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package datamgr
package datamgr_server

import (
"flag"
"fmt"
"os"

"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd/datamgr/cli/install"
"github.com/vmware-tanzu/velero-plugin-for-vsphere/pkg/cmd/datamgr/cli/server"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -52,7 +51,6 @@ func NewCommand(name string) *cobra.Command {

c.AddCommand(
server.NewCommand(f),
install.NewCommand(f),
)

// init and add the klog flags
Expand Down
4 changes: 0 additions & 4 deletions pkg/install/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment
Name: "VELERO_SCRATCH_DIR",
Value: "/scratch",
},
{
Name: "LD_LIBRARY_PATH",
Value: "/vddkLibs",
},
},
Resources: c.resources,
},
Expand Down