corerp/

directory
v0.33.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0

README

Applications.Core RP

WIP - This doc will be updated iteratively.

Layout

  1. /pkg/corerp/api: API version specific models
  2. /pkg/corerp/datamodel: API version agnostic models to implement operation controller and store resource metadata.
  3. /pkg/corerp/frontend/controller: Per-operation controller implementations.
  4. /pkg/corerp/frontend/handler: HTTP server handler and routers.
  5. /pkg/corerp/frontend/middleware: HTTP server middleware.
  6. /pkg/corerp/frontend/hostingoptions: Hosting options for resource provider service.
  7. /pkg/corerp/frontend/servicecontext: Service context extracted from ARM proxy request header.

Add new resource type and its controller

  1. Ensure that you update openapi spec in /swagger
  2. Generate resource type models in /pkg/corerp/api by following the instruction.
  3. Define api version agnostic datamodel in /pkg/corerp/datamodel and its converters between datamodel and api models.
  4. Define routes for new resource type and its operation APIs in routes.go.
  5. Create resource type directory under /pkg/frontend/controller/ and related go files by referring to environments controller.
  6. Implement operation controllers and tests.
  7. Register handlers in handlers.go.

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

  2. With cmd/applications-rp/main.go file open, go to Run And Debug view in VS Code and click Run

  3. You should have the service up and running at localhost:8080 now

  4. 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' \
    --header 'X-Ms-Arm-Resource-System-Data: {"lastModifiedBy":"fake@hotmail.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-22T18:54:52.6857175Z"}' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "properties": {
            "compute": {
                "kind": "Kubernetes",
                "resourceId": "test-override-2"
            }
        }
    }'
    
  5. 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'
    
  6. You should also be able to see all changes in Cosmos DB

References

Directories

Path Synopsis
api
backend
deployment
Package deployment is a generated GoMock package.
Package deployment is a generated GoMock package.
frontend
Package handlers is a generated GoMock package.
Package handlers is a generated GoMock package.
processors
extenders
extenders contains the resource processor for extenders.
extenders contains the resource processor for extenders.
Package renderers is a generated GoMock package.
Package renderers is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL