Skip to content

Commit

Permalink
lb-csi 1.8.0 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Jun 21, 2022
1 parent 328b559 commit da5ae8c
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 137 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Build the duros-controller binary
FROM golang:1.17 as builder
FROM golang:1.18 as builder

ENV KUBEBUILDER_DOWNLOAD_URL=https://github.com/kubernetes-sigs/kubebuilder/releases/download
ENV KUBEBUILDER_VER=v3.3.0
ENV KUBEBUILDER_VER=v3.4.1
RUN set -ex \
&& mkdir -p /usr/local/bin \
&& curl -L ${KUBEBUILDER_DOWNLOAD_URL}/v${KUBEBUILDER_VER}/kubebuilder_linux_amd64 -o /usr/local/bin/kubebuilder \
Expand All @@ -29,7 +29,7 @@ COPY main.go main.go
RUN make

# Final Image
FROM alpine:3.15
FROM alpine:3.16
WORKDIR /
COPY --from=builder /workspace/bin/duros-controller .
USER 65534
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0 ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand Down
12 changes: 6 additions & 6 deletions controllers/images.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package controllers

const (
lbCSIPluginImage = "docker.lightbitslabs.com/lightos-csi/lb-csi-plugin:1.4.1"
lbDiscoveryClientImage = "docker.lightbitslabs.com/lightos-csi/lb-nvme-discovery-client:1.4.1"
csiProvisionerImage = "k8s.gcr.io/sig-storage/csi-provisioner:v1.6.1"
csiAttacherImage = "k8s.gcr.io/sig-storage/csi-attacher:v2.2.1"
csiResizerImage = "k8s.gcr.io/sig-storage/csi-resizer:v0.5.0"
csiNodeDriverRegistrarImage = "k8s.gcr.io/sig-storage/csi-node-driver-registrar:v1.3.0"
lbCSIPluginImage = "docker.lightbitslabs.com/lightos-csi/lb-csi-plugin:1.8.0"
lbDiscoveryClientImage = "docker.lightbitslabs.com/lightos-csi/lb-nvme-discovery-client:1.8.0"
csiProvisionerImage = "k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2"
csiAttacherImage = "k8s.gcr.io/sig-storage/csi-attacher:v3.5.0"
csiResizerImage = "k8s.gcr.io/sig-storage/csi-resizer:v1.5.0"
csiNodeDriverRegistrarImage = "k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.1"
snapshotControllerImage = "k8s.gcr.io/sig-storage/snapshot-controller:v4.1.0"
csiSnapshotterImage = "k8s.gcr.io/sig-storage/csi-snapshotter:v4.1.0"
busyboxImage = "busybox:1.32"
Expand Down
32 changes: 28 additions & 4 deletions controllers/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ var (
},
{
APIGroups: []string{"storage.k8s.io"},
Resources: []string{"volumeattachments"},
Resources: []string{"volumeattachments", "volumeattachments/status"},
Verbs: []string{"get", "list", "watch", "update", "patch"},
},
{
Expand Down Expand Up @@ -486,6 +486,7 @@ var (
},
VolumeMounts: []corev1.VolumeMount{
{Name: socketDirVolume.Name, MountPath: "/var/lib/csi/sockets/pluginproxy/"},
{Name: etcDirVolume.Name, MountPath: "/etc/lb-csi/"},
},
Resources: defaultResourceLimits,
}
Expand Down Expand Up @@ -606,6 +607,7 @@ var (
{Name: podsMountDirVolume.Name, MountPath: "/var/lib/kubelet", MountPropagation: &mountPropagationBidirectional},
{Name: deviceDirVolume.Name, MountPath: "/dev"},
{Name: discoveryClientDirVolume.Name, MountPath: "/etc/discovery-client/discovery.d"},
{Name: etcDirVolume.Name, MountPath: "/etc/lb-csi/"},
},
Resources: defaultResourceLimits,
}
Expand All @@ -624,7 +626,7 @@ var (
{Name: "DRIVER_REG_SOCK_PATH", Value: "/var/lib/kubelet/plugins/csi.lightbitslabs.com/csi.sock"},
{Name: "KUBE_NODE_NAME", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "spec.nodeName"}}},
},
Lifecycle: &corev1.Lifecycle{PreStop: &corev1.Handler{Exec: &corev1.ExecAction{
Lifecycle: &corev1.Lifecycle{PreStop: &corev1.LifecycleHandler{Exec: &corev1.ExecAction{
Command: []string{
"/bin/sh",
"-c",
Expand Down Expand Up @@ -690,6 +692,14 @@ var (
},
},
}
etcDirVolume = corev1.Volume{
Name: "etc-lb-csi",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: storageClassCredentialsRef,
},
},
}

// Node DaemonSet
nodeRoleLabels = map[string]string{"app": lbCSINodeName, "role": "node"}
Expand Down Expand Up @@ -726,6 +736,7 @@ var (
deviceDirVolume,
modulesDirVolume,
discoveryClientDirVolume,
etcDirVolume,
},
},
},
Expand Down Expand Up @@ -953,6 +964,7 @@ func (r *DurosReconciler) deployCSI(ctx context.Context, projectID string, scs [
PriorityClassName: "system-cluster-critical",
Volumes: []corev1.Volume{
socketDirVolume,
etcDirVolume,
},
},
},
Expand Down Expand Up @@ -994,6 +1006,8 @@ func (r *DurosReconciler) deployCSI(ctx context.Context, projectID string, scs [
"mgmt-endpoint": r.Endpoints.String(),
"project-name": projectID,
"replica-count": strconv.Itoa(sc.ReplicaCount),
"csi.storage.k8s.io/controller-expand-secret-name": storageClassCredentialsRef,
"csi.storage.k8s.io/controller-expand-secret-namespace": namespace,
"csi.storage.k8s.io/controller-publish-secret-name": storageClassCredentialsRef,
"csi.storage.k8s.io/controller-publish-secret-namespace": namespace,
"csi.storage.k8s.io/node-publish-secret-name": storageClassCredentialsRef,
Expand All @@ -1002,13 +1016,23 @@ func (r *DurosReconciler) deployCSI(ctx context.Context, projectID string, scs [
"csi.storage.k8s.io/node-stage-secret-namespace": namespace,
"csi.storage.k8s.io/provisioner-secret-name": storageClassCredentialsRef,
"csi.storage.k8s.io/provisioner-secret-namespace": namespace,
"csi.storage.k8s.io/controller-expand-secret-name": storageClassCredentialsRef,
"csi.storage.k8s.io/controller-expand-secret-namespace": namespace,
}

if sc.Compression {
obj.Parameters["compression"] = "enabled"
}
// if sc.Encryption {
// secretName := "storage-encryption-key"
// //nolint:gosec
// secretNamespace := "${pvc.namespace}"
// obj.Parameters["encryption"] = "enabled"
// obj.Parameters["csi.storage.k8s.io/controller-expand-secret-name"] = secretName
// obj.Parameters["csi.storage.k8s.io/controller-expand-secret-namespace"] = secretNamespace
// obj.Parameters["csi.storage.k8s.io/node-publish-secret-name"] = secretName
// obj.Parameters["csi.storage.k8s.io/node-publish-secret-namespace"] = secretNamespace
// obj.Parameters["csi.storage.k8s.io/node-stage-secret-name"] = secretName
// obj.Parameters["csi.storage.k8s.io/node-stage-secret-namespace"] = secretNamespace
// }
return nil
})
if err != nil {
Expand Down
80 changes: 44 additions & 36 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,75 +1,83 @@
module github.com/metal-stack/duros-controller

go 1.17
go 1.18

require (
github.com/go-logr/logr v1.0.0
github.com/go-logr/zapr v0.4.0
github.com/golang-jwt/jwt/v4 v4.2.0
github.com/metal-stack/duros-go v0.3.0
github.com/go-logr/logr v1.2.3
github.com/go-logr/zapr v1.2.3
github.com/golang-jwt/jwt/v4 v4.4.1
github.com/metal-stack/duros-go v0.3.3
github.com/metal-stack/metal-lib v0.9.0
github.com/metal-stack/v v1.0.3
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.18.1
go.uber.org/zap v1.20.0
google.golang.org/grpc v1.44.0
k8s.io/api v0.22.4
k8s.io/apimachinery v0.22.4
k8s.io/client-go v0.22.4
k8s.io/utils v0.0.0-20211203121628-587287796c64
sigs.k8s.io/controller-runtime v0.10.3
github.com/onsi/gomega v1.19.0
go.uber.org/zap v1.21.0
google.golang.org/grpc v1.47.0
k8s.io/api v0.24.2
k8s.io/apimachinery v0.24.2
k8s.io/client-go v0.24.2
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/controller-runtime v0.12.1
)

require (
cloud.google.com/go v0.99.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211206220100-3cb06788ce7f // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiextensions-apiserver v0.22.2 // indirect
k8s.io/component-base v0.22.2 // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
k8s.io/apiextensions-apiserver v0.24.0 // indirect
k8s.io/component-base v0.24.0 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/go-logr/logr => github.com/go-logr/logr v0.4.0
Loading

0 comments on commit da5ae8c

Please sign in to comment.