Skip to content

Commit

Permalink
bump monitoring to 102.0.0+up40.1.2
Browse files Browse the repository at this point in the history
  patch nginx-config file with values from 102.0.1+up40.1.2

  fix the tar time check warnng

Signed-off-by: Jian Wang <w13915984028@gmail.com>
  • Loading branch information
w13915984028 committed May 30, 2023
1 parent 746783b commit 984295f
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-nginx-proxy-config
namespace: {{ template "grafana.namespace" . }}
labels:
{{- include "grafana.labels" . | nindent 4 }}
data:
nginx.conf: |-
worker_processes auto;
error_log /dev/stdout warn;
pid /var/cache/nginx/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
log_format main '[$time_local - $status] $remote_addr - $remote_user $request ($http_referer)';
proxy_connect_timeout 10;
proxy_read_timeout 180;
proxy_send_timeout 5;
proxy_buffering off;
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=my_zone:100m inactive=1d max_size=10g;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8080;
access_log off;
gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
proxy_set_header Host $host;
location /api/dashboards {
proxy_pass http://localhost:3000;
}
location /api/search {
proxy_pass http://localhost:3000;
sub_filter_types application/json;
sub_filter_once off;
}
location /api/live/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000;
}
location / {
proxy_cache my_zone;
proxy_cache_valid 200 302 1d;
proxy_cache_valid 301 30d;
proxy_cache_valid any 5m;
proxy_cache_bypass $http_cache_control;
add_header X-Proxy-Cache $upstream_cache_status;
add_header Cache-Control "public";
proxy_pass http://localhost:3000/;
sub_filter_once off;
sub_filter '"appSubUrl":""' '"appSubUrl":"/api/v1/namespaces/{{ template "grafana.namespace" . }}/services/http:{{ template "grafana.fullname" . }}:{{ .Values.service.port }}/proxy"';
sub_filter ':"/avatar/' ':"avatar/';
if ($request_filename ~ .*\.(?:js|css|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) {
expires 90d;
}
rewrite ^/k8s/clusters/.*/proxy(.*) /$1 break;
}
}
}
2 changes: 1 addition & 1 deletion pkg/config/templates/rancherd-22-addons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ resources:
namespace: cattle-monitoring-system
spec:
repo: http://harvester-cluster-repo.cattle-system.svc/charts
version: "100.1.0+up19.0.3"
version: "102.0.0+up40.1.2"
chart: rancher-monitoring
{{- if and .Addons .Addons.rancher_monitoring }}
enabled: {{ .Addons.rancher_monitoring.Enabled }}
Expand Down
19 changes: 12 additions & 7 deletions scripts/build-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ source ${SCRIPTS_DIR}/version-rke2
source ${SCRIPTS_DIR}/version-rancher
source ${SCRIPTS_DIR}/lib/http
source ${SCRIPTS_DIR}/lib/image
source ${SCRIPTS_DIR}/hack/patch-rancher-monitoring
source ${SCRIPTS_DIR}/hack/patch-rancher-logging

BUNDLE_DIR="${PACKAGE_HARVESTER_OS_DIR}/iso/bundle"
Expand Down Expand Up @@ -61,35 +62,39 @@ source ${SCRIPTS_DIR}/version-monitoring
helm pull https://charts.rancher.io/assets/rancher-monitoring-crd/rancher-monitoring-crd-${MONITORING_VERSION}.tgz -d ${CHARTS_DIR}
helm pull https://charts.rancher.io/assets/rancher-monitoring/rancher-monitoring-${MONITORING_VERSION}.tgz -d ${CHARTS_DIR}

# patch rancher-monitoring chart to fix issues
PKG_PATCH_MONITORING_PATH="${TOP_DIR}/pkg/config/templates/patch/rancher-monitoring"
patch_rancher_monitoring_chart ${CHARTS_DIR} ${MONITORING_VERSION} ${PKG_PATCH_MONITORING_PATH}

