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 Radius Flux Controller for GitOps support #8784

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

Conversation

willdavsmith
Copy link
Contributor

@willdavsmith willdavsmith commented Mar 10, 2025

Description

  • Add Radius Flux controller and tests
  • Update test workflows to install and use Flux and Gitea
  • Add bicep container and changes to allow for Bicep to run server-side in controller pod

Note: I expect the functional tests to fail for this PR because I'm updating the functional test workflow. Here's a link to a successful action run: https://github.com/radius-project/radius/actions/runs/14074009492

Design PR: radius-project/design-notes#79
Docs PR: radius-project/docs#1408

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).
  • This pull request adds or changes features of Radius and has an approved issue (issue link required).
  • 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).

Fixes: #6689

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.
    • Yes
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Yes
    • Not applicable

Copy link

github-actions bot commented Mar 10, 2025

Unit Tests

3 688 tests  +90   3 686 ✅ +92   6m 42s ⏱️ -10s
  296 suites ± 0       2 💤 ± 0 
    1 files   ± 0       0 ❌  -  2 

Results for commit cc19e18. ± Comparison against base commit 4f8900b.

♻️ This comment has been updated with latest results.

Copy link
Member

@brooke-hamilton brooke-hamilton left a comment

Choose a reason for hiding this comment

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

Awesome PR 🚀

Copy link
Member

@brooke-hamilton brooke-hamilton left a comment

Choose a reason for hiding this comment

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

I pressed the button on the previous review before finished. Here is part 2. I'm still reviewing so I will add more in another section.

Copy link
Contributor

@ytimocin ytimocin left a comment

Choose a reason for hiding this comment

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

First round of my review.

Comment on lines +50 to +55
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30080
hostPort: 30080
protocol: TCP
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason behind this addition? Do we need to add some comments here?

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 for Gitea. I added a comment

Comment on lines +9 to +15
service:
http:
type: NodePort
nodePort: 30080
ssh:
type: ClusterIP
port: 22
Copy link
Contributor

Choose a reason for hiding this comment

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

Now it is kind of making sense what you did in the kind cluster creation action. But we may still need to add some comments to the action so that people can understand what it is for.

fi

if [ -z "$GITEA_ACCESS_TOKEN_NAME" ]; then
echo
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean the empty echo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines +48 to +44
helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo update
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we always going to install the latest version? Can it cause any breaking changes at some point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true - changed this to install 11.0.0

output=$(kubectl exec -it $gitea_pod -n gitea -- gitea admin user generate-access-token --username $GITEA_USERNAME --token-name $GITEA_ACCESS_TOKEN_NAME --scopes "write:repository,write:user" --raw)
echo $output

echo "gitea-access-token=$output" >>$GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

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

This sh file can actually be tested locally.

@@ -1,17 +1,20 @@
# Use distroless image which already includes ca-certificates
FROM gcr.io/distroless/static:nonroot
FROM ubuntu:latest
Copy link
Contributor

@ytimocin ytimocin Mar 12, 2025

Choose a reason for hiding this comment

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

  1. We should check the size difference since we are changing the base image (I believe ubuntu is probably much larger than what we have now)
  2. We should also lock the version to not have breaking changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to use debian-slim and locked the version.

@@ -38,12 +41,13 @@ var _ Interface = (*Impl)(nil)

