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

refactoring helm chart #5353

Merged
merged 14 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deploy/Chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ dependencies:
- name: ucp
version: '42.42.42-dev'
repository: "file://ucp"
- name: appcore-rp
- name: radius-rp
version: '42.42.42-dev'
repository: "file://appcore-rp"
repository: "file://radius-rp"
9 changes: 5 additions & 4 deletions deploy/Chart/charts/de/templates/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ spec:
value: https://ucp.radius-system:443/apis/api.ucp.dev/v1alpha3
- name: ASPNETCORE_Logging__LogLevel__Default
value: "Debug"
# TODO: Enable trace provider in 0.19
# - name: ASPNETCORE_Zipkin__Endpoint
# value: "http://jaeger-collector.radius-monitoring.svc.cluster.local:9411/api/v2/spans"
image: {{ .Values.global.engine.image }}:{{ .Values.global.engine.tag }}
{{ if and .Values.global.zipkin .Values.global.zipkin.url }}
- name: ASPNETCORE_Zipkin__Endpoint
value: {{ .Values.global.zipkin.url }}
{{ end }}
image: {{ .Values.image }}:{{ .Values.tag }}
name: de
ports:
- containerPort: 6443
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: appcore-rp
description: Applications.Core Radius service
name: radius-rp
description: Radius service
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: Radius service
description: Radius service

type: application
# We automate versioning of the chart during publishing.
# The value here is only used for a dev build.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ ucp:
logging:
level: "info"
json: true
{{ if and .Values.global.tracerProvider .Values.global.tracerProvider.zipkin .Values.global.tracerProvider.zipkin.url }}
# Distributed Trace configuration
{{ if and .Values.global.zipkin .Values.global.zipkin.url }}
tracerProvider:
serviceName: "applications.link"
zipkin:
url: {{ .Values.global.tracerProvider.zipkin.url }}
url: {{ .Values.global.zipkin.url }}
{{ end }}

{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- --config-file=/etc/config/radius-self-host.yaml
- --run-link
- --link-config=/etc/config/link-self-host.yaml
image: {{ .Values.global.appcorerp.image }}:{{ .Values.global.appcorerp.tag }}
image: {{ .Values.image }}:{{ .Values.tag }}
env:
- name: SKIP_ARM
value: 'false'
Expand All @@ -41,9 +41,9 @@ spec:
value: 'true'
- name: SKIP_AUTH
value: 'true'
{{ if .Values.global.rp.publicEndpointOverride}}
{{ if .Values.publicEndpointOverride}}
- name: RADIUS_PUBLIC_ENDPOINT_OVERRIDE
value: {{ .Values.global.rp.publicEndpointOverride }}
value: {{ .Values.publicEndpointOverride }}
{{ end }}
name: appcore-rp
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ ucp:
logging:
level: "info"
json: true
{{ if and .Values.global.tracerProvider .Values.global.tracerProvider.zipkin .Values.global.tracerProvider.zipkin.url }}
# Distributed Trace configuration
{{ if and .Values.global.zipkin .Values.global.zipkin.url }}
tracerProvider:
serviceName: "applications.core"
zipkin:
url: {{ .Values.global.tracerProvider.zipkin.url }}
url: {{ .Values.global.zipkin.url }}
{{ end }}
{{ end }}
7 changes: 4 additions & 3 deletions deploy/Chart/charts/ucp/templates/ucp-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ metricsProvider:
path: "/metrics"
port: 9090

# Logging configuration
# Logging configuration
logging:
level: "info"
json: true

{{ if and .Values.global.tracerProvider .Values.global.tracerProvider.zipkin .Values.global.tracerProvider.zipkin.url }}
# Distributed Trace configuration
{{ if and .Values.global.zipkin .Values.global.zipkin.url }}
tracerProvider:
serviceName: "ucp"
zipkin:
url: {{ .Values.global.tracerProvider.zipkin.url }}
url: {{ .Values.global.zipkin.url }}
{{ end }}
{{ end }}
6 changes: 3 additions & 3 deletions deploy/Chart/charts/ucp/templates/ucp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
spec:
serviceAccountName: ucp
containers:
- image: "{{ .Values.global.ucp.image }}:{{ .Values.global.ucp.tag }}"
- image: "{{ .Values.image }}:{{ .Values.tag }}"
env:
- name: UCP_CONFIG
value: /etc/config/ucp-config.yaml
Expand All @@ -35,9 +35,9 @@ spec:
value: '/var/tls/cert'
- name: PORT
value: '9443'
{{ if .Values.global.rp.provider.aws }}
{{ if and .Values.provider .Values.provider.aws }}
- name: AWS_REGION
value: {{ .Values.global.rp.provider.aws.region }}
value: {{ .Values.provider.aws.region }}
{{ end }}
name: ucp
ports:
Expand Down
37 changes: 19 additions & 18 deletions deploy/Chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
de:
image: radius.azurecr.io/deployment-engine
tag: latest
ucp:
image: radius.azurecr.io/ucpd
tag: latest
# provider can be also set using rad env init --provider-aws
# provider:
# aws:
# region:"us-east"
kachawla marked this conversation as resolved.
Show resolved Hide resolved
radius-rp:
image: radius.azurecr.io/appcore-rp
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 plan to change the image to radius-rp as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure.. @youngbupark , should I create a ticket for renaming image?

tag: latest
publicEndpointOverride: ""
global:
engine:
image: radius.azurecr.io/deployment-engine
tag: latest
appcorerp:
image: radius.azurecr.io/appcore-rp
tag: latest # Tag for appcore-rp image.
provider:
azure: {}
ucp:
image: radius.azurecr.io/ucpd
tag: latest # Tag for ucp image.
radius:
container: radius.azurecr.io/radius-controller
tag: latest # Tag for radius-controller image.
rp:
provider:
azure: {}
publicEndpointOverride: ""
prometheus:
enabled: true
path: "/metrics"
port: 9090
#
# Configure global.zipkin.url to enable distributed trace
# zipkin:
# url: "http://jaeger-collector.radius-monitoring.svc.cluster.local:9411/api/v2/spans"
#
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this also an example?

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 :)

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could you add "Example" in the comments?

