From d657892ef7b5fd752c359097a4748caa962dd00f Mon Sep 17 00:00:00 2001 From: ytimocin Date: Thu, 12 Oct 2023 20:14:59 -0700 Subject: [PATCH] Pagination causing Dev Recipes to not be installed and Controller Pod permission fix --- .vscode/launch.json | 10 +++++----- deploy/Chart/templates/controller/rbac.yaml | 2 +- .../running-controlplane-locally.md | 15 +++++++-------- pkg/cli/cmd/radinit/recipe.go | 10 +++++++++- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7b7642185f..699f357cff 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,7 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { "name": "Launch Applications RP", "type": "go", @@ -83,11 +82,12 @@ { "name": "Launch Control Plane (all)", "configurations": [ - "Launch UCP", + "Launch UCP", "Launch Applications RP", "Launch Controller", - "Launch Deployment Engine"], + "Launch Deployment Engine", + ], "stopAll": true - } - ] + } + ] } \ No newline at end of file diff --git a/deploy/Chart/templates/controller/rbac.yaml b/deploy/Chart/templates/controller/rbac.yaml index 523301f416..14e885d7c8 100644 --- a/deploy/Chart/templates/controller/rbac.yaml +++ b/deploy/Chart/templates/controller/rbac.yaml @@ -33,7 +33,7 @@ rules: - update - watch - apiGroups: - - rad.app + - radapp.io resources: - recipes - recipes/status diff --git a/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md b/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md index d90a6513f9..6bc8553bff 100644 --- a/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md +++ b/docs/contributing/contributing-code/contributing-code-control-plane/running-controlplane-locally.md @@ -14,7 +14,7 @@ Radius consists of a few processes that get deployed inside a Kubernetes cluster The easiest way to get started is to launch Radius using VS Code. This will give you the ability to debug all of the processes. This workflow will run all of the Radius processes locally on your computer without containerizing them. -> ⚠️ The debugging setup provided by these instructions **does NOT** share its database with an installed copy of Radius. It will use a separate namespace to store data. +> ⚠️ The debugging setup provided by these instructions **does NOT** share its database with an installed copy of Radius. It will use a separate namespace to store data. ## Endpoints @@ -27,15 +27,14 @@ If you need to manually test APIs you can reach them at the following endpoints ## Prerequisites -1. Create a Kubernetes cluster, or set your current context to a cluster you want to use. The debug configuration will use your current cluster for storing data. -2. Clone the `radius-project/radius` and `radius-project/deployment-engine` repo next to each other. -3. Run `git submodule update --init` in the `deployment-engine` repo -4. Install .NET 6.0 SDK - https://dotnet.microsoft.com/en-us/download/dotnet/6.0 -5. Install C# VS Code extension - https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp -6. (Optional) Configure any cloud provider credentials you want to use for developing Radius. +1. Create a Kubernetes cluster, or set your current context to a cluster you want to use. The debug configuration will use your current cluster for storing data. +2. Clone the `radius-project/radius` and `radius-project/deployment-engine` repo next to each other. +3. Run `git submodule update --init` in the `deployment-engine` repo. +4. Install .NET 6.0 SDK - . +5. Install C# VS Code extension - . +6. (Optional) Configure any cloud provider credentials you want to use for developing Radius. > 💡 The Bicep deployment engine uses .NET. However you don't need to know C# or .NET to develop locally with Radius. - > 💡 Radius will use your locally configured Azure or AWS credentials. If you are able to use the `az` or `aws` CLI then you don't need to do any additional setup. ## Setup Step 1: Run `rad init` diff --git a/pkg/cli/cmd/radinit/recipe.go b/pkg/cli/cmd/radinit/recipe.go index b22ccf3be8..be5be896e6 100644 --- a/pkg/cli/cmd/radinit/recipe.go +++ b/pkg/cli/cmd/radinit/recipe.go @@ -63,11 +63,19 @@ func (drc *devRecipeClient) GetDevRecipes(ctx context.Context) (map[string]map[s tag = "latest" } + // Temporary solution to get all repositories. + // The issue is that if RepositoryListPageSize is not specified the default is 100. + // We have 104 repositories in the registry as of 12 Oct 2023. That is why processRepositories + // function was being called twice and the second call was overwriting all the recipes. + // TODO: Remove this once we have a better solution. + reg.RepositoryListPageSize = 1000 + recipes := map[string]map[string]corerp.RecipePropertiesClassification{} // if repository has the correct path it should look like: /recipes//: // Ex: radius.azurecr.io/recipes/local-dev/rediscaches:0.20 - err = reg.Repositories(ctx, "", func(repos []string) error { + // The start parameter is set to "radius-rp" because our recipes are after that repository. + err = reg.Repositories(ctx, "radius-rp", func(repos []string) error { // validRepos will contain the repositories that have the requested tag. validRepos := []string{} for _, repo := range repos {