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

Register Manifests during ucp startup sequence #8120

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

lakshmimsft
Copy link
Contributor

@lakshmimsft lakshmimsft commented Dec 11, 2024

Description

  • Registering Manifests during ucp startup sequence.
  • New initializer service to help do that
  • using generated clients directly

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (link).

Fixes: Part of UDT

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
  • If applicable, design document has been reviewed and approved by Radius maintainers/approvers.
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 66.35802% with 109 lines in your changes missing coverage. Please review.

Project coverage is 60.11%. Comparing base (6b8ef42) to head (1939ae8).

Files with missing lines Patch % Lines
pkg/cli/manifest/registermanifest.go 63.46% 25 Missing and 13 partials ⚠️
pkg/ucp/initializer/service.go 58.20% 20 Missing and 8 partials ⚠️
pkg/cli/cmd/resourceprovider/create/create.go 36.00% 12 Missing and 4 partials ⚠️
pkg/cli/manifest/testclientfactory.go 89.18% 11 Missing and 1 partial ⚠️
pkg/cli/workspaces/connection.go 0.00% 11 Missing ⚠️
pkg/cli/connections/factory.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8120      +/-   ##
==========================================
+ Coverage   60.04%   60.11%   +0.07%     
==========================================
  Files         581      584       +3     
  Lines       38536    38784     +248     
==========================================
+ Hits        23138    23316     +178     
- Misses      13698    13749      +51     
- Partials     1700     1719      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@rynowak rynowak left a comment

Choose a reason for hiding this comment

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

Thanks, this is an improvement. Let's keep iterating on Monday.

cmd/ucpd/cmd/root.go Outdated Show resolved Hide resolved
cmd/ucpd/ucp-dev.yaml Outdated Show resolved Hide resolved
deploy/manifest/built-in-providers/test1.yaml Outdated Show resolved Hide resolved
pkg/ucp/api/v20231001preview/locations_fake_test.go Outdated Show resolved Hide resolved
pkg/ucp/hosting/hosting.go Outdated Show resolved Hide resolved
pkg/ucp/manifestservice/service.go Outdated Show resolved Hide resolved
pkg/ucp/manifestservice/service.go Outdated Show resolved Hide resolved
pkg/ucp/manifestservice/service.go Outdated Show resolved Hide resolved
pkg/ucp/manifestservice/service.go Outdated Show resolved Hide resolved
pkg/ucp/ucpclient/ucpclient.go Outdated Show resolved Hide resolved
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from f432f1e to 15bf5c0 Compare December 16, 2024 17:26
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from 15bf5c0 to 31c016b Compare December 18, 2024 16:32
@lakshmimsft lakshmimsft changed the title [WIP] UDT Draft PR - Register Manifests during ucp startup sequence Register Manifests during ucp startup sequence Dec 18, 2024
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from 31c016b to ddba2d1 Compare December 18, 2024 17:24
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from ddba2d1 to 2b6ddf2 Compare December 18, 2024 22:33
@lakshmimsft lakshmimsft marked this pull request as ready for review December 18, 2024 22:33
@lakshmimsft lakshmimsft requested review from a team as code owners December 18, 2024 22:33
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from 2b6ddf2 to 2027d07 Compare December 18, 2024 22:55
@lakshmimsft lakshmimsft marked this pull request as draft December 19, 2024 00:21
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from 2027d07 to 626eaa3 Compare December 19, 2024 17:44
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from 626eaa3 to fd4ef05 Compare December 19, 2024 19:15
@lakshmimsft lakshmimsft marked this pull request as ready for review December 19, 2024 19:22
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from fd4ef05 to 4f9399d Compare December 19, 2024 19:32
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from 4f9399d to bda5c6f Compare December 19, 2024 19:37
// connection and an error if one occurs.
func (ws Workspace) Connect() (sdk.Connection, error) {
func (ws Workspace) Connect(ctx context.Context) (sdk.Connection, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you find any places in code that call connect but don't call test-connection?

I think this is a good refactor, but I'm trying to figure out if it's safe to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, all current calls were followed by another call to test connection

func Test_ResourceProvider_RegisterManifests(t *testing.T) {
server := testhost.Start(t, testhost.TestHostOptionFunc(func(options *ucp.Options) {
options.Config.Initialization.ManifestDirectory = "testdata/manifests"
}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome 👍

createRadiusPlane(server)

// Wait for the manifest to be registered
time.Sleep(5 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do this with require.Eventually instead?

Picking a hardcoded value has a lot of downsides:

  • If it's too short, the test will be unreliable
  • If it's too long, we end up waiting a lot

You can use require.Eventually with a long-ish timeout and it will be mitigate both of these issues. eg: retry every 1 second with a 30 second deadline.

client, err := r.ConnectionFactory.CreateApplicationsManagementClient(ctx, *r.Workspace)
if err != nil {
return err
// Initialize the client factory
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you update this comment to explain why this is being done inside Run?

Copy link
Contributor

@rynowak rynowak left a comment

Choose a reason for hiding this comment

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

A few more small things to look at. This is almost there!

Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
Signed-off-by: lakshmimsft <[email protected]>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 21, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref fb26995
Unique ID func7d93474e9f
Image tag pr-func7d93474e9f
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func7d93474e9f
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func7d93474e9f
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func7d93474e9f
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func7d93474e9f
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func7d93474e9f
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

Signed-off-by: lakshmimsft <[email protected]>
@lakshmimsft lakshmimsft force-pushed the lakshmimsft/upducpstartup branch from fb26995 to 1939ae8 Compare December 21, 2024 00:46
@lakshmimsft lakshmimsft deployed to publish-bicep December 21, 2024 00:46 — with GitHub Actions Active
@lakshmimsft lakshmimsft deployed to functional-tests December 21, 2024 02:59 — with GitHub Actions Active
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 21, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref 1939ae8
Unique ID func9ce86ddc8e
Image tag pr-func9ce86ddc8e
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func9ce86ddc8e
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func9ce86ddc8e
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func9ce86ddc8e
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func9ce86ddc8e
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func9ce86ddc8e
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants