-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
controllers: add StorageClassClaim api and controller
Signed-off-by: Jose A. Rivera <[email protected]>
- Loading branch information
Showing
15 changed files
with
975 additions
and
3 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,81 @@ | ||
/* | ||
Copyright 2020 Red Hat, Inc. | ||
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" | ||
) | ||
|
||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// StorageClassClaimSpec defines the desired state of StorageClassClaim | ||
type StorageClassClaimSpec struct { | ||
//+kubebuilder:validation:Enum=blockpool;sharedfilesystem | ||
Type string `json:"type"` | ||
EncryptionMethod string `json:"encryptionMethod,omitempty"` | ||
} | ||
|
||
type storageClassClaimState string | ||
|
||
const ( | ||
// StorageClassClaimInitializing represents Initializing state of StorageClassClaim | ||
StorageClassClaimInitializing storageClassClaimState = "Initializing" | ||
// StorageClassClaimValidating represents Validating state of StorageClassClaim | ||
StorageClassClaimValidating storageClassClaimState = "Validating" | ||
// StorageClassClaimFailed represents Failed state of StorageClassClaim | ||
StorageClassClaimFailed storageClassClaimState = "Failed" | ||
// StorageClassClaimCreating represents Configuring state of StorageClassClaim | ||
StorageClassClaimCreating storageClassClaimState = "Creating" | ||
// StorageClassClaimConfiguring represents Configuring state of StorageClassClaim | ||
StorageClassClaimConfiguring storageClassClaimState = "Configuring" | ||
// StorageClassClaimReady represents Ready state of StorageClassClaim | ||
StorageClassClaimReady storageClassClaimState = "Ready" | ||
// StorageClassClaimDeleting represents Deleting state of StorageClassClaim | ||
StorageClassClaimDeleting storageClassClaimState = "Deleting" | ||
) | ||
|
||
// StorageClassClaimStatus defines the observed state of StorageClassClaim | ||
type StorageClassClaimStatus struct { | ||
Phase storageClassClaimState `json:"phase,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="StorageType",type="string",JSONPath=".spec.type" | ||
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase" | ||
|
||
// StorageClassClaim is the Schema for the storageclassclaims API | ||
type StorageClassClaim struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec StorageClassClaimSpec `json:"spec,omitempty"` | ||
Status StorageClassClaimStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// StorageClassClaimList contains a list of StorageClassClaim | ||
type StorageClassClaimList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []StorageClassClaim `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&StorageClassClaim{}, &StorageClassClaimList{}) | ||
} |
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,70 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.4.1 | ||
creationTimestamp: null | ||
name: storageclassclaims.odf.openshift.io | ||
spec: | ||
group: odf.openshift.io | ||
names: | ||
kind: StorageClassClaim | ||
listKind: StorageClassClaimList | ||
plural: storageclassclaims | ||
singular: storageclassclaim | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.type | ||
name: StorageType | ||
type: string | ||
- jsonPath: .status.phase | ||
name: Phase | ||
type: string | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: StorageClassClaim is the Schema for the storageclassclaims 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: StorageClassClaimSpec defines the desired state of StorageClassClaim | ||
properties: | ||
encryptionMethod: | ||
type: string | ||
type: | ||
enum: | ||
- blockpool | ||
- sharedfilesystem | ||
type: string | ||
required: | ||
- type | ||
type: object | ||
status: | ||
description: StorageClassClaimStatus defines the observed state of StorageClassClaim | ||
properties: | ||
phase: | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
Oops, something went wrong.