Skip to content

Commit

Permalink
Merge pull request #2276 from red-hat-storage/fusion-hci-4.14
Browse files Browse the repository at this point in the history
Bug 2248449: Fusion HCI integration changes for OCS operator [4.14 Backport]
  • Loading branch information
openshift-merge-bot[bot] authored Nov 21, 2023
2 parents 3068b47 + b6e5bba commit 5d11be1
Show file tree
Hide file tree
Showing 53 changed files with 1,294 additions and 373 deletions.
18 changes: 2 additions & 16 deletions api/v1/storagecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,15 @@ type StorageClusterSpec struct {
// DefaultStorageProfile is the default storage profile to use for
// the storageclassrequest as StorageProfile is optional.
DefaultStorageProfile string `json:"defaultStorageProfile,omitempty"`

StorageProfiles []StorageProfile `json:"storageProfiles,omitempty"`
}

// StorageProfile is the storage profile to use for the storageclassrequest.
type StorageProfile struct {
// +kubebuilder:validation:Required
// Name of the storage profile.
Name string `json:"name"`
// +kubebuilder:validation:Required
// DeviceClass is the deviceclass name.
DeviceClass string `json:"deviceClass"`
// configurations to use for cephfilesystem.
SharedFilesystemConfiguration SharedFilesystemConfigurationSpec `json:"sharedFilesystemConfiguration,omitempty"`
// configurations to use for profile specific blockpool.
BlockPoolConfiguration BlockPoolConfigurationSpec `json:"blockPoolConfiguration,omitempty"`
}

type SharedFilesystemConfigurationSpec struct {
// +kubebuilder:validation:Optional
Parameters map[string]string `json:"parameters,omitempty"`
}

type BlockPoolConfigurationSpec struct {
// +kubebuilder:validation:Optional
Parameters map[string]string `json:"parameters,omitempty"`
}

Expand Down
97 changes: 97 additions & 0 deletions api/v1/storageprofile_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
Copyright 2020 Red Hat OpenShift Container Storage.
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 v1

import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"

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

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// StorageProfileSpec defines the desired state of StorageProfile
type StorageProfileSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:MaxLength=512
// DeviceClass is the deviceclass name.
DeviceClass string `json:"deviceClass"`

// +kubebuilder:validation:Optional
// configurations to use for cephfilesystem.
SharedFilesystemConfiguration SharedFilesystemConfigurationSpec `json:"sharedFilesystemConfiguration,omitempty"`

// +kubebuilder:validation:Optional
// configurations to use for profile specific blockpool.
BlockPoolConfiguration BlockPoolConfigurationSpec `json:"blockPoolConfiguration,omitempty"`
}

// StorageProfileStatus defines the observed state of StorageProfile
type StorageProfileStatus struct {
// Phase describes the Phase of StorageProfile
// This is used by OLM UI to provide status information
// to the user
Phase StorageProfilePhase `json:"phase,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// StorageProfile is the Schema for the storageprofiles API
type StorageProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="oldSelf == self",message="spec is immutable"
Spec StorageProfileSpec `json:"spec"`
Status StorageProfileStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// StorageProfileList contains a list of StorageProfile
type StorageProfileList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []StorageProfile `json:"items"`
}

// StorageProfilePhase stores a StorageProfile reconciliation phase
type StorageProfilePhase string

const (
StorageProfilePhaseRejected StorageProfilePhase = "Rejected"
)

func init() {
SchemeBuilder.Register(&StorageProfile{}, &StorageProfileList{})
}

func (sp *StorageProfile) GetSpecHash() string {
specJSON, err := json.Marshal(sp.Spec)
if err != nil {
errStr := fmt.Errorf("failed to marshal StorageProfile.Spec for %s", sp.Name)
panic(errStr)
}
specHash := md5.Sum(specJSON)
return hex.EncodeToString(specHash[:])
}
85 changes: 76 additions & 9 deletions api/v1/zz_generated.deepcopy.go

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

10 changes: 10 additions & 0 deletions api/v1alpha1/storageconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ type StorageConsumerStatus struct {
CephResources []*CephResourcesSpec `json:"cephResources,omitempty"`
// Timestamp of last heartbeat received from consumer
LastHeartbeat metav1.Time `json:"lastHeartbeat,omitempty"`
// Information of storage client received from consumer
Client ClientStatus `json:"client,omitempty"`
}

// ClientStatus is the information pushed from connected storage client
type ClientStatus struct {
// StorageClient Platform Version
PlatformVersion string `json:"platformVersion"`
// StorageClient Operator Version
OperatorVersion string `json:"operatorVersion"`
}

//+kubebuilder:object:root=true
Expand Down
16 changes: 16 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

32 changes: 0 additions & 32 deletions config/crd/bases/ocs.openshift.io_storageclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6225,38 +6225,6 @@ spec:
- name
type: object
type: array
storageProfiles:
items:
description: StorageProfile is the storage profile to use for the
storageclassrequest.
properties:
blockPoolConfiguration:
description: configurations to use for profile specific blockpool.
properties:
parameters:
additionalProperties:
type: string
type: object
type: object
deviceClass:
description: DeviceClass is the deviceclass name.
type: string
name:
description: Name of the storage profile.
type: string
sharedFilesystemConfiguration:
description: configurations to use for cephfilesystem.
properties:
parameters:
additionalProperties:
type: string
type: object
type: object
required:
- deviceClass
- name
type: object
type: array
version:
description: Version specifies the version of StorageCluster
type: string
Expand Down
13 changes: 13 additions & 0 deletions config/crd/bases/ocs.openshift.io_storageconsumers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ spec:
type: string
type: object
type: array
client:
description: Information of storage client received from consumer
properties:
operatorVersion:
description: StorageClient Operator Version
type: string
platformVersion:
description: StorageClient Platform Version
type: string
required:
- operatorVersion
- platformVersion
type: object
lastHeartbeat:
description: Timestamp of last heartbeat received from consumer
format: date-time
Expand Down
Loading

0 comments on commit 5d11be1

Please sign in to comment.