-
Notifications
You must be signed in to change notification settings - Fork 9
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
[chart/navi-attractor] chart syncup #519
Open
uk-navi-ci
wants to merge
1
commit into
develop
Choose a base branch
from
auto/chart/navi-attractor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v2 | ||
name: navi-attractor | ||
description: Attractor Helm chart | ||
type: application | ||
keywords: | ||
- navi | ||
- attractor | ||
version: 0.1.0 | ||
appVersion: 7.27.1.2 | ||
dependencies: | ||
- name: generic-chart | ||
version: '*' | ||
repository: file://../generic-chart | ||
maintainers: | ||
- name: 2gis | ||
url: https://github.com/2gis | ||
email: [email protected] |
Large diffs are not rendered by default.
Oops, something went wrong.
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,29 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.grpc.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "generic-chart.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.grpc.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "generic-chart.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "generic-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.grpc.port }} | ||
{{- else if contains "ClusterIP" .Values.service.grpc.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "generic-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} | ||
|
||
{{- if .Values.attractor.app_castle_host }} | ||
################################################################################# | ||
###### WARNING: `attractor.app_castle_host` has been deprecated! ##### | ||
###### We recommend using `attractor.castleUrl`. ##### | ||
################################################################################# | ||
{{- end }} |
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,242 @@ | ||
{{/* | ||
Distinguishable main container name | ||
Override generic-chart | ||
TODO: rewrite https://github.com/helm/helm/issues/11291 | ||
*/}} | ||
{{- define "generic-chart.containerName" -}} | ||
{{- if .Values.dataGroup.enabled }} | ||
{{- .Values.dataGroup.prefix }}-{{ .Chart.Name }} | ||
{{- else }} | ||
{{- .Chart.Name }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{- define "config.setCpuNumber" }} | ||
{{- $cpu_divider := 1 }} | ||
{{- $num_threads := 0 }} | ||
{{- $resources := regexSplit "m" (toString .Values.resources.limits.cpu) -1 }} | ||
{{- if eq (len $resources) 2 }} | ||
{{- $cpu_divider = 1000 }} | ||
{{- end }} | ||
{{- $cpu_value := index $resources 0 }} | ||
{{- $num_threads = ceil (divf $cpu_value $cpu_divider) }} | ||
{{- print $num_threads }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Renders a value or file that contains rules. | ||
Usage: | ||
{{ include "rules.renderRules" }} | ||
*/}} | ||
{{- define "rules.renderRules" -}} | ||
{{- $rules := list -}} | ||
{{- if ( and .Values.rules (kindIs "slice" .Values.rules )) -}} | ||
{{- $rules = .Values.rules -}} | ||
{{- end -}} | ||
{{ $rules | toPrettyJson | nindent 6 -}} | ||
{{- end -}} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Разное число пустых строк между блоками. Где-то одна, где-то две. |
||
|
||
{{/* | ||
Check if value exists in rule routing section | ||
Usage: | ||
{{ include "rules.inRoutingSection" ( dict "routingValue" "<value>" "context" $) }} | ||
*/}} | ||
{{- define "rules.inRoutingSection" -}} | ||
{{- $found := false -}} | ||
{{- if $.context.Values.rules -}} | ||
{{- range $.context.Values.rules -}} | ||
{{- if eq .name $.context.Values.attractor.app_rule -}} | ||
{{- if (has $.routingValue .routing) -}} | ||
{{- $found = true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- ternary "true" "" $found -}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Check if value exists in rule queries section | ||
Usage: | ||
{{ include "rules.inQueriesSection" ( dict "queriesValue" "<value>" "context" $) }} | ||
*/}} | ||
{{- define "rules.inQueriesSection" -}} | ||
{{- $found := false -}} | ||
{{- if $.context.Values.rules -}} | ||
{{- range $.context.Values.rules -}} | ||
{{- if eq .name $.context.Values.attractor.app_rule -}} | ||
{{- if (has $.queriesValue .queries) -}} | ||
{{- $found = true -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- ternary "true" "" $found -}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Set attractor_car parameter in server config section | ||
Usage: | ||
{{ include "config.setAttractorCar" $ }} | ||
*/}} | ||
{{- define "config.setAttractorCar" -}} | ||
{{- ternary | ||
$.Values.attractor.attractor.car | ||
(include "rules.inRoutingSection" (dict "routingValue" "driving" "context" $)) | ||
(hasKey $.Values.attractor.attractor "car") | ||
-}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Set attractor_pedestrian parameter in server config section | ||
Usage: | ||
{{ include "config.setAttractorPedestrian" $ }} | ||
*/}} | ||
{{- define "config.setAttractorPedestrian" -}} | ||
{{- ternary | ||
$.Values.attractor.attractor.pedestrian | ||
(or (include "rules.inRoutingSection" (dict "routingValue" "ctx" "context" $)) | ||
(include "rules.inRoutingSection" (dict "routingValue" "public_transport" "context" $)) | ||
(include "rules.inRoutingSection" (dict "routingValue" "pedestrian" "context" $))) | ||
(hasKey $.Values.attractor.attractor "pedestrian") | ||
-}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Set attractor_taxi parameter in server config section | ||
Usage: | ||
{{ include "config.setAttractorTaxi" $ }} | ||
*/}} | ||
{{- define "config.setAttractorTaxi" -}} | ||
{{- ternary | ||
$.Values.attractor.attractor.taxi | ||
(include "rules.inRoutingSection" (dict "routingValue" "taxi" "context" $)) | ||
(hasKey $.Values.attractor.attractor "taxi") | ||
-}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Set attractor_truck parameter in server config section | ||
Usage: | ||
{{ include "config.setAttractorTruck" $ }} | ||
*/}} | ||
{{- define "config.setAttractorTruck" -}} | ||
{{- ternary | ||
$.Values.attractor.attractor.truck | ||
(include "rules.inRoutingSection" (dict "routingValue" "truck" "context" $)) | ||
(hasKey $.Values.attractor.attractor "truck") | ||
-}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Set attractor_bicycle parameter in server config section | ||
Usage: | ||
{{ include "config.setAttractorBicycle" $ }} | ||
*/}} | ||
{{- define "config.setAttractorBicycle" -}} | ||
{{- ternary | ||
$.Values.attractor.attractor.bicycle | ||
(or (include "rules.inRoutingSection" (dict "routingValue" "bicycle" "context" $)) | ||
(include "rules.inRoutingSection" (dict "routingValue" "scooter" "context" $))) | ||
(or (hasKey $.Values.attractor.attractor "bicycle") (hasKey $.Values.attractor.attractor "scooter")) | ||
-}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Check if instance is running in truck mode | ||
Usage: | ||
{{ include "config.isTruck" $ }} | ||
*/}} | ||
{{- define "config.isTruck" -}} | ||
{{- $is_enabled_routing := ( eq "true" (include "rules.inRoutingSection" (dict "routingValue" "truck" "context" $))) -}} | ||
{{- ternary "true" "" $is_enabled_routing -}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Check if instance is running in ctx mode | ||
Usage: | ||
{{ include "config.isCTX" $ }} | ||
*/}} | ||
{{- define "config.isCTX" -}} | ||
{{- $is_enabled_routing := ( or (eq "true" (include "rules.inRoutingSection" (dict "routingValue" "ctx" "context" $))) (eq "true" (include "rules.inRoutingSection" (dict "routingValue" "public_transport" "context" $)))) -}} | ||
{{- $is_enabled_query := ( or (eq "true" (include "rules.inQueriesSection" (dict "queriesValue" "ctx" "context" $))) (eq "true" (include "rules.inQueriesSection" (dict "queriesValue" "public_transport" "context" $)))) -}} | ||
{{- ternary "true" "" (or $is_enabled_routing $is_enabled_query) -}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Check if instance is running in taxi mode | ||
Usage: | ||
{{ include "config.isTaxi" $ }} | ||
*/}} | ||
{{- define "config.isTaxi" -}} | ||
{{- $is_enabled_routing := ( eq "true" (include "rules.inRoutingSection" (dict "routingValue" "taxi" "context" $))) -}} | ||
{{- ternary "true" "" $is_enabled_routing -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Check if map matching is enabled | ||
Usage: | ||
{{ include "config.isMapMatching" $ }} | ||
*/}} | ||
{{- define "config.isMapMatching" -}} | ||
{{- include "rules.inQueriesSection" (dict "queriesValue" "map_matching" "context" $) -}} | ||
{{- end -}} | ||
|
||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
Set castle url | ||
If use frozenData return local path | ||
Usage: | ||
{{ include "config.setCastleUrl" $ }} | ||
*/}} | ||
{{- define "config.setCastleUrl" -}} | ||
{{- if .Values.frozenData.enabled -}} | ||
{{- printf "file://{LOCAL_PATH}" -}} | ||
{{- else if .Values.attractor.castleUrl -}} | ||
{{- printf .Values.attractor.castleUrl -}} | ||
{{- else if .Values.attractor.app_castle_host -}} | ||
{{- printf "http://%s" .Values.attractor.app_castle_host -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Set restriction url | ||
If rtr enabled return attractor.rtr.url, else return attractor.castleUrl | ||
Usage: | ||
{{ include "config.setRestrictionUrl" $ }} | ||
*/}} | ||
{{- define "config.setRestrictionUrl" -}} | ||
{{- if .Values.attractor.rtr.enabled -}} | ||
{{- printf .Values.attractor.rtr.url -}} | ||
{{- else -}} | ||
{{- printf (include "config.setCastleUrl" $) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Set probe | ||
If mock enable then use http probe, else user grpc probe | ||
Usage: | ||
{{ include "navi-attractor.probe" . }} | ||
*/}} | ||
{{- define "navi-attractor.probe" -}} | ||
{{- if .Values.attractor.mock -}} | ||
httpGet: | ||
path: /about | ||
port: http | ||
{{- else -}} | ||
grpc: | ||
port: {{ .Values.attractor.grpcPort }} | ||
{{- end -}} | ||
{{- end -}} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Объявление нового шаблона с именем из чужого домена.
При чтении чарта не понятно где её искать. В этом чарте или в чарте
generic-chart