Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CosmosDB database provider #8116

Merged
merged 6 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions cmd/applications-rp/radius-cloud.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ The following are properties that can be specified for UCP:
| Key | Description | Example |
|-----|-------------|---------|
| provider | The type of storage provider | `apiServer` |
| apiServer | Object containing properties for Kubernetes APIServer store | [**See below**](#apiserver) |
| cosmosdb | Object containing properties for CosmosDB | [**See below**](#cosmosdb) |
| apiServer | Object containing properties for Kubernetes APIServer store | [**See below**](#apiserver) |
| etcd | Object containing properties for ETCD store | [**See below**](#etcd)|

### queueProvider
Expand Down Expand Up @@ -159,14 +158,6 @@ ucp:
|-----|-------------|---------|
| inMemory | Configures the etcd store to run in-memory with the resource provider (must be `true`/`false`) | `true` |

### cosmosdb
| Key | Description | Example |
|-----|-------------|---------|
| url | URL of CosmosDB account | `https://radius-eastus-test.documents.azure.com:443/` |
| database | Name of the database in account | `applicationscore` |
| masterKey | All access key token for database resources | `your-master-key` |
| CollectionThroughput | Throughput of database | `400` |

## Plane properties

| Key | Description | Example |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ok github.com/radius-project/radius/pkg/cli 0.250s
? github.com/radius-project/radius/pkg/azure/radclient [no test files]
? github.com/radius-project/radius/pkg/renderers [no test files]
ok github.com/radius-project/radius/pkg/renderers/containerv1alpha3
ok github.com/radius-project/radius/pkg/renderers/cosmosdbmongov1alpha3
ok github.com/radius-project/radius/pkg/renderers/dapr
ok github.com/radius-project/radius/pkg/renderers/daprpubsubv1alpha3
ok github.com/radius-project/radius/pkg/renderers/daprstatestorev1alpha3
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ require (
github.com/opencontainers/image-spec v1.1.0
github.com/projectcontour/contour v1.30.1
github.com/prometheus/client_golang v1.20.5
github.com/spaolacci/murmur3 v1.1.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/stern/stern v1.31.0
github.com/stretchr/testify v1.10.0
github.com/vippsas/go-cosmosdb v0.0.0-20230118095602-f4e4b9f1c352
github.com/wI2L/jsondiff v0.6.1
go.etcd.io/etcd/client/v3 v3.5.17
go.etcd.io/etcd/server/v3 v3.5.17
Expand Down
7 changes: 0 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY=
github.com/agnivade/levenshtein v1.2.0/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU=
github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
Expand Down Expand Up @@ -549,7 +548,6 @@ github.com/goccy/go-yaml v1.15.7/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7Lk
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E=
github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0=
github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
Expand Down Expand Up @@ -759,7 +757,6 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs=
Expand Down Expand Up @@ -947,8 +944,6 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
Expand Down Expand Up @@ -997,8 +992,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vippsas/go-cosmosdb v0.0.0-20230118095602-f4e4b9f1c352 h1:N4BwZihfs9zOPo1R+aSIyLmM2qRYoN2gEuleOHUhjBA=
github.com/vippsas/go-cosmosdb v0.0.0-20230118095602-f4e4b9f1c352/go.mod h1:MC5grluKkU7tz2VMDXi7AOj2N4spGFebM5w//g2WpyU=
github.com/wI2L/jsondiff v0.6.1 h1:ISZb9oNWbP64LHnu4AUhsMF5W0FIj5Ok3Krip9Shqpw=
github.com/wI2L/jsondiff v0.6.1/go.mod h1:KAEIojdQq66oJiHhDyQez2x+sRit0vIzC9KeK0yizxM=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
Expand Down
10 changes: 0 additions & 10 deletions pkg/armrpc/hostoptions/hostoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,6 @@ func loadConfig(configPath string) (*ProviderConfig, error) {
return nil, fmt.Errorf("failed to load yaml: %w", err)
}

cosmosdbUrl := os.Getenv("RADIUS_STORAGEPROVIDER_COSMOSDB_URL")
if cosmosdbUrl != "" {
conf.StorageProvider.CosmosDB.Url = cosmosdbUrl
}

cosmosDBKey := os.Getenv("RADIUS_STORAGEPROVIDER_COSMOSDB_MASTERKEY")
if cosmosDBKey != "" {
conf.StorageProvider.CosmosDB.MasterKey = cosmosDBKey
}

return conf, nil
}

Expand Down
9 changes: 3 additions & 6 deletions pkg/corerp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@

## How to Run and Test Core RP

1. Update StorageProvider section of `cmd/applications-rp/radius-dev.yaml` by adding your Cosmos DB URL and key
1. With `cmd/applications-rp/main.go` file open, go to `Run And Debug` view in VS Code and click `Run`
1. You should have the service up and running at `localhost:8080` now
1. To create or update an environment, here is an example curl command:
2. You should have the service up and running at `localhost:8080` now
3. To create or update an environment, here is an example curl command:

```
curl --location --request PUT 'http://localhost:8080/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0?api-version=2023-10-01-preview' \
Expand All @@ -43,14 +42,12 @@
}'
```

1. To get information about an environment, here is an example curl command:
4. To get information about an environment, here is an example curl command:

```
curl --location --request GET 'http://localhost:8080/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/?api-version=2023-10-01-preview'
```

1. You should also be able to see all changes in Cosmos DB
Copy link
Contributor

@kachawla kachawla Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we update this to point to etcd (and later to postgres once the work completes) instead of deleting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no straightforward way to do this with etcd.

What do you think about making this part of the postgres work? @superbeeny and I talked about updating the dev instructions as part of that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds good


## References

* [ARM RPC v1.0 Specification](https://github.com/Azure/azure-resource-manager-rpc)
22 changes: 0 additions & 22 deletions pkg/ucp/dataprovider/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
store "github.com/radius-project/radius/pkg/ucp/store"
"github.com/radius-project/radius/pkg/ucp/store/apiserverstore"
ucpv1alpha1 "github.com/radius-project/radius/pkg/ucp/store/apiserverstore/api/ucp.dev/v1alpha1"
"github.com/radius-project/radius/pkg/ucp/store/cosmosdb"
"github.com/radius-project/radius/pkg/ucp/store/etcdstore"
"github.com/radius-project/radius/pkg/ucp/store/inmemory"
"github.com/radius-project/radius/pkg/ucp/store/postgres"
Expand All @@ -41,7 +40,6 @@ type storageFactoryFunc func(context.Context, StorageProviderOptions, string) (s

var storageClientFactory = map[StorageProviderType]storageFactoryFunc{
TypeAPIServer: initAPIServerClient,
TypeCosmosDB: initCosmosDBClient,
TypeETCD: InitETCDClient,
TypeInMemory: initInMemoryClient,
TypePostgreSQL: initPostgreSQLClient,
Expand Down Expand Up @@ -83,26 +81,6 @@ func initAPIServerClient(ctx context.Context, opt StorageProviderOptions, _ stri
return client, nil
}

func initCosmosDBClient(ctx context.Context, opt StorageProviderOptions, collectionName string) (store.StorageClient, error) {
sopt := &cosmosdb.ConnectionOptions{
Url: opt.CosmosDB.Url,
DatabaseName: opt.CosmosDB.Database,
CollectionName: collectionName,
MasterKey: opt.CosmosDB.MasterKey,
CollectionThroughput: opt.CosmosDB.CollectionThroughput,
}
dbclient, err := cosmosdb.NewCosmosDBStorageClient(sopt)
if err != nil {
return nil, fmt.Errorf("failed to create CosmosDB client - configuration may be invalid: %w", err)
}

if err = dbclient.Init(ctx); err != nil {
return nil, fmt.Errorf("failed to initialize CosmosDB client - configuration may be invalid: %w", err)
}

return dbclient, nil
}

// InitETCDClient checks if the ETCD client is in memory and if the client is not nil, then it initializes the storage
// client and returns an ETCDClient. If either of these conditions are not met, an error is returned.
func InitETCDClient(ctx context.Context, opt StorageProviderOptions, _ string) (store.StorageClient, error) {
Expand Down
3 changes: 0 additions & 3 deletions pkg/ucp/dataprovider/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const (
// TypeAPIServer represents the Kubernetes APIServer provider.
TypeAPIServer StorageProviderType = "apiserver"

// TypeCosmosDB represents CosmosDB provider.
TypeCosmosDB StorageProviderType = "cosmosdb"

// TypeETCD represents the etcd provider.
TypeETCD StorageProviderType = "etcd"

Expand Down
Loading
Loading