# make chart sanity check
tar zxvf ${CHARTS_DIR}/rancher-monitoring-crd-${MONITORING_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/rancher-monitoring-${MONITORING_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/rancher-monitoring-crd-${MONITORING_VERSION}.tgz >/dev/null --warning=no-timestamp
tar zxvf ${CHARTS_DIR}/rancher-monitoring-${MONITORING_VERSION}.tgz >/dev/null --warning=no-timestamp

# Prepare logging chart
source ${SCRIPTS_DIR}/version-logging
helm pull https://charts.rancher.io/assets/rancher-logging-crd/rancher-logging-crd-${LOGGING_VERSION}.tgz -d ${CHARTS_DIR}
helm pull https://charts.rancher.io/assets/rancher-logging/rancher-logging-${LOGGING_VERSION}.tgz -d ${CHARTS_DIR}

# make chart sanity check
tar zxvf ${CHARTS_DIR}/rancher-logging-crd-${LOGGING_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/rancher-logging-${LOGGING_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/rancher-logging-crd-${LOGGING_VERSION}.tgz >/dev/null --warning=no-timestamp
tar zxvf ${CHARTS_DIR}/rancher-logging-${LOGGING_VERSION}.tgz >/dev/null --warning=no-timestamp

# patch rancher-logging chart to collect more logs"
PKG_PATCH_LOGGING_PATH="${TOP_DIR}/pkg/config/templates/patch/rancher-logging"
patch_rancher_logging_chart ${CHARTS_DIR} ${LOGGING_VERSION} ${PKG_PATCH_LOGGING_PATH}

# make chart sanity check again after patch
tar zxvf ${CHARTS_DIR}/rancher-logging-${LOGGING_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/rancher-logging-${LOGGING_VERSION}.tgz >/dev/null --warning=no-timestamp

# Prepare vm-import-controller-chart
helm pull https://github.com/harvester/charts/releases/download/harvester-vm-import-controller-${VM_IMPORT_CONTROLLER_CHART_VERSION}/harvester-vm-import-controller-${VM_IMPORT_CONTROLLER_CHART_VERSION}.tgz -d ${CHARTS_DIR}
# make chart sanity check
tar zxvf ${CHARTS_DIR}/harvester-vm-import-controller-${VM_IMPORT_CONTROLLER_CHART_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/harvester-vm-import-controller-${VM_IMPORT_CONTROLLER_CHART_VERSION}.tgz >/dev/null --warning=no-timestamp

# Prepare pcidevices-chart
helm pull https://github.com/harvester/charts/releases/download/harvester-pcidevices-controller-${PCIDEVICES_CONTROLLER_CHART_VERSION}/harvester-pcidevices-controller-${PCIDEVICES_CONTROLLER_CHART_VERSION}.tgz -d ${CHARTS_DIR}
# make chart sanity check
tar zxvf ${CHARTS_DIR}/harvester-pcidevices-controller-${PCIDEVICES_CONTROLLER_CHART_VERSION}.tgz >/dev/null
tar zxvf ${CHARTS_DIR}/harvester-pcidevices-controller-${PCIDEVICES_CONTROLLER_CHART_VERSION}.tgz >/dev/null --warning=no-timestamp


# Create Helm repo index after charts are ready
Expand Down
34 changes: 34 additions & 0 deletions scripts/hack/patch-rancher-monitoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

patch_rancher_monitoring_chart()
{
local chart_dir=$1 #${CHARTS_DIR}
local monitoring_version=$2 #MONITORING_VERSION
local pkg_monitoring_path=$3 #${PKG_PATCH_MONITORING_PATH}
local cwd=$(pwd)

if [ ! -d "${pkg_monitoring_path}/${monitoring_version}" ]; then
echo "NOTE: there is no related path: ${pkg_monitoring_path}/${monitoring_version} to patch, SKIP"
return 0
fi

cd ${chart_dir}
tar zxf rancher-monitoring-${monitoring_version}.tgz --warning=no-timestamp

local nm="./rancher-monitoring/charts/grafana/templates/nginx-config.yaml"
echo "patch $nm, original file"
ls -alth "$nm" || echo "file $nm is not found"
rm -f "$nm"
cp -f ${pkg_monitoring_path}/${monitoring_version}/nginx-config.yaml "$nm"
echo "patched file"
ls -alth "$nm"

# remove existing chart
rm -f ${chart_dir}/rancher-monitoring-${monitoring_version}.tgz

# helm pack new
helm package rancher-monitoring
echo "finish patch ranch-monitoring chart"
cd $cwd
}

2 changes: 1 addition & 1 deletion scripts/version-monitoring
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MONITORING_VERSION=100.1.0+up19.0.3
MONITORING_VERSION=102.0.0+up40.1.2

0 comments on commit 984295f

Please sign in to comment.