Skip to content

Commit

Permalink
Changes (#3)
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Zimin <[email protected]>
  • Loading branch information
AleksZimin authored Jul 1, 2024
1 parent 3d4de2a commit fb237a4
Show file tree
Hide file tree
Showing 39 changed files with 2,596 additions and 3,659 deletions.
17 changes: 17 additions & 0 deletions crds/huaweistorageconnection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,25 @@ spec:
spec:
type: object
required:
- storageType
- pools
- urls
- login
- password
- protocol
- maxClientThreads
properties:
storageType:
type: string
x-kubernetes-validations:
- rule: self == oldSelf
message: "The storageType field is immutable."
enum:
- OceanStorSAN
- OceanStorNAS
- OceanStorDtree
- FusionStorageSAN
- FusionStorageNAS
pools:
type: array
items:
Expand All @@ -57,8 +69,13 @@ spec:
- FC
- ROCE
- FC-NVME
- NFS
- DPC
- SCSI
portals:
type: array
items:
type: string
maxClientThreads:
type: integer
x-kubernetes-validations:
Expand Down
32 changes: 32 additions & 0 deletions docs/EXAMPLES_RU.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "Модуль csi-huawei: примеры"
---

## Пример описания `HuaweiStorageConnection`

```yaml
apiVersion: storage.deckhouse.io/v1alpha1
kind: HuaweiStorageConnection
metadata:
name: hs-1
spec:
storageType: OceanStorSAN
pools:
- storage-pool-1
- storage-pool-2
urls:
- 172.22.1.10
- 172.22.1.11
login: "user-1"
password: "secret-password"
protocol: ISCSI
portals:
- portal1
maxClientThreads: 30
```
- Проверить создание объекта можно командой (Phase должен быть `Created`):

```shell
kubectl get huaweistorageconnection <имя cephclusterconnection>
```
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
Copyright 2024 Flant JSC
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 v1alpha1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

const (
HuaweiStorageConnectionProtocolISCSI = "ISCSI"
HuaweiStorageConnectionProtocolFC = "FC"
HuaweiStorageConnectionProtocolROCE = "ROCE"
HuaweiStorageConnectionProtocolFCnvme = "FC-NVME"
HuaweiStorageConnectionProtocolNFS = "NFS"
HuaweiStorageConnectionProtocolDPC = "DPC"
HuaweiStorageConnectionProtocolSCSI = "SCSI"

HuaweiStorageConnectionStorageTypeOceanStorSAN = "OceanStorSAN"
HuaweiStorageConnectionStorageTypeOceanStorNAS = "OceanStorNAS"
HuaweiStorageConnectionStorageTypeOceanStorDtree = "OceanStorDtree"
HuaweiStorageConnectionStorageTypeFusionStorageSAN = "FusionStorageSAN"
HuaweiStorageConnectionStorageTypeFusionStorageNAS = "FusionStorageNAS"
)

var (
HuaweiStorageConnectionProtocols = []string{
HuaweiStorageConnectionProtocolISCSI,
HuaweiStorageConnectionProtocolFC,
HuaweiStorageConnectionProtocolROCE,
HuaweiStorageConnectionProtocolFCnvme,
HuaweiStorageConnectionProtocolDPC,
HuaweiStorageConnectionProtocolSCSI,
}

HuaweiStorageProtocolMapping = map[string]string{
HuaweiStorageConnectionProtocolISCSI: "iscsi",
HuaweiStorageConnectionProtocolFC: "fc",
HuaweiStorageConnectionProtocolROCE: "roce",
HuaweiStorageConnectionProtocolFCnvme: "fc-nvme",
HuaweiStorageConnectionProtocolNFS: "nfs",
HuaweiStorageConnectionProtocolDPC: "dpc",
HuaweiStorageConnectionProtocolSCSI: "scsi",
}

HuaweiStorageConnectionStorageTypes = []string{
HuaweiStorageConnectionStorageTypeOceanStorSAN,
HuaweiStorageConnectionStorageTypeOceanStorNAS,
HuaweiStorageConnectionStorageTypeOceanStorDtree,
HuaweiStorageConnectionStorageTypeFusionStorageSAN,
HuaweiStorageConnectionStorageTypeFusionStorageNAS,
}

HuaweiStorageTypeMapping = map[string]string{
HuaweiStorageConnectionStorageTypeOceanStorSAN: "oceanstor-san",
HuaweiStorageConnectionStorageTypeOceanStorNAS: "oceanstor-nas",
HuaweiStorageConnectionStorageTypeOceanStorDtree: "oceanstor-dtree",
HuaweiStorageConnectionStorageTypeFusionStorageSAN: "fusionstorage-san",
HuaweiStorageConnectionStorageTypeFusionStorageNAS: "fusionstorage-nas",
}
)

type HuaweiStorageConnection struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec HuaweiStorageConnectionSpec `json:"spec"`
Status *HuaweiStorageConnectionStatus `json:"status,omitempty"`
}

