Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ccremer committed Aug 3, 2024
1 parent 5c08d44 commit 9c7ca50
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 409 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.SUFFIXES:
.SECONDARY:
.DEFAULT_GOAL := help

include Makefile.vars.mk
-include charts/charts.mk
Expand Down
54 changes: 28 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
module github.com/ccremer/kubernetes-zfs-provisioner

go 1.19
go 1.22.0

toolchain go1.22.5

require (
github.com/knadh/koanf/providers/confmap v0.1.0
github.com/knadh/koanf/providers/env v0.1.0
github.com/knadh/koanf/v2 v2.0.1
github.com/mistifyio/go-zfs/v3 v3.0.1
github.com/stretchr/testify v1.8.4
k8s.io/api v0.27.4
k8s.io/apimachinery v0.27.4
k8s.io/client-go v0.27.4
k8s.io/klog/v2 v2.100.1
sigs.k8s.io/sig-storage-lib-external-provisioner/v9 v9.0.3
github.com/stretchr/testify v1.9.0
k8s.io/api v0.30.3
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
k8s.io/klog/v2 v2.130.1
sigs.k8s.io/sig-storage-lib-external-provisioner/v10 v10.0.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // 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.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -50,21 +52,21 @@ require (
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
github.com/stretchr/objx v0.5.2 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
431 changes: 67 additions & 364 deletions go.sum

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/knadh/koanf/v2"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v9/controller"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v10/controller"
)

const (
Expand All @@ -35,6 +35,8 @@ func main() {
loadDefaultValues()
loadEnvironmentVariables()

log := klog.NewKlogr()

config, err := clientcmd.BuildConfigFromFlags("", koanfInstance.String("kube_config_path"))
if err != nil {
klog.Fatalf("Couldn't get in-cluster or kubectl config: %v", err)
Expand All @@ -47,7 +49,7 @@ func main() {
}

instance := koanfInstance.String(provisionerInstanceKey)
klog.InfoS("Connected to cluster", "host", config.Host)
log.Info("Connected to cluster", "host", config.Host)
p, err := provisioner.NewZFSProvisioner(instance)

Check failure on line 53 in main.go

View workflow job for this annotation

GitHub Actions / test

not enough arguments in call to provisioner.NewZFSProvisioner

Check failure on line 53 in main.go

View workflow job for this annotation

GitHub Actions / docker

not enough arguments in call to provisioner.NewZFSProvisioner
if err != nil {
klog.Fatalf("Failed to create ZFS provisioner: %v", err)
Expand All @@ -58,14 +60,15 @@ func main() {
})

pc := controller.NewProvisionController(
log,
clientset,
instance,
p,
controller.MetricsAddress(koanfInstance.String(metricsAddrKey)),
controller.MetricsPort(int32(koanfInstance.Int(metricsPortKey))),
)

klog.InfoS("Starting provisioner", "version", version, "commit", commit)
log.Info("Starting provisioner", "version", version, "commit", commit)
pc.Run(context.Background())
}

Expand Down
6 changes: 2 additions & 4 deletions pkg/provisioner/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import (
"context"
"fmt"

core "k8s.io/api/core/v1"
"k8s.io/klog/v2"

"github.com/ccremer/kubernetes-zfs-provisioner/pkg/zfs"
core "k8s.io/api/core/v1"
)

// Delete removes a given volume from the server
Expand All @@ -26,6 +24,6 @@ func (p *ZFSProvisioner) Delete(ctx context.Context, volume *core.PersistentVolu
return fmt.Errorf("error destroying dataset: %w", err)
}

klog.InfoS("dataset destroyed", "dataset", datasetPath)
p.log.Info("dataset destroyed", "dataset", datasetPath)
return nil
}
4 changes: 2 additions & 2 deletions pkg/provisioner/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v9/controller"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v10/controller"
)

// Provision creates a PersistentVolume, sets quota and shares it via NFS.
Expand Down Expand Up @@ -55,7 +55,7 @@ func (p *ZFSProvisioner) Provision(ctx context.Context, options controller.Provi
if err := p.zfs.SetPermissions(dataset); err != nil {
return nil, controller.ProvisioningFinished, err
}
klog.InfoS("dataset created", "dataset", dataset.Name)
p.log.Info("dataset created", "dataset", dataset.Name)

// Copy the annotations from the claim and overwrite with ours
if options.PVC.Annotations == nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/provisioner/provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v9/controller"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v10/controller"
)

func TestProvisionNfs(t *testing.T) {
Expand Down Expand Up @@ -122,7 +122,7 @@ func TestProvisionHostPath(t *testing.T) {
assert.Contains(t, pv.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions[0].Values, "node")
}

func newClaim(capacity resource.Quantity, accessmodes []v1.PersistentVolumeAccessMode) *v1.PersistentVolumeClaim {
func newClaim(capacity resource.Quantity, accessModes []v1.PersistentVolumeAccessMode) *v1.PersistentVolumeClaim {
storageClassName := "zfs"
claim := &v1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -131,8 +131,8 @@ func newClaim(capacity resource.Quantity, accessmodes []v1.PersistentVolumeAcces
},
},
Spec: v1.PersistentVolumeClaimSpec{
AccessModes: accessmodes,
Resources: v1.ResourceRequirements{
AccessModes: accessModes,
Resources: v1.VolumeResourceRequirements{
Requests: v1.ResourceList{
v1.ResourceStorage: capacity,
},
Expand Down
5 changes: 4 additions & 1 deletion pkg/provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provisioner

import (
"github.com/ccremer/kubernetes-zfs-provisioner/pkg/zfs"
"k8s.io/klog/v2"
)

const (
Expand All @@ -17,13 +18,15 @@ const (
// ZFSProvisioner implements the Provisioner interface to create and export ZFS volumes
type ZFSProvisioner struct {
zfs zfs.Interface
log klog.Logger
InstanceName string
}

// NewZFSProvisioner returns a new ZFSProvisioner based on a given optional
// zap.Logger. If none given, zaps default production logger is used.
func NewZFSProvisioner(instanceName string) (*ZFSProvisioner, error) {
func NewZFSProvisioner(instanceName string, logger klog.Logger) (*ZFSProvisioner, error) {
return &ZFSProvisioner{
log: logger,
zfs: zfs.NewInterface(), InstanceName: instanceName,
}, nil
}
9 changes: 4 additions & 5 deletions test/provision_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build integration
// +build integration

package test

Expand All @@ -21,7 +20,7 @@ import (
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v9/controller"
"sigs.k8s.io/sig-storage-lib-external-provisioner/v10/controller"

"github.com/ccremer/kubernetes-zfs-provisioner/pkg/provisioner"
"github.com/ccremer/kubernetes-zfs-provisioner/pkg/zfs"
Expand Down Expand Up @@ -157,12 +156,12 @@ func assertNfsExport(t *testing.T, fullDataset string) {
assert.True(t, found)
}

func newClaim(capacity resource.Quantity, accessmodes []v1.PersistentVolumeAccessMode) *v1.PersistentVolumeClaim {
func newClaim(capacity resource.Quantity, accessModes []v1.PersistentVolumeAccessMode) *v1.PersistentVolumeClaim {
storageClassName := "zfs"
claim := &v1.PersistentVolumeClaim{
Spec: v1.PersistentVolumeClaimSpec{
AccessModes: accessmodes,
Resources: v1.ResourceRequirements{
AccessModes: accessModes,
Resources: v1.VolumeResourceRequirements{
Requests: v1.ResourceList{
v1.ResourceStorage: capacity,
},
Expand Down

0 comments on commit 9c7ca50

Please sign in to comment.