Skip to content

Commit

Permalink
deploy: API for CSI Config Struct
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar committed Nov 22, 2023
1 parent aa55317 commit 18a147c
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 18 deletions.
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"
"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 }}"
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 }}"
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 }}"

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.

21 changes: 21 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.

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

0 comments on commit 18a147c

Please sign in to comment.