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

Syncing latest changes from upstream devel for ceph-csi #460

Merged
merged 13 commits into from
Jan 29, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/snyk-container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ jobs:
args: --file=./deploy/cephcsi/image/Dockerfile
- name: Upload result to GitHub Code Scanning
# yamllint disable-line rule:line-length
uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
uses: github/codeql-action/upload-sarif@4e83f6b818d7c9f52143570963b2c7f7f055decb # v3.28.6
with:
sarif_file: snyk.sarif
2 changes: 1 addition & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
if: github.repository == 'ceph/ceph-csi'
steps:
# yamllint disable-line rule:line-length
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 30
Expand Down
40 changes: 12 additions & 28 deletions charts/ceph-csi-cephfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,19 @@ cd charts

### Install Chart

To install the Chart into your Kubernetes cluster
To install the Chart into your Kubernetes cluster(For helm 3.x):

- For helm 2.x
Create the namespace where Helm should install the components with

```bash
helm install --namespace "ceph-csi-cephfs" --name "ceph-csi-cephfs" ceph-csi/ceph-csi-cephfs
```

- For helm 3.x

Create the namespace where Helm should install the components with

```bash
kubectl create namespace ceph-csi-cephfs
```
```bash
kubectl create namespace ceph-csi-cephfs
```

Run the installation
Run the installation

```bash
helm install --namespace "ceph-csi-cephfs" "ceph-csi-cephfs" ceph-csi/ceph-csi-cephfs
```
```bash
helm install --namespace "ceph-csi-cephfs" "ceph-csi-cephfs" ceph-csi/ceph-csi-cephfs
```

After installation succeeds, you can get a status of Chart

Expand Down Expand Up @@ -111,17 +103,9 @@ permissions will be granted globally via a *ClusterRole*.

If you want to delete your Chart, use this command

- For helm 2.x

```bash
helm delete --purge "ceph-csi-cephfs"
```

- For helm 3.x

```bash
helm uninstall "ceph-csi-cephfs" --namespace "ceph-csi-cephfs"
```
```bash
helm uninstall "ceph-csi-cephfs" --namespace "ceph-csi-cephfs"
```

If you want to delete the namespace, use this command

Expand Down
40 changes: 12 additions & 28 deletions charts/ceph-csi-rbd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,19 @@ cd charts

### Install chart

To install the Chart into your Kubernetes cluster
To install the Chart into your Kubernetes cluster(For helm 3.x):

- For helm 2.x
Create the namespace where Helm should install the components with

```bash
helm install --namespace "ceph-csi-rbd" --name "ceph-csi-rbd" ceph-csi/ceph-csi-rbd
```

- For helm 3.x

Create the namespace where Helm should install the components with

```bash
kubectl create namespace "ceph-csi-rbd"
```
```bash
kubectl create namespace "ceph-csi-rbd"
```

Run the installation
Run the installation

```bash
helm install --namespace "ceph-csi-rbd" "ceph-csi-rbd" ceph-csi/ceph-csi-rbd
```
```bash
helm install --namespace "ceph-csi-rbd" "ceph-csi-rbd" ceph-csi/ceph-csi-rbd
```

After installation succeeds, you can get a status of Chart

Expand Down Expand Up @@ -84,17 +76,9 @@ compare your currently used values with the new default values.

If you want to delete your Chart, use this command

- For helm 2.x

```bash
helm delete --purge "ceph-csi-rbd"
```

- For helm 3.x

```bash
helm uninstall "ceph-csi-rbd" --namespace "ceph-csi-rbd"
```
```bash
helm uninstall "ceph-csi-rbd" --namespace "ceph-csi-rbd"
```

If you want to delete the namespace, use this command