// HuaweiStorageConnectionList contains a list of empty block device
type HuaweiStorageConnectionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []HuaweiStorageConnection `json:"items"`
}

type HuaweiStorageConnectionSpec struct {
StorageType string `json:"storageType"`
Pools []string `json:"pools"`
URLs []string `json:"urls"`
Login string `json:"login"`
Password string `json:"password"`
Protocol string `json:"protocol"`
Portals []string `json:"portals"`
MaxClientThreads int `json:"maxClientThreads"`
}

type HuaweiStorageConnectionStatus struct {
Phase string `json:"phase,omitempty"`
Reason string `json:"reason,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
Copyright 2024 Flant JSC
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 v1alpha1

type HuaweiCSIConfigMapData struct {
Backends Backend `json:"backends"`
}

type Backend struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Storage string `json:"storage"`
URLs []string `json:"urls"`
Pools []string `json:"pools"`
MaxClientThreads string `json:"maxClientThreads"`
Provisioner string `json:"provisioner"`
Parameters BackendParameters `json:"parameters"`
}

type BackendParameters struct {
Protocol string `json:"protocol"`
Portals []string `json:"portals,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
)

const (
CephStorageClassKind = "CephStorageClass"
APIGroup = "storage.deckhouse.io"
APIVersion = "v1alpha1"
HuaweiStorageConnectionKind = "HuaweiStorageConnection"
APIGroup = "storage.deckhouse.io"
APIVersion = "v1alpha1"
)

// SchemeGroupVersion is group version used to register these objects
Expand All @@ -41,12 +41,8 @@ var (
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CephStorageClass{},
&CephStorageClassList{},
&CephClusterConnection{},
&CephClusterConnectionList{},
&CephClusterAuthentication{},
&CephClusterAuthenticationList{},
&HuaweiStorageConnection{},
&HuaweiStorageConnectionList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
Copyright 2024 Flant JSC
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 v1alpha1

import "k8s.io/apimachinery/pkg/runtime"

// HuaweiStorageConnection

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HuaweiStorageConnection) DeepCopyInto(out *HuaweiStorageConnection) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)

}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice.
func (in *HuaweiStorageConnection) DeepCopy() *HuaweiStorageConnection {
if in == nil {
return nil
}
out := new(HuaweiStorageConnection)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HuaweiStorageConnection) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HuaweiStorageConnectionList) DeepCopyInto(out *HuaweiStorageConnectionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]HuaweiStorageConnection, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList.
func (in *HuaweiStorageConnectionList) DeepCopy() *HuaweiStorageConnectionList {
if in == nil {
return nil
}
out := new(HuaweiStorageConnectionList)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HuaweiStorageConnectionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
44 changes: 0 additions & 44 deletions images/controller/src/api/v1alpha1/ceph_cluster_authentication.go

This file was deleted.

Loading

0 comments on commit fb237a4

Please sign in to comment.