Skip to content

Commit

Permalink
Merge branch 'main' into willdavsmith/readd-ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
willdavsmith committed Apr 16, 2024
2 parents 2b4c56d + c756ab2 commit 6946703
Show file tree
Hide file tree
Showing 115 changed files with 1,105 additions and 4,659 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ coverage:
informational: true
target: auto
threshold: 0%
patch:
default: false

ignore:
- "**/mock_*.go" # ignore all mock files
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/long-running-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,13 @@ jobs:
if: failure()
run: |
echo ":x: functional test failed." >> $GITHUB_STEP_SUMMARY
- name: Login to Azure
if: always()
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_SP_TESTS_APPID }}
tenant-id: ${{ secrets.AZURE_SP_TESTS_TENANTID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }}
- name: Delete azure resource group - ${{ env.AZURE_TEST_RESOURCE_GROUP }}
if: always()
run: |
Expand Down
3 changes: 2 additions & 1 deletion deploy/Chart/templates/dashboard/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ metadata:
rules:
- apiGroups: ['api.ucp.dev']
resources: ['*']
verbs: ['get', 'list']
# dashboard needs get, list, and post privileges for api.ucp.dev
verbs: ['*']
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Today, the [functional tests](https://github.com/radius-project/radius/tree/main
|environment|env|
|container|ctnr|
|gateway|gtwy|
|httpRoute|rte|
|generic|gnrc|
|servicebus|sb|
|secretstore|scs|
Expand All @@ -32,8 +31,8 @@ resource gateway 'Applications.Core/gateways@2023-10-01-preview' = {
...
}
resource frontendRoute 'Applications.Core/httpRoutes@2023-10-01-preview' = {
name: 'gtwy-front-rte'
resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
name: 'gtwy-front-cntr'
...
}
```
Expand Down
194 changes: 140 additions & 54 deletions docs/contributing/contributing-releases/README.md

Large diffs are not rendered by default.

347 changes: 173 additions & 174 deletions go.mod

Large diffs are not rendered by default.

1,062 changes: 382 additions & 680 deletions go.sum

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hack/bicep-types-radius/generated/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Resources":{"Applications.Core/applications@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":58},"Applications.Core/containers@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":123},"Applications.Core/environments@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":158},"Applications.Core/extenders@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":176},"Applications.Core/gateways@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":197},"Applications.Core/httpRoutes@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":211},"Applications.Core/secretStores@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":234},"Applications.Core/volumes@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":271},"Applications.Dapr/pubSubBrokers@2023-10-01-preview":{"RelativePath":"applications/applications.dapr/2023-10-01-preview/types.json","Index":49},"Applications.Dapr/secretStores@2023-10-01-preview":{"RelativePath":"applications/applications.dapr/2023-10-01-preview/types.json","Index":66},"Applications.Dapr/stateStores@2023-10-01-preview":{"RelativePath":"applications/applications.dapr/2023-10-01-preview/types.json","Index":84},"Applications.Datastores/mongoDatabases@2023-10-01-preview":{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":50},"Applications.Datastores/redisCaches@2023-10-01-preview":{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":69},"Applications.Datastores/sqlDatabases@2023-10-01-preview":{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":88},"Applications.Messaging/rabbitMQQueues@2023-10-01-preview":{"RelativePath":"applications/applications.messaging/2023-10-01-preview/types.json","Index":50}},"Functions":{"applications.core/extenders":{"2023-10-01-preview":[{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":272}]},"applications.core/secretstores":{"2023-10-01-preview":[{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":278}]},"applications.datastores/mongodatabases":{"2023-10-01-preview":[{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":90}]},"applications.datastores/rediscaches":{"2023-10-01-preview":[{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":92}]},"applications.datastores/sqldatabases":{"2023-10-01-preview":[{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":94}]},"applications.messaging/rabbitmqqueues":{"2023-10-01-preview":[{"RelativePath":"applications/applications.messaging/2023-10-01-preview/types.json","Index":52}]}}}
{"Resources":{"Applications.Core/applications@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":58},"Applications.Core/containers@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":123},"Applications.Core/environments@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":158},"Applications.Core/extenders@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":176},"Applications.Core/gateways@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":197},"Applications.Core/secretStores@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":220},"Applications.Core/volumes@2023-10-01-preview":{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":257},"Applications.Dapr/pubSubBrokers@2023-10-01-preview":{"RelativePath":"applications/applications.dapr/2023-10-01-preview/types.json","Index":49},"Applications.Dapr/secretStores@2023-10-01-preview":{"RelativePath":"applications/applications.dapr/2023-10-01-preview/types.json","Index":66},"Applications.Dapr/stateStores@2023-10-01-preview":{"RelativePath":"applications/applications.dapr/2023-10-01-preview/types.json","Index":84},"Applications.Datastores/mongoDatabases@2023-10-01-preview":{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":50},"Applications.Datastores/redisCaches@2023-10-01-preview":{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":69},"Applications.Datastores/sqlDatabases@2023-10-01-preview":{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":88},"Applications.Messaging/rabbitMQQueues@2023-10-01-preview":{"RelativePath":"applications/applications.messaging/2023-10-01-preview/types.json","Index":50}},"Functions":{"applications.core/extenders":{"2023-10-01-preview":[{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":258}]},"applications.core/secretstores":{"2023-10-01-preview":[{"RelativePath":"applications/applications.core/2023-10-01-preview/types.json","Index":264}]},"applications.datastores/mongodatabases":{"2023-10-01-preview":[{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":90}]},"applications.datastores/rediscaches":{"2023-10-01-preview":[{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":92}]},"applications.datastores/sqldatabases":{"2023-10-01-preview":[{"RelativePath":"applications/applications.datastores/2023-10-01-preview/types.json","Index":94}]},"applications.messaging/rabbitmqqueues":{"2023-10-01-preview":[{"RelativePath":"applications/applications.messaging/2023-10-01-preview/types.json","Index":52}]}}}
2 changes: 0 additions & 2 deletions pkg/cli/clients/management.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
cntr_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/containers"
ext_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/extenders"
gtwy_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/gateways"
hrt_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/httproutes"
sstr_ctrl "github.com/radius-project/radius/pkg/corerp/frontend/controller/secretstores"
dapr_ctrl "github.com/radius-project/radius/pkg/daprrp/frontend/controller"
ds_ctrl "github.com/radius-project/radius/pkg/datastoresrp/frontend/controller"
Expand Down Expand Up @@ -60,7 +59,6 @@ var (
dapr_ctrl.DaprPubSubBrokersResourceType,
ext_ctrl.ResourceTypeName,
gtwy_ctrl.ResourceTypeName,
hrt_ctrl.ResourceTypeName,
cntr_ctrl.ResourceTypeName,
sstr_ctrl.ResourceTypeName,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/clivalidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func RequireResourceTypeAndName(args []string) (string, string, error) {
return resourceType, resourceName, nil
}

// example of resource Type: Applications.Core/httpRoutes, Applications.Datastores/redisCaches
// example of resource Type: Applications.Datastores/redisCaches
//

// RequireResourceType checks if the first argument provided is a valid resource type and returns it if it is. If the
Expand Down
28 changes: 14 additions & 14 deletions pkg/cli/cmd/app/graph/display_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func Test_display(t *testing.T) {
})

t.Run("complex application", func(t *testing.T) {
sqlRteID := "/planes/radius/local/resourcegroups/default/providers/Applications.Core/httpRoutes/sql-rte"
sqlRteType := "Applications.Core/httpRoutes"
sqlRteName := "sql-rte"
backendID := "/planes/radius/local/resourcegroups/default/providers/Applications.Core/containers/backend"
backendType := "Applications.Core/containers"
backendName := "backend"

sqlAppCntrID := "/planes/radius/local/resourcegroups/default/providers/Applications.Core/containers/sql-app-ctnr"
sqlAppCntrName := "sql-app-ctnr"
Expand All @@ -62,15 +62,15 @@ func Test_display(t *testing.T) {

graph := []*corerpv20231001preview.ApplicationGraphResource{
{
ID: &sqlRteID,
Name: &sqlRteName,
Type: &sqlRteType,
ID: &backendID,
Name: &backendName,
Type: &backendType,
ProvisioningState: &provisioningStateSuccess,
OutputResources: []*corerpv20231001preview.ApplicationGraphOutputResource{},
Connections: []*corerpv20231001preview.ApplicationGraphConnection{
{
ID: &sqlCntrID,
Direction: &dirInbound,
ID: &sqlCntrID,
},
},
},
Expand All @@ -82,8 +82,8 @@ func Test_display(t *testing.T) {
OutputResources: []*corerpv20231001preview.ApplicationGraphOutputResource{},
Connections: []*corerpv20231001preview.ApplicationGraphConnection{
{
ID: &backendID,
Direction: &dirOutbound,
ID: &sqlRteID,
},
},
},
Expand Down Expand Up @@ -130,19 +130,19 @@ func Test_display(t *testing.T) {

expected := `Displaying application: test-app
Name: sql-app-ctnr (Applications.Core/containers)
Name: backend (Applications.Core/containers)
Connections:
sql-db (Applications.Datastores/sqlDatabases) -> sql-app-ctnr
sql-ctnr (Applications.Core/containers) -> backend
Resources: (none)
Name: sql-ctnr (Applications.Core/containers)
Name: sql-app-ctnr (Applications.Core/containers)
Connections:
sql-ctnr -> sql-rte (Applications.Core/httpRoutes)
sql-db (Applications.Datastores/sqlDatabases) -> sql-app-ctnr
Resources: (none)
Name: sql-rte (Applications.Core/httpRoutes)
Name: sql-ctnr (Applications.Core/containers)
Connections:
sql-ctnr (Applications.Core/containers) -> sql-rte
sql-ctnr -> backend (Applications.Core/containers)
Resources: (none)
Name: redis (Applications.Datastores/redis)
Expand Down
11 changes: 1 addition & 10 deletions pkg/cli/cmd/app/status/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ func Test_Run(t *testing.T) {
Name: to.Ptr("test-container"),
ID: to.Ptr("/planes/radius/local/resourceGroups/test-group/providers/Applications.Core/containers/test-container"),
},
{
Name: to.Ptr("test-route"),
ID: to.Ptr("/planes/radius/local/resourceGroups/test-group/providers/Applications.Core/httpRoutes/test-route"),
},
{
Name: to.Ptr("test-gateway"),
ID: to.Ptr("/planes/radius/local/resourceGroups/test-group/providers/Applications.Core/gateways/test-gateway"),
Expand All @@ -137,11 +133,6 @@ func Test_Run(t *testing.T) {
Return(nil, nil).
Times(1)

diagnosticsClient.EXPECT().
GetPublicEndpoint(gomock.Any(), clients.EndpointOptions{ResourceID: mustParse(t, "/planes/radius/local/resourceGroups/test-group/providers/Applications.Core/httpRoutes/test-route")}).
Return(nil, nil).
Times(1)

diagnosticsClient.EXPECT().
GetPublicEndpoint(gomock.Any(), clients.EndpointOptions{ResourceID: mustParse(t, "/planes/radius/local/resourceGroups/test-group/providers/Applications.Core/gateways/test-gateway")}).
Return(to.Ptr("http://some-url.example.com"), nil).
Expand Down Expand Up @@ -172,7 +163,7 @@ func Test_Run(t *testing.T) {

applicationStatus := clients.ApplicationStatus{
Name: "test-app",
ResourceCount: 3,
ResourceCount: 2,
Gateways: []clients.GatewayStatus{
{
Name: "test-gateway",
Expand Down
5 changes: 2 additions & 3 deletions pkg/cli/cmd/bicep/publish/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strings"

credentials "github.com/oras-project/oras-credentials-go"
"github.com/radius-project/radius/pkg/cli/bicep"
"github.com/radius-project/radius/pkg/cli/clierrors"
"github.com/radius-project/radius/pkg/cli/connections"
"github.com/radius-project/radius/pkg/cli/framework"
"github.com/radius-project/radius/pkg/cli/output"

"net/http"

"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
Expand All @@ -42,6 +40,7 @@ import (
"oras.land/oras-go/v2/registry"
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
credentials "oras.land/oras-go/v2/registry/remote/credentials"
"oras.land/oras-go/v2/registry/remote/errcode"
"oras.land/oras-go/v2/registry/remote/retry"
)
Expand Down
10 changes: 9 additions & 1 deletion pkg/cli/cmd/group/groupswitch/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/radius-project/radius/pkg/cli/cmd/commonflags"
"github.com/radius-project/radius/pkg/cli/connections"
"github.com/radius-project/radius/pkg/cli/framework"
"github.com/radius-project/radius/pkg/cli/output"
"github.com/radius-project/radius/pkg/cli/workspaces"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -62,6 +63,7 @@ func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner) {
type Runner struct {
ConfigHolder *framework.ConfigHolder
ConnectionFactory connections.Factory
Output output.Interface
Workspace *workspaces.Workspace
UCPResourceGroupName string
}
Expand All @@ -71,6 +73,7 @@ func NewRunner(factory framework.Factory) *Runner {
return &Runner{
ConnectionFactory: factory.GetConnectionFactory(),
ConfigHolder: factory.GetConfigHolder(),
Output: factory.GetOutput(),
}
}

Expand Down Expand Up @@ -128,6 +131,11 @@ func (r *Runner) Run(ctx context.Context) error {

return nil
})
return err
if err != nil {
return err
}

r.Output.LogInfo("Switched to resource group %q", r.UCPResourceGroupName)
return nil

}
13 changes: 13 additions & 0 deletions pkg/cli/cmd/group/groupswitch/switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/radius-project/radius/pkg/cli/clierrors"
"github.com/radius-project/radius/pkg/cli/connections"
"github.com/radius-project/radius/pkg/cli/framework"
"github.com/radius-project/radius/pkg/cli/output"
"github.com/radius-project/radius/pkg/cli/workspaces"
"github.com/radius-project/radius/pkg/ucp/api/v20231001preview"
"github.com/radius-project/radius/test/radcli"
Expand Down Expand Up @@ -148,6 +149,7 @@ func Test_Run(t *testing.T) {
Scope: "/planes/radius/local/resourceGroups/b",
}

outputSink := &output.MockOutput{}
runner := &Runner{
ConfigHolder: &framework.ConfigHolder{
Config: config,
Expand All @@ -156,6 +158,7 @@ func Test_Run(t *testing.T) {
ConnectionFactory: &connections.MockFactory{ApplicationsManagementClient: appManagementClient},
Workspace: workspace,
UCPResourceGroupName: "a",
Output: outputSink,
}

err = runner.Run(context.Background())
Expand All @@ -164,6 +167,16 @@ func Test_Run(t *testing.T) {
actualConfig, err := cli.ReadWorkspaceSection(config)
require.NoError(t, err)
require.Equal(t, expectedConfig, actualConfig)

expected := []any{
output.LogOutput{
Format: "Switched to resource group %q",
Params: []any{"a"},
},
}

require.Equal(t, expected, outputSink.Writes)

})

t.Run("Switch (not existent)", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmd/resource/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner) {
Short: "Delete a Radius resource",
Long: "Deletes a Radius resource with the given name",
Example: `
sample list of resourceType: containers, gateways, httpRoutes, daprPubSubBrokers, extenders, mongoDatabases, rabbitMQMessageQueues, redisCaches, sqlDatabases, daprStateStores, daprSecretStores
sample list of resourceType: containers, gateways, daprPubSubBrokers, extenders, mongoDatabases, rabbitMQMessageQueues, redisCaches, sqlDatabases, daprStateStores, daprSecretStores
# Delete a container named orders
rad resource delete containers orders`,
Expand Down
3 changes: 1 addition & 2 deletions pkg/cli/cmd/resource/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner) {
Short: "Lists resources",
Long: "List all resources of specified type",
Example: `
sample list of resourceType: containers, gateways, httpRoutes, pubSubBrokers, extenders, mongoDatabases, rabbitMQMessageQueues, redisCaches, sqlDatabases, stateStores, secretStores
sample list of resourceType: containers, gateways, pubSubBrokers, extenders, mongoDatabases, rabbitMQMessageQueues, redisCaches, sqlDatabases, stateStores, secretStores
# list all resources of a specified type in the default environment
rad resource list containers
rad resource list gateways
rad resource list httpRoutes
# list all resources of a specified type in an application
rad resource list containers --application icecream-store
Expand Down
3 changes: 1 addition & 2 deletions pkg/cli/cmd/resource/show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner) {
Short: "Show Radius resource details",
Long: "Show details of the specified Radius resource",
Example: `
sample list of resourceType: containers, gateways, httpRoutes, daprPubSubBrokers, extenders, mongoDatabases, rabbitMQMessageQueues, redisCaches, sqlDatabases, daprStateStores, daprSecretStores
sample list of resourceType: containers, gateways, daprPubSubBrokers, extenders, mongoDatabases, rabbitMQMessageQueues, redisCaches, sqlDatabases, daprStateStores, daprSecretStores
# show details of a specified resource in the default environment
rad resource show containers orders
rad resource show gateways orders_gateways
rad resource show httpRoutes orders_routes
# show details of a specified resource in an application
rad resource show containers orders --application icecream-store
Expand Down
6 changes: 6 additions & 0 deletions pkg/cli/helm/radiusclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"errors"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/radius-project/radius/pkg/cli/output"
Expand Down Expand Up @@ -141,6 +143,10 @@ func AddRadiusValues(helmChart *chart.Chart, options *RadiusOptions) error {
}

for _, arg := range options.SetFileArgs {
if runtime.GOOS == "windows" {
arg = filepath.ToSlash(arg)
}

reader := func(rs []rune) (any, error) {
data, err := os.ReadFile(string(rs))
return string(data), err
Expand Down
2 changes: 2 additions & 0 deletions pkg/cli/prompt/text/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func Test_E2E(t *testing.T) {
normalizeOutput := func(bts []byte) string {
return stripansi.Strip(strings.ReplaceAll(string(bts), "\r\n", "\n"))
}

waitForContains := func(t *testing.T, reader io.Reader, target string) string {
normalized := ""
teatest.WaitFor(t, reader, func(bts []byte) bool {
Expand All @@ -94,6 +95,7 @@ func Test_E2E(t *testing.T) {

return normalized
}

waitForInitialRender := func(t *testing.T, reader io.Reader) string {
return waitForContains(t, reader, ">")
}
Expand Down
Loading

0 comments on commit 6946703

Please sign in to comment.