Expand Down
6 changes: 6 additions & 0 deletions charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "create", "update"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumegroupreplicationcontents"]
verbs: ["get", "list", "watch"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumegroupreplicationclasses"]
verbs: ["get", "list", "watch"]
{{- if .Values.provisioner.attacher.enabled }}
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
Expand Down
2 changes: 2 additions & 0 deletions cmd/cephcsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/ceph/ceph-csi/internal/cephfs"
"github.com/ceph/ceph-csi/internal/controller"
"github.com/ceph/ceph-csi/internal/controller/persistentvolume"
"github.com/ceph/ceph-csi/internal/controller/volumegroup"
"github.com/ceph/ceph-csi/internal/liveness"
nfsdriver "github.com/ceph/ceph-csi/internal/nfs/driver"
rbddriver "github.com/ceph/ceph-csi/internal/rbd/driver"
Expand Down Expand Up @@ -294,6 +295,7 @@ func setPIDLimit(conf *util.Config) {
func initControllers() {
// Add list of controller here.
persistentvolume.Init()
volumegroup.Init()
}

func validateCloneDepthFlag(conf *util.Config) {
Expand Down
6 changes: 6 additions & 0 deletions deploy/rbd/kubernetes/csi-provisioner-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ rules:
- apiGroups: ["groupsnapshot.storage.k8s.io"]
resources: ["volumegroupsnapshotcontents/status"]
verbs: ["update", "patch"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumegroupreplicationcontents"]
verbs: ["get", "list", "watch"]
- apiGroups: ["replication.storage.openshift.io"]
resources: ["volumegroupreplicationclasses"]
verbs: ["get"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
golang.org/x/net v0.34.0
golang.org/x/sys v0.29.0
google.golang.org/grpc v1.69.4
google.golang.org/protobuf v1.36.3
google.golang.org/protobuf v1.36.4
//
// when updating k8s.io/kubernetes, make sure to update the replace section too
//
Expand All @@ -48,6 +48,7 @@ require (
require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.0
github.com/csi-addons/kubernetes-csi-addons v0.9.0
)

require (
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/csi-addons/kubernetes-csi-addons v0.9.0 h1:Hhb44WcrxtbzmpLY+uqX+DBWCI6HgA/rwQMPyvsyCc8=
github.com/csi-addons/kubernetes-csi-addons v0.9.0/go.mod h1:/YROZDdEi1N/1Ls9rdU5W2VNjm8MK7HHApl8W4Sqt9s=
github.com/csi-addons/spec v0.2.1-0.20241104111131-27825f744db5 h1:j9NaWj5KmzEVarmsjxS/NDAhes6Uzq1qhkUGHvDlVBk=
github.com/csi-addons/spec v0.2.1-0.20241104111131-27825f744db5/go.mod h1:Mwq4iLiUV4s+K1bszcWU6aMsR5KPsbIYzzszJ6+56vI=
github.com/cyphar/filepath-securejoin v0.3.4 h1:VBWugsJh2ZxJmLFSM06/0qzQyiQX2Qs0ViKrUAcqdZ8=
Expand Down Expand Up @@ -3478,8 +3480,8 @@ google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHh
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion internal/cephfs/store/volumegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func ReserveVolumeGroup(
defer j.Destroy()

groupUUID, vgsi.FsVolumeGroupSnapshotName, err = j.ReserveName(
ctx, volOptions.MetadataPool, volOptions.RequestName, volOptions.NamePrefix)
ctx, volOptions.MetadataPool, volOptions.RequestName, volOptions.ReservedID, volOptions.NamePrefix)
if err != nil {
return nil, err
}
Expand Down
11 changes: 9 additions & 2 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import (

"github.com/ceph/ceph-csi/internal/util/log"

"k8s.io/apimachinery/pkg/runtime"
replicationv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1"
apiruntime "k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/leaderelection/resourcelock"
clientConfig "sigs.k8s.io/controller-runtime/pkg/client/config"
Expand Down Expand Up @@ -62,6 +65,9 @@ func addToManager(mgr manager.Manager, config Config) error {

// Start will start all the registered managers.
func Start(config Config) error {
scheme := apiruntime.NewScheme()
utilruntime.Must(replicationv1alpha1.AddToScheme(scheme))
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
electionID := config.DriverName + "-" + config.Namespace
opts := manager.Options{
LeaderElection: true,
Expand All @@ -70,11 +76,12 @@ func Start(config Config) error {
LeaderElectionNamespace: config.Namespace,
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
LeaderElectionID: electionID,
Scheme: scheme,
}

kubeConfig := clientConfig.GetConfigOrDie()
coreKubeConfig := rest.CopyConfig(kubeConfig)
coreKubeConfig.ContentType = runtime.ContentTypeProtobuf
coreKubeConfig.ContentType = apiruntime.ContentTypeProtobuf
mgr, err := manager.New(coreKubeConfig, opts)
if err != nil {
log.ErrorLogMsg("failed to create manager %s", err)
Expand Down
Loading