Skip to content

Commit

Permalink
Merge branch 'main' into azure_redis_basic_tier
Browse files Browse the repository at this point in the history
  • Loading branch information
ijovovic authored Feb 24, 2025
2 parents 563af5d + 506001a commit 12512cb
Show file tree
Hide file tree
Showing 19 changed files with 802 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,13 @@ resources:
kind: RedisCluster
path: github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: kyma-project.io
group: cloud-resources
kind: AzureRwxVolumeBackup
path: github.com/kyma-project/cloud-manager/api/cloud-resources/v1beta1
version: v1beta1
version: "3"
118 changes: 118 additions & 0 deletions api/cloud-resources/v1beta1/azurerwxvolumebackup_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
Copyright 2023.
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 v1beta1

import (
featuretypes "github.com/kyma-project/cloud-manager/pkg/feature/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type AzureRwxBackupState string

const (
AzureRwxBackupReady AzureRwxBackupState = "Ready"

AzureRwxBackupError AzureRwxBackupState = "Error"

AzureRwxBackupCreating AzureRwxBackupState = "Creating"

AzureRwxBackupDeleting AzureRwxBackupState = "Deleting"

AzureRwxBackupDeleted AzureRwxBackupState = "Deleted"

AzureRwxBackupFailed AzureRwxBackupState = "Failed"
)

type PvcRef struct {
// Name speicfies the name of the PVC that a backup has to be made of.
// +kubebuilder:validation:Required
Name string `json:"name"`

// Namespace specified the namespace of the AzureRwxVolume resource that a backup has to be made of.
// If not specified then namespace of the AzureRwxVolumeBackup is used.
// +optional
Namespace string `json:"namespace"`
}

type PvcSource struct {
Pvc PvcRef `json:"pvc"`
}

// AzureRwxVolumeBackupSpec defines the desired state of AzureRwxVolumeBackup
type AzureRwxVolumeBackupSpec struct {

// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule=(self == oldSelf), message="source is immutable."
Source PvcSource `json:"source"`

Location string `json:"location"`
}

// AzureRwxVolumeBackupStatus defines the observed state of AzureRwxVolumeBackup
type AzureRwxVolumeBackupStatus struct {
State AzureRwxBackupState `json:"state,omitempty"`

// List of status conditions
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`

// Operation Identifier to track the Hyperscaler Creation Operation
// +optional
OpIdentifier string `json:"opIdentifier,omitempty"`

// +optional
Id string `json:"id,omitempty"`

// RecoveryPointId specifies the corresponding snapshot used for restore
// +optional
RecoveryPointId string `json:"recoveryPointId,omitempty"`
}

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

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

Spec AzureRwxVolumeBackupSpec `json:"spec,omitempty"`
Status AzureRwxVolumeBackupStatus `json:"status,omitempty"`
}

func (bu *AzureRwxVolumeBackup) SpecificToFeature() featuretypes.FeatureName {
return featuretypes.FeatureNfsBackup
}

func (bu *AzureRwxVolumeBackup) SpecificToProviders() []string {
return []string{"azure"}
}

// +kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&AzureRwxVolumeBackup{}, &AzureRwxVolumeBackupList{})
}
128 changes: 128 additions & 0 deletions api/cloud-resources/v1beta1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ func main() {
os.Exit(1)
}

//if err = cloudresourcescontroller.SetupAzureRwxBackupReconciler(skrRegistry); err != nil {
// setupLog.Error(err, "unable to create controller", "controller", "AzureRwxVolumeBackup")
// os.Exit(1)
//}

// KCP Controllers
if err = cloudcontrolcontroller.SetupScopeReconciler(ctx, mgr, scopeclient.NewAwsStsGardenClientProvider(), skrLoop, gcpclient.NewServiceUsageClientProvider()); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Scope")
Expand Down
Loading

0 comments on commit 12512cb

Please sign in to comment.