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 DeploymentTemplate controller for GitOps support #8001

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

Conversation

willdavsmith
Copy link
Contributor

@willdavsmith willdavsmith commented Oct 17, 2024

Description

  • Add rad bicep generate-kubernetes-manifest CLI
  • Add DeploymentTemplate controller
  • Add DeploymentResource controller

Type of change

  • This pull request adds or changes features of Radius and has an approved issue (issue link required).

#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.
  • 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.

}

type OSFileSystem struct {
FileSystem afero.Fs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instead of writing a filesystem abstraction I added this afero library. Seems to be widely used, I replaced the OSFileSystem with it. LMK if I should revert

Copy link
Contributor

Choose a reason for hiding this comment

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

are there added functionalities that we get using afero or is the main benefit that's it's an abstraction layer over os?

Copy link
Contributor

@brooke-hamilton brooke-hamilton Nov 8, 2024

Choose a reason for hiding this comment

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

instead of writing a filesystem abstraction I added this afero library. Seems to be widely used, I replaced the OSFileSystem with it. LMK if I should revert

The afero repo appears to have no commits for a year even though there are open PRs for it, including one for a CVE. I don't see depndabot PRs being active in the list at all, which suggests that this dependency could open us up to some security issues. None of the issues created in the last year have any comments or responses. If there's a compelling reason for using this library, then let's discuss how to manage it.

On the other hand, Radius already depends on viper, which gives us an indirect dependency on afero.

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 find! I added it here because the stdlib fs does not include a filesystem abstraction with CreateFile. The benefit of adding afero was to not have to implement and maintain this ourselves. Since we already indirectly depend on this library, and that it's a pretty widespread dependency, I'd say we should be okay to use it. Thoughts? @brooke-hamilton

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rynowak thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the savings of using this library? I don't have fundamental concerns about it, I just can't tell from the diff what's going to change.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also really like to remove viper as a dependency. We've got a lot of workarounds in place for for behaviors that aren't helpful to us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed afero as a dependency and wrote a simple filesystem abstraction that we can use

@@ -527,7 +527,6 @@ func Test_Run(t *testing.T) {
})

