Skip to content

Commit

Permalink
Merge pull request #153 from red-hat-storage/sync_us--main
Browse files Browse the repository at this point in the history
Syncing latest changes from upstream main for kubernetes-csi-addons
  • Loading branch information
openshift-merge-bot[bot] committed Jun 19, 2024
2 parents 716f0f6 + 3492065 commit dbffe27
Show file tree
Hide file tree
Showing 79 changed files with 2,837 additions and 634 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ jobs:
uses: codespell-project/actions-codespell@master
with:
skip: .git,go.mod,go.sum,vendor
# kubebuilder latest release has a label with name kuberentes
# TODO: remove this in next kubebuilder update as this is fixed
# in kubebuilder master
# https://github.com/kubernetes-sigs/kubebuilder/pull/2964
ignore_words_list: kuberentes
ignore_words_list: NotIn
check_filenames: true
check_hidden: true
29 changes: 29 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: openshift.io
layout:
- go.kubebuilder.io/v3
Expand Down Expand Up @@ -58,4 +62,29 @@ resources:
kind: VolumeReplicationClass
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: openshift.io
group: replication.storage
kind: VolumeGroupReplicationClass
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: openshift.io
group: replication.storage
kind: VolumeGroupReplication
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: openshift.io
group: replication.storage
kind: VolumeGroupReplicationContent
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
version: v1alpha1
version: "3"
95 changes: 95 additions & 0 deletions apis/replication.storage/v1alpha1/volumegroupreplication_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
Copyright 2024 The Kubernetes-CSI-Addons Authors.
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"
)

// VolumeGroupReplicationSpec defines the desired state of VolumeGroupReplication
type VolumeGroupReplicationSpec struct {
// volumeGroupReplicationClassName is the volumeGroupReplicationClass name for this VolumeGroupReplication resource
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupReplicationClassName is immutable"
VolumeGroupReplicationClassName string `json:"volumeGroupReplicationClassName"`

// Name of the VolumeReplication object created for this volumeGroupReplication
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeReplicationName is immutable"
VolumeReplicationName string `json:"volumeReplicationName,omitempty"`

// Name of the VolumeGroupReplicationContent object created for this volumeGroupReplication
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupReplicationContentName is immutable"
VolumeGroupReplicationContentName string `json:"volumeGroupReplicationContentName,omitempty"`

// Source specifies where a group replications will be created from.
// This field is immutable after creation.
// Required.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="source is immutable"
Source VolumeGroupReplicationSource `json:"source"`

// ReplicationState represents the replication operation to be performed on the group.
// Supported operations are "primary", "secondary" and "resync"
// +kubebuilder:validation:Required
ReplicationState ReplicationState `json:"replicationState"`

// AutoResync represents the group to be auto resynced when
// ReplicationState is "secondary"
// +kubebuilder:default:=false
AutoResync bool `json:"autoResync"`
}

// VolumeGroupReplicationSource specifies the source for the the volumeGroupReplication
type VolumeGroupReplicationSource struct {
// Selector is a label query over persistent volume claims that are to be
// grouped together for replication.
// +optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="selector is immutable"
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

// VolumeGroupReplicationStatus defines the observed state of VolumeGroupReplication
type VolumeGroupReplicationStatus struct {
VolumeReplicationStatus `json:",inline"`
}

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

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

Spec VolumeGroupReplicationSpec `json:"spec,omitempty"`
Status VolumeGroupReplicationStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&VolumeGroupReplication{}, &VolumeGroupReplicationList{})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2024 The Kubernetes-CSI-Addons Authors.
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"
)

// VolumeGroupReplicationClassSpec specifies parameters that an underlying storage system uses
// when creating a volumegroup replica. A specific VolumeGroupReplicationClass is used by specifying
// its name in a VolumeGroupReplication object.
// +kubebuilder:validation:XValidation:rule="has(self.parameters) == has(oldSelf.parameters)",message="parameters are immutable"
type VolumeGroupReplicationClassSpec struct {
// Provisioner is the name of storage provisioner
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="provisioner is immutable"
Provisioner string `json:"provisioner"`
// Parameters is a key-value map with storage provisioner specific configurations for
// creating volume group replicas
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="parameters are immutable"
Parameters map[string]string `json:"parameters,omitempty"`
}

// VolumeGroupReplicationClassStatus defines the observed state of VolumeGroupReplicationClass
type VolumeGroupReplicationClassStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster

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

Spec VolumeGroupReplicationClassSpec `json:"spec,omitempty"`
Status VolumeGroupReplicationClassStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&VolumeGroupReplicationClass{}, &VolumeGroupReplicationClassList{})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
Copyright 2024 The Kubernetes-CSI-Addons Authors.
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 (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// VolumeGroupReplicationContentSpec defines the desired state of VolumeGroupReplicationContent
type VolumeGroupReplicationContentSpec struct {
// VolumeGroupreplicationRef specifies the VolumeGroupReplication object to which this
// VolumeGroupReplicationContent object is bound.
// VolumeGroupReplication.Spec.VolumeGroupReplicationContentName field must reference to
// this VolumeGroupReplicationContent's name for the bidirectional binding to be valid.
// For a pre-existing VolumeGroupReplicationContent object, name and namespace of the
// VolumeGroupReplication object MUST be provided for binding to happen.
// This field is immutable after creation.
// Required.
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both volumeGroupReplicationRef.name and volumeGroupReplicationRef.namespace must be set"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupReplicationRef is immutable"
VolumeGroupReplicationRef corev1.ObjectReference `json:"volumeGroupReplicationRef"`

// VolumeGroupReplicationHandle is a unique id returned by the CSI driver
// to identify the VolumeGroupReplication on the storage system.
VolumeGroupReplicationHandle string `json:"volumeGroupReplicationHandle"`

// provisioner is the name of the CSI driver used to create the physical
// volume group on
// the underlying storage system.
// This MUST be the same as the name returned by the CSI GetPluginName() call for
// that driver.
// Required.
Provisioner string `json:"provisioner"`

// VolumeGroupReplicationClassName is the name of the VolumeGroupReplicationClass from
// which this group replication was (or will be) created.
// +optional
VolumeGroupReplicationClassName string `json:"volumeGroupReplicationClassName"`

// Source specifies whether the snapshot is (or should be) dynamically provisioned
// or already exists, and just requires a Kubernetes object representation.
// This field is immutable after creation.
// Required.
Source VolumeGroupReplicationContentSource `json:"source"`
}

// VolumeGroupReplicationContentSource represents the CSI source of a group replication.
type VolumeGroupReplicationContentSource struct {
// VolumeHandles is a list of volume handles on the backend to be grouped
// and replicated.
VolumeHandles []string `json:"volumeHandles"`
}

// VolumeGroupReplicationContentStatus defines the status of VolumeGroupReplicationContent
type VolumeGroupReplicationContentStatus struct {
// PersistentVolumeRefList is the list of of PV for the group replication
// The maximum number of allowed PV in the group is 100.
// +optional
PersistentVolumeRefList []corev1.LocalObjectReference `json:"persistentVolumeRefList,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster

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

Spec VolumeGroupReplicationContentSpec `json:"spec,omitempty"`
Status VolumeGroupReplicationContentStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&VolumeGroupReplicationContent{}, &VolumeGroupReplicationContentList{})
}
Loading

0 comments on commit dbffe27

Please sign in to comment.