// Impl is the implementation of Interface.
type Impl struct {
filesystem filesystem.FileSystem
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be fileSystem?

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, updated

Comment on lines 86 to 102
// Build runs `rad-bicep build` with the given arguments.
func (i *Impl) Build(args ...string) (map[string]any, error) {
buildArgs := make([]string, len(args)+1)
buildArgs[0] = "build"
copy(buildArgs[1:], args)

return runBicepJSON(buildArgs...)
}

// BuildParams runs `rad-bicep build-params` with the given arguments.
func (i *Impl) BuildParams(args ...string) (map[string]any, error) {
buildParamsArgs := make([]string, len(args)+1)
buildParamsArgs[0] = "build-params"
copy(buildParamsArgs[1:], args)

return runBicepJSON(buildParamsArgs...)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be one generic function with the initial param passed in like: BuildCommand("build-params" or "build", args).

Copy link
Contributor Author

@willdavsmith willdavsmith Mar 20, 2025

Choose a reason for hiding this comment

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

I deleted these functions and just wrote Call() instead


version := regexp.MustCompile(SemanticVersionRegex).FindString(string(bytes))
if version == "" {
return fmt.Sprintf("unknown (failed to parse bicep version from %q)", string(bytes))
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this also return an error? Like func (i *Impl) Version() (string, 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.

this code is copied over from pkg/cli/bicep/build.go - I don't want to change it in case it breaks something

Copy link
Contributor

@kachawla kachawla left a comment

Choose a reason for hiding this comment

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

Are all the changes in this PR strictly dependent on one another? Ideally, we should aim to break them down into smaller, more focused PRs, keeping each one as minimal as possible for easier review.

@@ -0,0 +1,14 @@
FROM alpine:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to pin this to a specific version and make it more deterministic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call - changing to 3.21.3

# Use Ubuntu image to enable Bicep CLI.
# Switch to something more lightweight when we can find a
# base image that supports running Bicep.
FROM ubuntu:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the above comment of pinning to a specific version instead of latest


// Version returns the version of Bicep installed on the local machine,
// or an error if Bicep cannot be found or is not a valid version.
func (i *Impl) Version() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should return the version or an error and not co-mingle the return

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 code is copied over from pkg/cli/bicep/build.go - I don't want to change it in case it breaks something

file, exists := m.InternalFileSystem[name]
if !exists {
return nil, fmt.Errorf("file %s does not exist", name)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline

_, exists := m.InternalFileSystem[name]
if !exists {
return fmt.Errorf("file %s does not exist", name)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline

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

radius-functional-tests bot commented Mar 26, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref 361e965
Unique ID funcfd7cee76c1
Image tag pr-funcfd7cee76c1
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-funcfd7cee76c1
  • 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-funcfd7cee76c1
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcfd7cee76c1
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcfd7cee76c1
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcfd7cee76c1
  • 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...
❌ Failed to install Radius for corerp-cloud functional test. Please check the logs for more details
❌ Failed to install Radius for ucp-cloud functional test. Please check the logs for more details
❌ corerp-cloud functional test failed. Please check the logs for more details
❌ ucp-cloud functional test failed. Please check the logs for more details

Signed-off-by: willdavsmith <[email protected]>
Copy link
Contributor

@sk593 sk593 left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Member

@brooke-hamilton brooke-hamilton left a comment

Choose a reason for hiding this comment

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

🚢

@radius-functional-tests
Copy link

radius-functional-tests bot commented Mar 27, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref 3526ac8
Unique ID func9de8fbacaa
Image tag pr-func9de8fbacaa
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-func9de8fbacaa
  • 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-func9de8fbacaa
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func9de8fbacaa
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func9de8fbacaa
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func9de8fbacaa
  • 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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
❌ Failed to install Radius for ucp-cloud functional test. Please check the logs for more details
❌ ucp-cloud functional test failed. Please check the logs for more details
❌ corerp-cloud functional test cancelled. Please check the logs for more details
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
❌ Failed to install Radius for ucp-cloud functional test. Please check the logs for more details
❌ ucp-cloud functional test failed. Please check the logs for more details
❌ corerp-cloud functional test cancelled. Please check the logs for more details

@radius-functional-tests
Copy link

radius-functional-tests bot commented Mar 28, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref cc19e18
Unique ID func115def619d
Image tag pr-func115def619d
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-func115def619d
  • 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-func115def619d
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func115def619d
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func115def619d
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func115def619d
  • 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...
❌ Failed to install Radius for corerp-cloud functional test. Please check the logs for more details
❌ Failed to install Radius for ucp-cloud functional test. Please check the logs for more details
❌ corerp-cloud functional test failed. Please check the logs for more details
❌ ucp-cloud functional test failed. Please check the logs for more details

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.

Pull-based "GitOps" deployments of Radius using Flux
6 participants