78 changes: 10 additions & 68 deletions pkg/cli/helm/radiusclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ func ApplyRadiusHelmChart(options RadiusOptions, kubeContext string) (bool, erro
return false, fmt.Errorf("failed to add radius values, err: %w, helm output: %s", err, helmOutput.String())
}

if options.AzureProvider != nil {
err = addAzureProviderValues(helmChart, options.AzureProvider)
if err != nil {
return false, fmt.Errorf("failed to add azure provider values, err: %w, helm output: %s", err, helmOutput.String())
}
}

if options.AWSProvider != nil {
err = addAWSProviderValues(helmChart, options.AWSProvider)
if err != nil {
Expand Down Expand Up @@ -301,76 +294,25 @@ func addAWSProviderValues(helmChart *chart.Chart, awsProvider *aws.Provider) err
}
values := helmChart.Values

_, ok := values["global"]
_, ok := values["ucp"]
if !ok {
values["global"] = make(map[string]any)
values["ucp"] = make(map[string]any)
}
global := values["global"].(map[string]any)
ucp := values["ucp"].(map[string]any)

_, ok = global["rp"]
_, ok = ucp["provider"]
if !ok {
global["rp"] = make(map[string]any)
ucp["provider"] = make(map[string]any)
}
rp := global["rp"].(map[string]any)
provider := ucp["provider"].(map[string]any)

_, ok = rp["provider"]
_, ok = provider["aws"]
if !ok {
rp["provider"] = make(map[string]any)
}
provider := rp["provider"].(map[string]any)

provider["aws"] = map[string]any{
"accessKeyId": awsProvider.AccessKeyId,
"secretAccessKey": awsProvider.SecretAccessKey,
"region": awsProvider.TargetRegion,
}

Choose a reason for hiding this comment

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

Can you please remove addAzureProviderValues too ?


return nil
}

func addAzureProviderValues(helmChart *chart.Chart, azureProvider *azure.Provider) error {
if azureProvider == nil {
return nil
}
values := helmChart.Values

_, ok := values["global"]
if !ok {
values["global"] = make(map[string]any)
}
global := values["global"].(map[string]any)

_, ok = global["rp"]
if !ok {
global["rp"] = make(map[string]any)
}
rp := global["rp"].(map[string]any)

_, ok = rp["provider"]
if !ok {
rp["provider"] = make(map[string]any)
}
provider := rp["provider"].(map[string]any)

_, ok = provider["azure"]
if !ok {
provider["azure"] = make(map[string]any)
}

azure := provider["azure"].(map[string]any)

if azureProvider.ServicePrincipal != nil {
_, ok = azure["servicePrincipal"]
if !ok {
azure["servicePrincipal"] = make(map[string]any)
}
azure["servicePrincipal"] = map[string]any{
"clientId": azureProvider.ServicePrincipal.ClientID,
"clientSecret": azureProvider.ServicePrincipal.ClientSecret,
"tenantId": azureProvider.ServicePrincipal.TenantID,
}
provider["aws"] = make(map[string]any)
}
aws := provider["aws"].(map[string]any)

aws["region"] = awsProvider.TargetRegion
kachawla marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

Expand Down