Skip to content

Commit

Permalink
feat((Scope): enable GCP MemoryStore for Redis
Browse files Browse the repository at this point in the history
  • Loading branch information
dushanpantic committed Jul 19, 2024
1 parent 1bb44e9 commit d185b50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/kcp/provider/gcp/client/gcpConstants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package client

import (
"fmt"
"github.com/kyma-project/cloud-manager/pkg/common/abstractions"
"regexp"
"time"

"github.com/kyma-project/cloud-manager/pkg/common/abstractions"

"github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
)

Expand Down Expand Up @@ -143,6 +144,7 @@ const (
ComputeService GcpServiceName = "compute.googleapis.com"
FilestoreService GcpServiceName = "file.googleapis.com"
CloudResourceManagerService GcpServiceName = "cloudresourcemanager.googleapis.com"
MemoryStoreForRedisService GcpServiceName = "redis.googleapis.com"
)

func GetCompleteServiceName(projectId string, serviceName GcpServiceName) string {
Expand Down
10 changes: 9 additions & 1 deletion pkg/kcp/scope/enableApisGcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package scope
import (
"context"
"fmt"
"os"

"github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
"github.com/kyma-project/cloud-manager/pkg/composed"
gcpclient "github.com/kyma-project/cloud-manager/pkg/kcp/provider/gcp/client"
"google.golang.org/api/serviceusage/v1"
"os"
)

func enableApisGcp(ctx context.Context, st composed.State) (error, context.Context) {
Expand Down Expand Up @@ -48,12 +49,19 @@ func enableApisGcp(ctx context.Context, st composed.State) (error, context.Conte
if err != nil {
return err, ctx
}

// filestore
err, _ = verifyAndAddOperationToStatus(ctx, scope, client, gcpclient.FilestoreService)
if err != nil {
return err, ctx
}

// memorystore for redis
err, _ = verifyAndAddOperationToStatus(ctx, scope, client, gcpclient.MemoryStoreForRedisService)
if err != nil {
return err, ctx
}

if len(scope.Status.GcpOperations) == 0 {
logger.Info("All APIs are enabled. Proceeding to next step.")
return nil, nil
Expand Down

0 comments on commit d185b50

Please sign in to comment.