-
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 StorageConsumerClient api and controller
Signed-off-by: Jose A. Rivera <[email protected]>
- Loading branch information
Showing
22 changed files
with
1,008 additions
and
4 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,88 @@ | ||
/* | ||
Copyright 2022 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 ( | ||
"k8s.io/apimachinery/pkg/api/resource" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type ocsClientPhase string | ||
|
||
const ( | ||
// OcsClientInitializing represents Initializing state of OcsClient | ||
OcsClientInitializing ocsClientPhase = "Initializing" | ||
// OcsClientOnboarding represents Onboarding state of OcsClient | ||
OcsClientOnboarding ocsClientPhase = "Onboarding" | ||
// OcsClientConnected represents Onboarding state of OcsClient | ||
OcsClientConnected ocsClientPhase = "Connected" | ||
// OcsClientUpdating represents Onboarding state of OcsClient | ||
OcsClientUpdating ocsClientPhase = "Updating" | ||
// OcsClientOffboarding represents Onboarding state of OcsClient | ||
OcsClientOffboarding ocsClientPhase = "Offboarding" | ||
) | ||
|
||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// OcsClientSpec defines the desired state of OcsClient | ||
type OcsClientSpec struct { | ||
// StorageProviderEndpoint holds info to establish connection with the storage providing cluster. | ||
StorageProviderEndpoint string `json:"storageProviderEndpoint"` | ||
|
||
// OnboardingTicket holds an identity information required for consumer to onboard. | ||
OnboardingTicket string `json:"onboardingTicket"` | ||
|
||
// RequestedCapacity Will define the desired capacity requested by a consumer cluster. | ||
RequestedCapacity *resource.Quantity `json:"requestedCapacity,omitempty"` | ||
} | ||
|
||
// OcsClientStatus defines the observed state of OcsClient | ||
type OcsClientStatus struct { | ||
Phase ocsClientPhase `json:"phase,omitempty"` | ||
|
||
// GrantedCapacity Will report the actual capacity | ||
// granted to the consumer cluster by the provider cluster. | ||
GrantedCapacity resource.Quantity `json:"grantedCapacity,omitempty"` | ||
|
||
// ConsumerID will hold the identity of this cluster inside the attached provider cluster | ||
ConsumerID string `json:"id,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// OcsClient is the Schema for the ocsclients API | ||
type OcsClient struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec OcsClientSpec `json:"spec,omitempty"` | ||
Status OcsClientStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// OcsClientList contains a list of OcsClient | ||
type OcsClientList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []OcsClient `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&OcsClient{}, &OcsClientList{}) | ||
} |
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,85 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.4.1 | ||
creationTimestamp: null | ||
name: ocsclients.odf.openshift.io | ||
spec: | ||
group: odf.openshift.io | ||
names: | ||
kind: OcsClient | ||
listKind: OcsClientList | ||
plural: ocsclients | ||
singular: ocsclient | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: OcsClient is the Schema for the ocsclients 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: OcsClientSpec defines the desired state of OcsClient | ||
properties: | ||
onboardingTicket: | ||
description: OnboardingTicket holds an identity information required | ||
for consumer to onboard. | ||
type: string | ||
requestedCapacity: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
description: RequestedCapacity Will define the desired capacity requested | ||
by a consumer cluster. | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
storageProviderEndpoint: | ||
description: StorageProviderEndpoint holds info to establish connection | ||
with the storage providing cluster. | ||
type: string | ||
required: | ||
- onboardingTicket | ||
- storageProviderEndpoint | ||
type: object | ||
status: | ||
description: OcsClientStatus defines the observed state of OcsClient | ||
properties: | ||
grantedCapacity: | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
description: GrantedCapacity Will report the actual capacity granted | ||
to the consumer cluster by the provider cluster. | ||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ | ||
x-kubernetes-int-or-string: true | ||
id: | ||
description: ConsumerID will hold the identity of this cluster inside | ||
the attached provider cluster | ||
type: string | ||
phase: | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
Oops, something went wrong.