-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
- Loading branch information
1 parent
c3983eb
commit 67e5f8e
Showing
31 changed files
with
3,701 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: huaweistorageconnections.storage.deckhouse.io | ||
labels: | ||
heritage: deckhouse | ||
module: csi-ceph | ||
spec: | ||
group: storage.deckhouse.io | ||
scope: Cluster | ||
names: | ||
plural: huaweistorageconnections | ||
singular: huaweistorageconnection | ||
kind: HuaweiStorageConnection | ||
preserveUnknownFields: false | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
storage: true | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
description: | | ||
Huawei storage connection parameters. | ||
required: | ||
- spec | ||
properties: | ||
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: | ||
type: string | ||
urls: | ||
type: array | ||
items: | ||
type: string | ||
login: | ||
type: string | ||
password: | ||
type: string | ||
protocol: | ||
type: string | ||
x-kubernetes-validations: | ||
- rule: self == oldSelf | ||
message: "The protocol field is immutable." | ||
enum: | ||
- ISCSI | ||
- FC | ||
- ROCE | ||
- FC-NVME | ||
- NFS | ||
- DPC | ||
- SCSI | ||
portals: | ||
type: array | ||
items: | ||
type: string | ||
maxClientThreads: | ||
type: integer | ||
x-kubernetes-validations: | ||
- rule: self == oldSelf | ||
message: "The maxClientThreads field is immutable." | ||
status: | ||
type: object | ||
description: | | ||
Displays current information about the resources managed by the HuaweiStorageConnection custom resource. | ||
properties: | ||
phase: | ||
type: string | ||
description: | | ||
The current state of resources managed by the HuaweiStorageConnection custom resource. Might be: | ||
- Failed (if the controller received incorrect resource configuration or some errors occurred during the operation) | ||
- Created (if everything went fine) | ||
enum: | ||
- Failed | ||
- Created | ||
reason: | ||
type: string | ||
description: | | ||
Additional information about the resources managed by the HuaweiStorageConnection custom resource. | ||
subresources: | ||
status: {} | ||
additionalPrinterColumns: | ||
- jsonPath: .status.phase | ||
name: Phase | ||
type: string | ||
- jsonPath: .status.reason | ||
name: Reason | ||
type: string | ||
priority: 1 | ||
- jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
description: The age of this resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
``` |
22 changes: 22 additions & 0 deletions
22
images/controller/src/api/storage.deckhouse.io/v1alpha1/const.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
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 | ||
|
||
const ( | ||
PhaseFailed = "Failed" | ||
PhaseCreated = "Created" | ||
) |
102 changes: 102 additions & 0 deletions
102
images/controller/src/api/storage.deckhouse.io/v1alpha1/huawei_storage_connection.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
} |
37 changes: 37 additions & 0 deletions
37
images/controller/src/api/storage.deckhouse.io/v1alpha1/json_schemas.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
} |
49 changes: 49 additions & 0 deletions
49
images/controller/src/api/storage.deckhouse.io/v1alpha1/register.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
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" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
const ( | ||
HuaweiStorageConnectionKind = "HuaweiStorageConnection" | ||
APIGroup = "storage.deckhouse.io" | ||
APIVersion = "v1alpha1" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var ( | ||
SchemeGroupVersion = schema.GroupVersion{ | ||
Group: APIGroup, | ||
Version: APIVersion, | ||
} | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&HuaweiStorageConnection{}, | ||
&HuaweiStorageConnectionList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
Oops, something went wrong.