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

deploy: API for CSI Config Struct #4278

Merged
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
7 changes: 5 additions & 2 deletions api/deploy/kubernetes/cephfs/csi-config-map.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"text/template"

"github.com/ceph/ceph-csi/api/deploy/kubernetes"
nixpanic marked this conversation as resolved.
Show resolved Hide resolved
"github.com/ghodss/yaml"
v1 "k8s.io/api/core/v1"
)
Expand All @@ -30,11 +31,13 @@ import (
var csiConfigMap string

type CSIConfigMapValues struct {
Name string
Name string
ClusterInfo []kubernetes.ClusterInfo
}

var CSIConfigMapDefaults = CSIConfigMapValues{
Name: "ceph-csi-config",
Name: "ceph-csi-config",
ClusterInfo: []kubernetes.ClusterInfo{},
}

// NewCSIConfigMap takes a name from the CSIConfigMapValues struct and relaces
Expand Down
2 changes: 1 addition & 1 deletion api/deploy/kubernetes/cephfs/csi-config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ metadata:
name: "{{ .Name }}"
data:
config.json: |-
[]
{{ .ClusterInfo }}
1 change: 1 addition & 0 deletions api/deploy/kubernetes/cephfs/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ spec:
attachRequired: false
podInfoOnMount: false
fsGroupPolicy: File
seLinuxMount: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A modification to this file should result in updated generated files under deploy/ too.

Copy link
Contributor Author

@iPraveenParihar iPraveenParihar Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seLinuxMount: true was added under deploy/ files here - c0201e4

So, generated files match with the files under deploy/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, interesting! In that case we need to run make deploy in the CI to check that all modified files are included in a PR. When you run make deploy, the seLinuxMount: true option should be removed from the deploy/ directory without your change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, sortof. See this:

$ make -C tools generate-deploy 
make: Entering directory '/var/tmp/ceph-csi/tools'
go run yamlgen/main.go
creating "../deploy/scc.yaml"...done!
creating "../deploy/cephfs/kubernetes/csidriver.yaml"...done!
creating "../deploy/cephfs/kubernetes/csi-config-map.yaml"...done!
creating "../deploy/nfs/kubernetes/csidriver.yaml"...done!
creating "../deploy/nfs/kubernetes/csi-config-map.yaml"...done!
creating "../deploy/rbd/kubernetes/csidriver.yaml"...done!
creating "../deploy/rbd/kubernetes/csi-config-map.yaml"...done!
make: Leaving directory '/var/tmp/ceph-csi/tools'
$ git status
HEAD detached at origin/devel
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   deploy/cephfs/kubernetes/csidriver.yaml
	modified:   deploy/nfs/kubernetes/csidriver.yaml
	modified:   deploy/rbd/kubernetes/csidriver.yaml

no changes added to commit (use "git add" and/or "git commit -a")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, it seems that this is not checked in Ceph-CSI at all now. We need a workflow similar to kubernetes-csi-addons that does this check:

https://github.com/csi-addons/kubernetes-csi-addons/blob/397940a2db2ed4889e10dcaa2be390e6d97e6db3/.github/workflows/test-golang.yaml#L69-L70

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iPraveenParihar do you want to take this on, and create a PR for that? Otherwise we'll need to create it as an issue so that we won't forget it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created Issue - #4285

59 changes: 59 additions & 0 deletions api/deploy/kubernetes/csi-config-map.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright 2023 The Ceph-CSI Authors.

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 kubernetes

type ClusterInfo struct {
// ClusterID is used for unique identification
ClusterID string
// Monitors is monitor list for corresponding cluster ID
Monitors []string
// CephFS contains CephFS specific options
CephFS CephFS
// RBD Contains RBD specific options
RBD RBD
// NFS contains NFS specific options
NFS NFS
// Read affinity map options
ReadAffinity ReadAffinity
}

type CephFS struct {
// symlink filepath for the network namespace where we need to execute commands.
NetNamespaceFilePath string
// SubvolumeGroup contains the name of the SubvolumeGroup for CSI volumes
SubvolumeGroup string
// KernelMountOptions contains the kernel mount options for CephFS volumes
KernelMountOptions string
// FuseMountOptions contains the fuse mount options for CephFS volumes
FuseMountOptions string
}
type RBD struct {
// symlink filepath for the network namespace where we need to execute commands.
NetNamespaceFilePath string
// RadosNamespace is a rados namespace in the pool
RadosNamespace string
}

type NFS struct {
// symlink filepath for the network namespace where we need to execute commands.
NetNamespaceFilePath string
}

type ReadAffinity struct {
Enabled bool
CrushLocationLabels []string
}
7 changes: 5 additions & 2 deletions api/deploy/kubernetes/nfs/csi-config-map.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"text/template"

"github.com/ceph/ceph-csi/api/deploy/kubernetes"
"github.com/ghodss/yaml"
v1 "k8s.io/api/core/v1"
)
Expand All @@ -30,11 +31,13 @@ import (
var csiConfigMap string

type CSIConfigMapValues struct {
Name string
Name string
ClusterInfo []kubernetes.ClusterInfo
}

var CSIConfigMapDefaults = CSIConfigMapValues{
Name: "ceph-csi-config",
Name: "ceph-csi-config",
ClusterInfo: []kubernetes.ClusterInfo{},
}

// NewCSIConfigMap takes a name from the CSIConfigMapValues struct and relaces
Expand Down
2 changes: 1 addition & 1 deletion api/deploy/kubernetes/nfs/csi-config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ metadata:
name: "{{ .Name }}"
data:
config.json: |-
[]
{{ .ClusterInfo }}
1 change: 1 addition & 0 deletions api/deploy/kubernetes/nfs/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ metadata:
spec:
attachRequired: false
fsGroupPolicy: File
seLinuxMount: true
volumeLifecycleModes:
- Persistent
7 changes: 5 additions & 2 deletions api/deploy/kubernetes/rbd/csi-config-map.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"text/template"

"github.com/ceph/ceph-csi/api/deploy/kubernetes"
"github.com/ghodss/yaml"
v1 "k8s.io/api/core/v1"
)
Expand All @@ -30,11 +31,13 @@ import (
var csiConfigMap string

type CSIConfigMapValues struct {
Name string
Name string
ClusterInfo []kubernetes.ClusterInfo
}

var CSIConfigMapDefaults = CSIConfigMapValues{
Name: "ceph-csi-config",
Name: "ceph-csi-config",
ClusterInfo: []kubernetes.ClusterInfo{},
}

// NewCSIConfigMap takes a name from the CSIConfigMapValues struct and relaces
Expand Down
2 changes: 1 addition & 1 deletion api/deploy/kubernetes/rbd/csi-config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ metadata:
name: "{{ .Name }}"
data:
config.json: |-
[]
{{ .ClusterInfo }}
1 change: 1 addition & 0 deletions api/deploy/kubernetes/rbd/csidriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ metadata:
spec:
attachRequired: true
podInfoOnMount: false
seLinuxMount: true
fsGroupPolicy: File

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/ceph/ceph-csi/api/deploy/kubernetes/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ github.com/cenkalti/backoff/v3
github.com/cenkalti/backoff/v4
# github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000 => ./api
## explicit; go 1.18
github.com/ceph/ceph-csi/api/deploy/kubernetes
github.com/ceph/ceph-csi/api/deploy/kubernetes/cephfs
github.com/ceph/ceph-csi/api/deploy/kubernetes/nfs
github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd
Expand Down