t.Run("Deployment with missing parameters", func(t *testing.T) {
//t.Skip()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing commented out t.Skip()

@willdavsmith willdavsmith changed the title [WIP/ Do not review] Flux support Add DeploymentTemplate controller Nov 1, 2024
@willdavsmith willdavsmith marked this pull request as ready for review November 1, 2024 20:14
@willdavsmith willdavsmith requested review from a team as code owners November 1, 2024 20:14
@radius-functional-tests
Copy link

radius-functional-tests bot commented Nov 1, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref a774840
Unique ID func56e23e2717
Image tag pr-func56e23e2717
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • 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-func56e23e2717
  • 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-func56e23e2717
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func56e23e2717
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func56e23e2717
  • 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

bicep-types Outdated Show resolved Hide resolved
Copy link
Contributor

@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 ran make generate build test and got 8 failures.

=== FAIL: pkg/cli/cmd/bicep/generatekubernetesmanifest Test_Run/Create_basic_DeploymentTemplate (0.00s)
=== FAIL: pkg/cli/cmd/bicep/generatekubernetesmanifest Test_Run/Create_DeploymentTemplate_with_template_content (0.00s)
=== FAIL: pkg/cli/cmd/bicep/generatekubernetesmanifest Test_Run/Create_DeploymentTemplate_with_Azure_scope (0.00s)
=== FAIL: pkg/cli/cmd/bicep/generatekubernetesmanifest Test_Run/Create_DeploymentTemplate_with_AWS_scope (0.00s)
=== FAIL: pkg/cli/cmd/bicep/generatekubernetesmanifest Test_Run (0.00s)
=== FAIL: pkg/controller/reconciler Test_DeploymentResourceReconciler_Basic (10.01s)
=== FAIL: pkg/controller/reconciler Test_DeploymentTemplateReconciler_Basic (0.01s)
=== FAIL: pkg/controller/reconciler Test_DeploymentTemplateReconciler_FailureRecovery (0.00s)

Here's one example:

=== FAIL: pkg/cli/cmd/bicep/generatekubernetesmanifest Test_Run/Create_DeploymentTemplate_with_Azure_scope (0.00s)
Creating DeploymentTemplate YAML file
    generatekubernetesmanifest_test.go:396: 
                Error Trace:    /workspaces/radius/pkg/cli/cmd/bicep/generatekubernetesmanifest/generatekubernetesmanifest_test.go:396
                Error:          Not equal: 
                                expected: "apiVersion: radapp.io/v1alpha3\nkind: DeploymentTemplate\nmetadata:\n  name: azure.yaml\n  namespace: radius-system\nspec:\n  parameters: '{}'\n  providerConfig: '{\"radius\":{\"type\":\"radius\",\"value\":{\"scope\":\"/planes/radius/local/resourceGroups/test-resource-group\"}},\"az\":{\"type\":\"azure\",\"value\":{\"scope\":\"/subscriptions/test-subId/resourceGroups/test-rg\"}},\"deployments\":{\"type\":\"Microsoft.Resources\",\"value\":{\"scope\":\"/planes/radius/local/resourceGroups/test-resource-group\"}}}'\n  template: '{}'\n"
                                actual  : "apiVersion: radapp.io/v1alpha3\nkind: DeploymentTemplate\nmetadata:\n  name: azure.yaml\n  namespace: radius-system\nspec:\n  parameters: '{}'\n  providerConfig: '{\"radius\":{\"type\":\"radius\",\"value\":{\"scope\":\"/planes/radius/local/resourceGroups/test-resource-group\"}},\"az\":{\"type\":\"azure\",\"value\":{\"scope\":\"/subscriptions/test-subId/resourceGroups/test-rg\"}},\"deployments\":{\"type\":\"Microsoft.Resources\",\"value\":{\"scope\":\"/planes/radius/local/resourceGroups/test-resource-group\"}}}'\n  repository: azure.yaml\n  template: '{}'\n"
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -8,2 +8,3 @@
                                   providerConfig: '{"radius":{"type":"radius","value":{"scope":"/planes/radius/local/resourceGroups/test-resource-group"}},"az":{"type":"azure","value":{"scope":"/subscriptions/test-subId/resourceGroups/test-rg"}},"deployments":{"type":"Microsoft.Resources","value":{"scope":"/planes/radius/local/resourceGroups/test-resource-group"}}}'
                                +  repository: azure.yaml
                                   template: '{}'
                Test:           Test_Run/Create_DeploymentTemplate_with_Azure_scope
    --- FAIL: Test_Run/Create_DeploymentTemplate_with_Azure_scope (0.00s)

Copy link
Contributor

@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.

Running make generate results in these files being changed.

deploy/Chart/crds/radius/radapp.io_deploymentresources.yaml
deploy/Chart/crds/radius/radapp.io_deploymenttemplates.yaml
deploy/Chart/crds/radius/radapp.io_recipes.yaml
deploy/Chart/crds/ucpd/ucp.dev_queuemessages.yaml
deploy/Chart/crds/ucpd/ucp.dev_resources.yaml

For example, controller-gen.kubebuilder.io/version: v0.16.4 changes to controller-gen.kubebuilder.io/version: v0.16.0

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

radius-functional-tests bot commented Dec 24, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 0f9fd39
Unique ID funcb8e08afbc1
Image tag pr-funcb8e08afbc1
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-funcb8e08afbc1
  • 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-funcb8e08afbc1
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcb8e08afbc1
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcb8e08afbc1
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcb8e08afbc1
  • 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: willdavsmith <[email protected]>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 26, 2024

Radius functional test overview

🔍 Go to test action run

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

@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 26, 2024

Radius functional test overview

🔍 Go to test action run

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

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

radius-functional-tests bot commented Dec 27, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 667b682
Unique ID func58d5248511
Image tag pr-func58d5248511
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-func58d5248511
  • 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-func58d5248511
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func58d5248511
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func58d5248511
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func58d5248511
  • 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: willdavsmith <[email protected]>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 27, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 483e210
Unique ID funcbf34660b36
Image tag pr-funcbf34660b36
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-funcbf34660b36
  • 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-funcbf34660b36
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcbf34660b36
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcbf34660b36
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcbf34660b36
  • 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

@radius-functional-tests
Copy link

radius-functional-tests bot commented Jan 10, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 92088d1
Unique ID funcf74af565f0
Image tag pr-funcf74af565f0
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-funcf74af565f0
  • 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-funcf74af565f0
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcf74af565f0
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcf74af565f0
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcf74af565f0
  • 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...
✅ 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.

4 participants