Skip to content

Commit

Permalink
Allow remote noobaa deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Kaustav Majumder <[email protected]>
  • Loading branch information
Kaustav Majumder committed Oct 14, 2024
1 parent 07c57b1 commit 62385cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 7 additions & 3 deletions services/provider/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import (
"encoding/json"
"encoding/pem"
"fmt"
"k8s.io/utils/ptr"
"math"
"net"
"slices"
"strconv"
"strings"
"time"

"k8s.io/utils/ptr"

"github.com/blang/semver/v4"
nbv1 "github.com/noobaa/noobaa-operator/v5/pkg/apis/noobaa/v1alpha1"
quotav1 "github.com/openshift/api/quota/v1"
Expand Down Expand Up @@ -433,17 +434,20 @@ func (s *OCSProviderServer) getExternalResources(ctx context.Context, consumerRe
Kind: "Secret",
Data: mustMarshal(map[string]string{
"auth_token": string(authToken),
"mgmt_addr": noobaaMgmtAddress,
"mgmt_addr": fmt.Sprintf("https://%s:443", noobaaMgmtAddress),
}),
})

extR = append(extR, &pb.ExternalResource{
Name: "noobaa-remote",
Name: "noobaa",
Kind: "Noobaa",
Data: mustMarshal(&nbv1.NooBaaSpec{
JoinSecret: &v1.SecretReference{
Name: "noobaa-remote-join-secret",
},
CleanupPolicy: nbv1.CleanupPolicySpec{
AllowNoobaaDeletion: true,
},
}),
})
return extR, nil
Expand Down
9 changes: 6 additions & 3 deletions services/provider/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ var noobaaSpec = &nbv1.NooBaaSpec{
JoinSecret: &v1.SecretReference{
Name: "noobaa-remote-join-secret",
},
CleanupPolicy: nbv1.CleanupPolicySpec{
AllowNoobaaDeletion: true,
},
}

var joinSecret = map[string]string{
"auth_token": "authToken",
"mgmt_addr": "noobaaMgmtAddress",
"mgmt_addr": "https://noobaaMgmtAddress:443",
}

var mockExtR = map[string]*externalResource{
Expand Down Expand Up @@ -100,8 +103,8 @@ var mockExtR = map[string]*externalResource{
Kind: "Secret",
Data: joinSecret,
},
"noobaa-remote": {
Name: "noobaa-remote",
"noobaa": {
Name: "noobaa",
Kind: "Noobaa",
Data: noobaaSpec,
},
Expand Down

0 comments on commit 62385cc

Please sign in to comment.