Skip to content

Commit

Permalink
Updated Dockerfile to point to Amazon Linux Image
Browse files Browse the repository at this point in the history
  • Loading branch information
Patil committed Jul 14, 2022
1 parent 4fb837c commit 08ccb67
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 41 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ ARG TARGETOS
ARG TARGETARCH
RUN OS=$TARGETOS ARCH=$TARGETARCH make $TARGETOS/$TARGETARCH

FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi-ebs:latest.2 AS linux-amazon
FROM amazonlinux:2 AS linux-amazon
RUN yum update -y && \
yum install ca-certificates e2fsprogs xfsprogs util-linux -y && \
yum clean all
COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver/bin/aws-ebs-csi-driver /bin/aws-ebs-csi-driver
ENTRYPOINT ["/bin/aws-ebs-csi-driver"]

Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 1.8.0
name: aws-ebs-csi-driver
description: A Helm chart for AWS EBS CSI Driver
version: 2.8.18
version: 2.8.19
kubeVersion: ">=1.17.0-0"
# home: https://github.com/kubernetes-sigs/aws-ebs-csi-driver
# sources:
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image:
# repository: public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver
repository: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi
# Overrides the image tag whose default is v{{ .Chart.AppVersion }}
tag: "aa1155e1b99f7459610604229adb81769e62af32-linux-amd64-amazon"
tag: "4fb837c895e9c12817bdabf6ab9760162c01bec3-linux-amd64-amazon"
pullPolicy: IfNotPresent

# -- Custom labels to add into metadata
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/base/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
tolerationSeconds: 300
containers:
- name: ebs-plugin
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:aa1155e1b99f7459610604229adb81769e62af32-linux-amd64-amazon
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:4fb837c895e9c12817bdabf6ab9760162c01bec3-linux-amd64-amazon
imagePullPolicy: IfNotPresent
args:
# - {all,controller,node} # specify the driver mode
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/base/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
- name: ebs-plugin
securityContext:
privileged: true
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:aa1155e1b99f7459610604229adb81769e62af32-linux-amd64-amazon
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:4fb837c895e9c12817bdabf6ab9760162c01bec3-linux-amd64-amazon
imagePullPolicy: IfNotPresent
args:
- node
Expand Down
67 changes: 31 additions & 36 deletions pkg/driver/node_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ limitations under the License.
package driver

import (
"encoding/json"
"fmt"
"os"
osexec "os/exec"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -106,16 +106,14 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st

klog.V(5).Infof("[Debug] Falling back to snow volume lookup for: %q", devicePath)

//snowDevicePath, err := d.deviceIdentifier.FindSnowVolume()
//snowDevicePath, err := d.deviceIdentifier.Lstat("/dev/vda")
snowDevicePath, err := findSnowVolume(d, err)

//if err == nil {
// klog.V(5).Infof("[Debug] successfully resolved devicePath=%q to %q", devicePath, snowDevicePath)
// canonicalDevicePath = snowDevicePath
//} else {
// klog.V(5).Infof("[Debug] error searching for snow path: %v", err)
//}
//snowDevicePath, err := findSnowVolume(d, err)
snowDevicePath, err := d.deviceIdentifier.FindSnowVolume()
if err == nil {
klog.V(5).Infof("[Debug] successfully resolved devicePath=%q to %q", devicePath, snowDevicePath)
canonicalDevicePath = snowDevicePath
} else {
klog.V(5).Infof("[Debug] error searching for snow path: %v", err)
}

if canonicalDevicePath == "" {
return "", errNoDevicePathFound(devicePath, volumeID, snowDevicePath, err)
Expand All @@ -125,34 +123,31 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st
return canonicalDevicePath, nil
}

func findSnowVolume(d *nodeService, err error) ([]byte, error) {
//snowDevicePath := ""
//cmd := d.mounter.(*NodeMounter).Exec.Command("/usr/bin/lsblk", "--json")
//output, err := cmd.Output()
cmd := osexec.Command("lsblk", "--json")
func findSnowVolume(d *nodeService, err error) (string, error) {
snowDevicePath := ""
cmd := d.mounter.(*NodeMounter).Exec.Command("lsblk", "--json", "--output", "NAME,MOUNTPOINT")
output, err := cmd.Output()
//rawOut := make(map[string][]BlockDevice, 1)
//err = json.Unmarshal(output, &rawOut)
//if err != nil {
// klog.V(5).Infof("unable to unmarshal output to BlockDevice instance, error: %v", err)
//}
//var (
// devs []BlockDevice
// ok bool
//)
//if devs, ok = rawOut["blockdevices"]; !ok {
// klog.V(5).Infof("unexpected lsblk output format, missing block devices")
//}
//for _, d := range devs {
// if (strings.HasPrefix(d.Name, "/dev/v")) && (len(d.MountPoint) == 0) {
// snowDevicePath = d.Name
// }
//}
//return snowDevicePath, err
return output, err
rawOut := make(map[string][]BlockDevice, 1)
err = json.Unmarshal(output, &rawOut)
if err != nil {
klog.V(5).Infof("unable to unmarshal output to BlockDevice instance, error: %v", err)
}
var (
devs []BlockDevice
ok bool
)
if devs, ok = rawOut["blockdevices"]; !ok {
klog.V(5).Infof("unexpected lsblk output format, missing block devices")
}
for _, d := range devs {
if (strings.HasPrefix(d.Name, "/dev/v")) && (len(d.MountPoint) == 0) {
snowDevicePath = d.Name
}
}
return snowDevicePath, err
}

func errNoDevicePathFound(devicePath string, volumeID string, snowDevicePath []byte, err error) error {
func errNoDevicePathFound(devicePath string, volumeID string, snowDevicePath string, err error) error {
return fmt.Errorf("no device path for device %q volume %q found snowdevicePath %v errorMount %v", devicePath, volumeID, snowDevicePath, err)
}

Expand Down

0 comments on commit 08ccb67

Please sign in to comment.