Skip to content

Commit

Permalink
Merge pull request #154 from vertigobr/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
thiagoclessa authored Sep 28, 2023
2 parents 2ab21fa + e80ca9c commit 07ef23c
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 17 deletions.
30 changes: 19 additions & 11 deletions vkpr/devportal/install/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ formulaInputs() {
checkGlobalConfig "$VKPR_ENV_GLOBAL_INGRESS_CLASS_NAME" "$VKPR_ENV_GLOBAL_INGRESS_CLASS_NAME" "devportal.ingressClassName" "DEVPORTAL_INGRESS_CLASS_NAME"
checkGlobalConfig "$VKPR_ENV_GLOBAL_NAMESPACE" "$VKPR_ENV_GLOBAL_NAMESPACE" "devportal.namespace" "DEVPORTAL_NAMESPACE"
checkGlobalConfig "$PROVIDER" "" "devportal.provider" "CATALOG_PROVIDER"
}
checkGlobalConfig "$GIT_BRANCH" "" ".catalog.providers.branch" "GIT_BRANCH"
checkGlobalConfig "$GIT_REPO" "" ".catalog.providers.repository" "GIT_REPO"
checkGlobalConfig "$GITHUB_CLIENT_ID" "" ".auth.providers.github.clientId" "GITHUB_CLIENT_ID"
checkGlobalConfig "$GITHUB_CLIENT_SECRET" "" ".auth.providers.github.clientSecret" "GITHUB_CLIENT_SECRET"
checkGlobalConfig "$GITHUB_TOKEN" "" ".integrations.github.token" "GITHUB_TOKEN"
checkGlobalConfig "$GITHUB_ORGANIZATION" "" ".catalog.providers.repository" "GITHUB_ORGANIZATION"
checkGlobalConfig "$CLIENT_GROUPS" "" ".catalog.providers.gitlab.group" "CLIENT_GROUPS"
checkGlobalConfig "$GITLAB_TOKEN" "" ".integrations.gitlab.token" "GITLAB_TOKEN"

}
validateInputs() {
validateDevportalDomain "$VKPR_ENV_GLOBAL_DOMAIN"
validateDevportalSecure "$VKPR_ENV_GLOBAL_SECURE"
Expand Down Expand Up @@ -68,21 +76,21 @@ settingDevportal(){
github)
YQ_VALUES="$YQ_VALUES |
del(.catalog.providers.gitlab) |
.auth.providers.github.clientId = \"$GITHUB_CLIENT_ID\" |
.auth.providers.github.clientSecret = \"$GITHUB_CLIENT_SECRET\" |
.integrations.github.token = \"$GITHUB_TOKEN\" |
.catalog.providers.github.organization = \"$CLIENT_ORGANIZATION\" |
.catalog.providers.github.filters.repository = \"$GIT_REPO\" |
.catalog.providers.github.filters.branch = \"$GIT_BRANCH\"
.auth.providers.github.clientId = \"$VKPR_ENV_GITHUB_CLIENT_ID\" |
.auth.providers.github.clientSecret = \"$VKPR_ENV_GITHUB_CLIENT_SECRET\" |
.integrations.github.token = \"$VKPR_ENV_GITHUB_TOKEN\" |
.catalog.providers.github.organization = \"$VKPR_ENV_CLIENT_ORGANIZATION\" |
.catalog.providers.github.filters.repository = \"$VKPR_ENV_GIT_REPO\" |
.catalog.providers.github.filters.branch = \"$VKPR_ENV_GIT_BRANCH\"
"
;;
gitlab)
YQ_VALUES="$YQ_VALUES |
del(.catalog.providers.github) |
.integrations.gitlab.token = \"$GITLAB_TOKEN\" |
.catalog.providers.gitlab.group = \"$CLIENT_GROUPS\" |
.catalog.providers.gitlab.projectPattern = \"$GIT_REPO\" |
.catalog.providers.gitlab.branch = \"$GIT_BRANCH\"
.integrations.gitlab.token = \"$VKPR_ENV_GITLAB_TOKEN\" |
.catalog.providers.gitlab.group= \"$$VKPR_ENV_CLIENT_GROUPS\" |
.catalog.providers.gitlab.projectPattern = \"$VKPR_ENV_GIT_REPO\" |
.catalog.providers.gitlab.branch = \"$VKPR_ENV_GIT_BRANCH\"
"
;;
*)
Expand Down
15 changes: 10 additions & 5 deletions vkpr/jaeger/install/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ runFormula() {

VKPR_ENV_JAEGER_DOMAIN="jaeger.${VKPR_ENV_GLOBAL_DOMAIN}"
VKPR_JAEGER_VALUES=$(dirname "$0")/utils/jaeger.yaml
VKPR_JAEGER_DATASOURCE=$(dirname "$0")/utils/datasource.json
VKPR_JAEGER_DATASOURCE=$(dirname "$0")/utils/prometheus-stack-kube-prom-grafana-datasource.yaml
#VKPR_JAEGER_DATASOURCE=$(dirname "$0")/utils/datasource.json


startInfos
settingJaeger
Expand Down Expand Up @@ -63,10 +65,13 @@ settingJaeger() {
.allInOne.ingress.ingressClassName = \"$VKPR_ENV_JAEGER_INGRESS_CLASS_NAME\"
"
if [[ "$VKPR_ENV_JAEGER_METRICS" == true ]] && [[ $(checkPodName "$VKPR_ENV_GRAFANA_NAMESPACE" "prometheus-stack-grafana") == "true" ]]; then
DATASOURCE_URL="http://jaeger-query.$VKPR_ENV_JAEGER_NAMESPACE:16686/"
$VKPR_JQ ".url = \"$DATASOURCE_URL\"" $VKPR_JAEGER_DATASOURCE > tmp.json
cat tmp.json > $VKPR_JAEGER_DATASOURCE && rm tmp.json
createGrafanaDatasource "$VKPR_JAEGER_DATASOURCE" "$VKPR_ENV_GRAFANA_NAMESPACE"
$VKPR_KUBECTL apply -f "$VKPR_JAEGER_DATASOURCE" -n "$VKPR_ENV_JAEGER_NAMESPACE"


# DATASOURCE_URL="jaeger-query.$VKPR_ENV_JAEGER_NAMESPACE:16686/"
# $VKPR_JQ ".url = \"$DATASOURCE_URL\"" $VKPR_JAEGER_DATASOURCE > tmp.json
# cat tmp.json > $VKPR_JAEGER_DATASOURCE && rm tmp.json
# createGrafanaDatasource "$VKPR_JAEGER_DATASOURCE" "$VKPR_ENV_GRAFANA_NAMESPACE"

# createGrafanaDashboard "$(dirname "$0")/utils/dashboard.json" "$VKPR_ENV_GRAFANA_NAMESPACE"
# YQ_VALUES="$YQ_VALUES |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
data:
datasource.yaml: |-
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
uid: prometheus
url: http://prometheus-stack-kube-prom-prometheus.vkpr:9090
access: proxy
isDefault: true
jsonData:
httpMethod: POST
timeInterval: 10s
- access: proxy
basicAuth: false
editable: true
isDefault: false
name: Loki
type: loki
uid: loki
url: http://loki.vkpr:3100
version: 1
- name: Jaeger
type: jaeger
uid: jaeger
access: http
url: http://jaeger-query.vkpr:16686
isDefault: false
version: 1
editable: true
basicAuth: false
kind: ConfigMap
metadata:
annotations:
meta.helm.sh/release-name: prometheus-stack
meta.helm.sh/release-namespace: vkpr
creationTimestamp: "2023-09-25T15:50:01Z"
labels:
app: kube-prometheus-stack-grafana
app.kubernetes.io/instance: prometheus-stack
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: kube-prometheus-stack
app.kubernetes.io/version: 45.20.0
chart: kube-prometheus-stack-45.20.0
grafana_datasource: "1"
heritage: Helm
release: prometheus-stack
name: prometheus-stack-kube-prom-grafana-datasource
namespace: vkpr

13 changes: 13 additions & 0 deletions vkpr/otel/install/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
"false"
]
},
{
"tutorial": "Instrumentation namespace aplication",
"condition": {
"variable": "otel_auto",
"operator": "==",
"value": "true"
},
"label": "Instrumentation Namespace Aplication ?",
"name": "INSTRUMENTATION_NAMESPACE",
"type": "text",
"required": true,
"default": "vkpr"
},
{
"tutorial": "Simulate an install",
"label": "Dry-run ?",
Expand Down
4 changes: 3 additions & 1 deletion vkpr/otel/install/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runFormula() {
fi

if [[ "$VKPR_ENV_OTEL_AUTO" == true ]]; then
$VKPR_KUBECTL apply -f "$VKPR_INSTRUMENTATION" -n "$VKPR_ENV_OTEL_NAMESPACE"
$VKPR_KUBECTL apply -f "$VKPR_INSTRUMENTATION" -n "$VKPR_ENV_INSTRUMENTATION_NAMESPACE"
fi

}
Expand All @@ -38,12 +38,14 @@ startInfos() {
boldNotice "Namespace: $VKPR_ENV_OTEL_NAMESPACE"
boldNotice "Trace: $VKPR_ENV_TRACE"
boldNotice "Auto Instrumentation: $VKPR_ENV_OTEL_AUTO"
boldNotice "Instrumentation Namespace: $VKPR_ENV_INSTRUMENTATION_NAMESPACE"
bold "=============================="
}

formulaInputs() {
# App values
checkGlobalConfig "$VKPR_ENV_GLOBAL_NAMESPACE" "$VKPR_ENV_GLOBAL_NAMESPACE" "otel.namespace" "OTEL_NAMESPACE"
checkGlobalConfig "$INSTRUMENTATION_NAMESPACE" "$VKPR_ENV_GLOBAL_NAMESPACE" "otel.instrumentation" "INSTRUMENTATION_NAMESPACE"
checkGlobalConfig "$OTEL_AUTO" "true" "otel.auto.enable" "OTEL_AUTO"
checkGlobalConfig "$TRACE" "jaeger" "otel.trace" "TRACE"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ prometheusOperator:
enabled: true
prometheus:
enabled: true

0 comments on commit 07ef23c

Please sign in to comment.