-
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: Matt Richerson <[email protected]>
- Loading branch information
1 parent
ff88eaf
commit ceb6524
Showing
32 changed files
with
2,100 additions
and
1,016 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
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
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
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,120 @@ | ||
/* | ||
* Copyright 2021-2023 Hewlett Packard Enterprise Development LP | ||
* Other additional copyright holders may be indicated within. | ||
* | ||
* The entirety of this work is 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 ( | ||
dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2" | ||
"github.com/DataWorkflowServices/dws/utils/updater" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type NnfNodeBlockStorageAllocationSpec struct { | ||
Capacity int64 `json:"capacity,omitempty"` | ||
|
||
Access []string `json:"access,omitempty"` | ||
} | ||
|
||
// NnfNodeBlockStorageSpec defines the desired storage attributes on a NNF Node. | ||
// Storage spec are created on bequest of the user and fullfilled by the NNF Node Controller. | ||
type NnfNodeBlockStorageSpec struct { | ||
Allocations []NnfNodeBlockStorageAllocationSpec `json:"allocations,omitempty"` | ||
} | ||
|
||
type NnfNodeBlockStorageStatus struct { | ||
// Allocations is the list of storage allocations that were made | ||
Allocations []NnfNodeBlockStorageAllocationStatus `json:"allocations,omitempty"` | ||
|
||
dwsv1alpha2.ResourceError `json:",inline"` | ||
|
||
Ready bool `json:"ready"` | ||
} | ||
|
||
type NnfNodeBlockStorageDeviceStatus struct { | ||
// NQN of the base NVMe device | ||
NQN string `json:"NQN"` | ||
|
||
// Id of the Namespace on the NVMe device (e.g., "2") | ||
NamespaceId string `json:"namespaceId"` | ||
|
||
// Total capacity allocated for the storage. This may differ from the requested storage | ||
// capacity as the system may round up to the requested capacity satisify underlying | ||
// storage requirements (i.e. block size / stripe size). | ||
CapacityAllocated int64 `json:"capacityAllocated,omitempty"` | ||
} | ||
|
||
type NnfNodeBlockStorageAccessStatus struct { | ||
DevicePaths []string `json:"devicePaths,omitempty"` | ||
|
||
StorageGroupId string `json:"storageGroupId,omitempty"` | ||
} | ||
|
||
type NnfNodeBlockStorageAllocationStatus struct { | ||
Accesses map[string]NnfNodeBlockStorageAccessStatus `json:"accesses,omitempty"` | ||
|
||
// List of NVMe namespaces used by this allocation | ||
Devices []NnfNodeBlockStorageDeviceStatus `json:"devices,omitempty"` | ||
|
||
// Total capacity allocated for the storage. This may differ from the requested storage | ||
// capacity as the system may round up to the requested capacity satisify underlying | ||
// storage requirements (i.e. block size / stripe size). | ||
CapacityAllocated int64 `json:"capacityAllocated,omitempty"` | ||
|
||
StoragePoolId string `json:"storagePoolId,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
type NnfNodeBlockStorage struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NnfNodeBlockStorageSpec `json:"spec,omitempty"` | ||
Status NnfNodeBlockStorageStatus `json:"status,omitempty"` | ||
} | ||
|
||
func (ns *NnfNodeBlockStorage) GetStatus() updater.Status[*NnfNodeBlockStorageStatus] { | ||
return &ns.Status | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:printcolumn:name="ERROR",type="string",JSONPath=".status.error.severity" | ||
//+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" | ||
|
||
// NnfNodeBlockStorageList contains a list of NNF Nodes | ||
type NnfNodeBlockStorageList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NnfNodeBlockStorage `json:"items"` | ||
} | ||
|
||
func (n *NnfNodeBlockStorageList) GetObjectList() []client.Object { | ||
objectList := []client.Object{} | ||
|
||
for i := range n.Items { | ||
objectList = append(objectList, &n.Items[i]) | ||
} | ||
|
||
return objectList | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&NnfNodeBlockStorage{}, &NnfNodeBlockStorageList{}) | ||
} |
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
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
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
Oops, something went wrong.