-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2204 from raaizik/sp-414
Transforms StorageProfile array into a set of CRs
- Loading branch information
Showing
21 changed files
with
629 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
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 ( | ||
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 | ||
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.deviceClass) || has(self.deviceClass)", message="deviceClass is required once set" | ||
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.sharedFilesystemConfiguration) || has(self.sharedFilesystemConfiguration)", message="sharedFilesystemConfiguration is required once set" | ||
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.blockPoolConfiguration) || has(self.blockPoolConfiguration)", message="blockPoolConfiguration is required once set" | ||
type StorageProfileSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="DeviceClass is immutable" | ||
// +kubebuilder:validation:MaxLength=512 | ||
// DeviceClass is the deviceclass name. | ||
DeviceClass string `json:"deviceClass"` | ||
|
||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="SharedFilesystemConfiguration is immutable" | ||
// configurations to use for cephfilesystem. | ||
SharedFilesystemConfiguration SharedFilesystemConfigurationSpec `json:"sharedFilesystemConfiguration,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="BlockPoolConfiguration is immutable" | ||
// configurations to use for profile specific blockpool. | ||
BlockPoolConfiguration BlockPoolConfigurationSpec `json:"blockPoolConfiguration,omitempty"` | ||
} | ||
|
||
// StorageProfileStatus defines the observed state of StorageProfile | ||
type StorageProfileStatus struct { | ||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// 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"` | ||
|
||
Spec StorageProfileSpec `json:"spec,omitempty"` | ||
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 ( | ||
StorageProfilePhaseFailed StorageProfilePhase = "Failed" | ||
StorageProfilePhaseReady StorageProfilePhase = "Ready" | ||
StorageProfilePhaseRejected StorageProfilePhase = "Rejected" | ||
) | ||
|
||
func init() { | ||
SchemeBuilder.Register(&StorageProfile{}, &StorageProfileList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,87 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.2 | ||
creationTimestamp: null | ||
name: storageprofiles.ocs.openshift.io | ||
spec: | ||
group: ocs.openshift.io | ||
names: | ||
kind: StorageProfile | ||
listKind: StorageProfileList | ||
plural: storageprofiles | ||
singular: storageprofile | ||
scope: Namespaced | ||
versions: | ||
- name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
description: StorageProfile is the Schema for the storageprofiles API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: StorageProfileSpec defines the desired state of StorageProfile | ||
properties: | ||
blockPoolConfiguration: | ||
description: configurations to use for profile specific blockpool. | ||
properties: | ||
parameters: | ||
additionalProperties: | ||
type: string | ||
type: object | ||
type: object | ||
x-kubernetes-validations: | ||
- message: BlockPoolConfiguration is immutable | ||
rule: self == oldSelf | ||
deviceClass: | ||
description: DeviceClass is the deviceclass name. | ||
maxLength: 512 | ||
type: string | ||
x-kubernetes-validations: | ||
- message: DeviceClass is immutable | ||
rule: self == oldSelf | ||
sharedFilesystemConfiguration: | ||
description: configurations to use for cephfilesystem. | ||
properties: | ||
parameters: | ||
additionalProperties: | ||
type: string | ||
type: object | ||
type: object | ||
x-kubernetes-validations: | ||
- message: SharedFilesystemConfiguration is immutable | ||
rule: self == oldSelf | ||
type: object | ||
x-kubernetes-validations: | ||
- message: deviceClass is required once set | ||
rule: '!has(oldSelf.deviceClass) || has(self.deviceClass)' | ||
- message: sharedFilesystemConfiguration is required once set | ||
rule: '!has(oldSelf.sharedFilesystemConfiguration) || has(self.sharedFilesystemConfiguration)' | ||
- message: blockPoolConfiguration is required once set | ||
rule: '!has(oldSelf.blockPoolConfiguration) || has(self.blockPoolConfiguration)' | ||
status: | ||
description: StorageProfileStatus defines the observed state of StorageProfile | ||
properties: | ||
phase: | ||
description: Phase describes the Phase of StorageProfile This is used | ||
by OLM UI to provide status information to the user | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
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,8 @@ | ||
# The following patch adds a directive for certmanager to inject CA into the CRD | ||
# CRD conversion requires k8s 1.13 or later. | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) | ||
name: storageprofiles.ocs.openshift.io |
Oops, something went wrong.