-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description This change adds a new control-plane microservice - the "Dynamic RP". The dynamic-rp will be responsible for implementing the bulk of UDT functionality. The naming reflects that fact that dynamic-rp behaves *dynamically* based on the schema definitions provided by users. This change only contains the *base layer* for dynamic-rp and no user-visible functionality. Here's a brief list of what's included. - dynamic-rp binary - dynamic-rp Dockerfiles - dynamic-rp Kubernetes yaml - dynamic-rp configuration file - initialization and stubs for frontend and backend services - vscode debugging support - functional test integration The actual functionality for dynamic-rp will be added in a series of follow-up pull-requests. _Please explain the changes you've made._ ## Type of change - This pull request adds or changes features of Radius and has an approved issue (issue link required). 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](https://github.com/radius-project/design-notes/), 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](https://github.com/radius-project/samples) is created, if existing samples are affected by the changes in this PR. - [ ] A PR for the [documentation repository](https://github.com/radius-project/docs) is created, if the changes in this PR affect the documentation or any user facing updates are made. - [ ] A PR for the [recipes repository](https://github.com/radius-project/recipes) is created, if existing recipes are affected by the changes in this PR. Signed-off-by: Ryan Nowak <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,007 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
Copyright 2023 The Radius Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/go-logr/logr" | ||
"github.com/spf13/cobra" | ||
runtimelog "sigs.k8s.io/controller-runtime/pkg/log" | ||
|
||
"github.com/radius-project/radius/pkg/armrpc/hostoptions" | ||
"github.com/radius-project/radius/pkg/dynamicrp" | ||
"github.com/radius-project/radius/pkg/dynamicrp/server" | ||
"github.com/radius-project/radius/pkg/ucp/hosting" | ||
"github.com/radius-project/radius/pkg/ucp/ucplog" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "dynamic-rp", | ||
Short: "Dyanamic Resource Provider server", | ||
Long: `Server process for the Dynamic Resource Provider (dynamic-rp).`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
configFilePath := cmd.Flag("config-file").Value.String() | ||
bs, err := os.ReadFile(configFilePath) | ||
if err != nil { | ||
return fmt.Errorf("failed to read config file %s: %w", configFilePath, err) | ||
} | ||
|
||
config, err := dynamicrp.LoadConfig(bs) | ||
if err != nil { | ||
return fmt.Errorf("failed to parse config file %s: %w", configFilePath, err) | ||
} | ||
|
||
options, err := dynamicrp.NewOptions(cmd.Context(), config) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
logger, flush, err := ucplog.NewLogger(ucplog.LoggerName, &options.Config.Logging) | ||
if err != nil { | ||
return err | ||
} | ||
defer flush() | ||
|
||
// Must set the logger before using controller-runtime. | ||
runtimelog.SetLogger(logger) | ||
|
||
host, err := server.NewServer(options) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
ctx := logr.NewContext(cmd.Context(), logger) | ||
|
||
return hosting.RunWithInterrupts(ctx, host) | ||
}, | ||
} | ||
|
||
func Execute() { | ||
// Let users override the configuration via `--config-file`. | ||
rootCmd.Flags().String("config-file", fmt.Sprintf("dynamicrp-%s.yaml", hostoptions.Environment()), "The service configuration file.") | ||
|
||
cobra.CheckErr(rootCmd.ExecuteContext(context.Background())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This is an example of configuration file. | ||
environment: | ||
name: Dev | ||
roleLocation: "global" | ||
storageProvider: | ||
provider: "apiserver" | ||
apiserver: | ||
context: '' | ||
namespace: 'radius-testing' | ||
queueProvider: | ||
provider: "apiserver" | ||
name: dynamic-rp | ||
apiserver: | ||
context: '' | ||
namespace: 'radius-testing' | ||
secretProvider: | ||
provider: "kubernetes" | ||
profilerProvider: | ||
enabled: false | ||
port: 6062 | ||
metricsProvider: | ||
prometheus: | ||
enabled: false | ||
path: "/metrics" | ||
port: 9092 | ||
server: | ||
host: "0.0.0.0" | ||
port: 8082 | ||
workerServer: | ||
maxOperationConcurrency: 10 | ||
maxOperationRetryCount: 2 | ||
ucp: | ||
kind: direct | ||
direct: | ||
endpoint: "http://localhost:9000/apis/api.ucp.dev/v1alpha3" | ||
logging: | ||
level: "info" | ||
json: false | ||
bicep: | ||
deleteRetryCount: 20 | ||
deleteRetryDelaySeconds: 60 | ||
terraform: | ||
path: "/terraform" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Copyright 2023 The Radius Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import "github.com/radius-project/radius/cmd/dynamic-rp/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: dynamic-rp-config | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app.kubernetes.io/name: dynamic-rp | ||
app.kubernetes.io/part-of: radius | ||
data: | ||
radius-self-host.yaml: |- | ||
# Radius configuration file. | ||
# See https://github.com/radius-project/radius/blob/main/docs/contributing/contributing-code/contributing-code-control-plane/configSettings.md for more information. | ||
environment: | ||
name: self-hosted | ||
roleLocation: "global" | ||
storageProvider: | ||
provider: "apiserver" | ||
apiserver: | ||
context: "" | ||
namespace: "radius-system" | ||
queueProvider: | ||
provider: "apiserver" | ||
name: "dynamic-rp" | ||
apiserver: | ||
context: "" | ||
namespace: "radius-system" | ||
metricsProvider: | ||
prometheus: | ||
enabled: true | ||
path: "/metrics" | ||
port: 9092 | ||
profilerProvider: | ||
enabled: true | ||
port: 6062 | ||
secretProvider: | ||
provider: kubernetes | ||
server: | ||
host: "0.0.0.0" | ||
port: 8082 | ||
workerServer: | ||
maxOperationConcurrency: 10 | ||
maxOperationRetryCount: 2 | ||
ucp: | ||
kind: kubernetes | ||
logging: | ||
level: "info" | ||
json: true | ||
{{- if and .Values.global.zipkin .Values.global.zipkin.url }} | ||
tracerProvider: | ||
serviceName: "dynamic-rp" | ||
zipkin: | ||
url: {{ .Values.global.zipkin.url }} | ||
{{- end }} | ||
bicep: | ||
deleteRetryCount: 20 | ||
deleteRetryDelaySeconds: 60 | ||
terraform: | ||
path: "/terraform" |
Oops, something went wrong.