Skip to content

Commit

Permalink
Identifying and adding actions for gcpNfsVolume
Browse files Browse the repository at this point in the history
  • Loading branch information
abalaie committed Jan 26, 2024
1 parent d059ae3 commit bf5bb56
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ import (
// GcpNfsVolumeSpec defines the desired state of GcpNfsVolume
type GcpNfsVolumeSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule=(self == oldSelf), message="IpRange is immutable."
IpRange IpRangeRef `json:"ipRange"`
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule=(self == oldSelf), message="Location is immutable."
Location string `json:"location"`

// +kubebuilder:default=BASIC_HDD
// +kubebuilder:validation:XValidation:rule=(self == oldSelf), message="Tier is immutable."
Tier GcpFileTier `json:"tier"`

// +kubebuilder:validation:Pattern="^[a-z][a-z0-9_]*[a-z0-9]$"
// +kubebuilder:default=vol1
// +kubebuilder:validation:XValidation:rule=(self == oldSelf), message="FileShareName is immutable."
FileShareName string `json:"fileShareName"`

// +kubebuilder:default=2560
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package crgcpnfsvolume

import (
"context"
"github.com/kyma-project/cloud-manager/components/lib/composed"
)

func deletePersistenceVolume(ctx context.Context, st composed.State) (error, context.Context) {
//TODO implement me
panic("implement me")
}
11 changes: 11 additions & 0 deletions components/kcp/pkg/skr/nfs/crgcpnfsvolume/loadPersistenceVolume.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package crgcpnfsvolume

import (
"context"
"github.com/kyma-project/cloud-manager/components/lib/composed"
)

func loadPersistenceVolume(ctx context.Context, st composed.State) (error, context.Context) {
//TODO implement me
panic("implement me")
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func createKcpNfsInstance(ctx context.Context, st composed.State) (error, context.Context) {
func modifyKcpNfsInstance(ctx context.Context, st composed.State) (error, context.Context) {
state := st.(*State)
logger := composed.LoggerFromCtx(ctx)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package crgcpnfsvolume

import (
"context"
"github.com/kyma-project/cloud-manager/components/lib/composed"
)

func modifyPersistenceVolume(ctx context.Context, st composed.State) (error, context.Context) {
//TODO implement me
panic("implement me")
}
8 changes: 6 additions & 2 deletions components/kcp/pkg/skr/nfs/crgcpnfsvolume/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ func (r *Reconciler) newAction() composed.Action {
return composed.ComposeActions(
"crGcpNfsVolumeMain",
composed.LoadObj,
validateCidr,
validateSpec,
addFinalizer,
loadKcpNfsInstance,
createKcpNfsInstance,
loadPersistenceVolume,
modifyKcpNfsInstance,
deletePersistenceVolume,
deleteKcpNfsInstance,
removeFinalizer,
removePersistenceVolumeFinalizer,
modifyPersistenceVolume,
updateStatus,
composed.StopAndForgetAction,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package crgcpnfsvolume

import (
"context"
"github.com/kyma-project/cloud-manager/components/lib/composed"
)

func removePersistenceVolumeFinalizer(ctx context.Context, st composed.State) (error, context.Context) {
//TODO implement me
panic("implement me")
}
2 changes: 1 addition & 1 deletion components/kcp/pkg/skr/nfs/crgcpnfsvolume/validateSpec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func validateCidr(ctx context.Context, st composed.State) (error, context.Context) {
func validateSpec(ctx context.Context, st composed.State) (error, context.Context) {
state := st.(*State)
existing := meta.FindStatusCondition(state.ObjAsGcpNfsVolume().Status.Conditions, cloudresourcesv1beta1.ConditionTypeCidrValid)
if existing != nil && existing.Status == metav1.ConditionTrue {
Expand Down

0 comments on commit bf5bb56

Please sign in to comment.