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

Add recipe engine #8180

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Conversation

rynowak
Copy link
Contributor

@rynowak rynowak commented Jan 2, 2025

Description

This change adds the recipe engine to the dynamic-rp. There's no usage of the recipe engine yet in this PR, it's a prerequisite for what's coming next.

The main problem being solved is improving the initialization code so that it can be used in our integration tests.

Type of change

  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).

Part of: #6688

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.
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

@rynowak rynowak requested review from a team as code owners January 2, 2025 20:43
limitations under the License.
*/

package kubernetesclientprovider
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to previous changes, moving the functionality to access a Kubernetes client into a "provider". By deferring and standardizing the initialization that makes it easier to override in tests.

@@ -35,6 +35,8 @@ data:
port: 6062
secretProvider:
provider: kubernetes
kubernetes:
kind: default
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only needed for dynamic-rp. UCP doesn't talk directly to Kubernetes, and applications-rp doesn't have the same expectations for testing.

@@ -92,6 +97,9 @@ func Start(t *testing.T, opts ...TestHostOption) (*TestHost, *ucptesthost.TestHo
options, err := dynamicrp.NewOptions(context.Background(), config)
require.NoError(t, err)

// Prevent the default recipe drivers from being registered.
options.Recipes.Drivers = map[string]func(options *dynamicrp.Options) (driver.Driver, error){}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we can load/use/mock the recipe engine in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be used in the next PR, where we're actually going to test a resource that uses recipes.

}

// WithLegacy implements discovery.DiscoveryInterface.
func (d *DiscoveryClient) WithLegacy() discovery.DiscoveryInterface {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions were missing from our mock. The discovery package defines a ton of different interfaces. I changed from a really scenario-specific one to a more general one.

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 25.98039% with 151 lines in your changes missing coverage. Please review.

Project coverage is 59.99%. Comparing base (75d093a) to head (4306c51).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/dynamicrp/options.go 22.36% 55 Missing and 4 partials ⚠️
...kubernetesclient/kubernetesclientprovider/types.go 28.00% 53 Missing and 1 partial ⚠️
pkg/recipes/terraform/execute.go 10.00% 18 Missing ⚠️
pkg/dynamicrp/backend/service.go 0.00% 7 Missing ⚠️
pkg/portableresources/processors/resourceclient.go 50.00% 5 Missing and 2 partials ⚠️
pkg/recipes/controllerconfig/config.go 0.00% 4 Missing ⚠️
pkg/recipes/driver/terraform.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8180      +/-   ##
==========================================
- Coverage   60.16%   59.99%   -0.17%     
==========================================
  Files         587      588       +1     
  Lines       38943    39116     +173     
==========================================
+ Hits        23429    23469      +40     
- Misses      13785    13910     +125     
- Partials     1729     1737       +8     

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

Signed-off-by: Ryan Nowak <nowakra@gmail.com>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Jan 5, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository rynowak/radius
Commit ref 4306c51
Unique ID func2095c3a05f
Image tag pr-func2095c3a05f
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-func2095c3a05f
  • 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-func2095c3a05f
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func2095c3a05f
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func2095c3a05f
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func2095c3a05f
  • 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...
✅ corerp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded

@rynowak
Copy link
Contributor Author

rynowak commented Jan 5, 2025

Going to merge when the CI completes. Will resolve any additional feedback in a follow-up.

@rynowak rynowak merged commit 04f30c3 into radius-project:main Jan 5, 2025
29 checks passed
@rynowak rynowak deleted the kubernetes-clients branch January 5, 2025 18:40
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.

None yet

2 participants