From e8c6ee93b08c0f5bc841cff089d2aaa62ae10514 Mon Sep 17 00:00:00 2001 From: Chris Elias Date: Tue, 14 May 2024 12:09:54 -0400 Subject: [PATCH] Add the artifact inventory generation action --- .github/workflows/artifact-inventory.yml | 31 ++++++ .../ARTIFACT_INVENTORY.template | 60 +++++++++++ .../build-artifact/generate_inventory.sh | 101 ++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 .github/workflows/artifact-inventory.yml create mode 100644 .github/workflows/build-artifact/ARTIFACT_INVENTORY.template create mode 100644 .github/workflows/build-artifact/generate_inventory.sh diff --git a/.github/workflows/artifact-inventory.yml b/.github/workflows/artifact-inventory.yml new file mode 100644 index 00000000..ff0de693 --- /dev/null +++ b/.github/workflows/artifact-inventory.yml @@ -0,0 +1,31 @@ +name: update-artifact-inventory +on: + push: + branches: + - main +jobs: + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs commands using the runners shell + - name: Run the generate script + run: | + ls + pwd + chmod +x ./.github/workflows/artifact/generate_inventory.sh + ./.github/workflows/artifact/generate_inventory.sh + ls + cat ARTIFACT_INVENTORY.md + shell: bash + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: Update artifact inventory + branch: update-artifact-inventory + title: Update ARTIFACT_INVENTORY + base: main diff --git a/.github/workflows/build-artifact/ARTIFACT_INVENTORY.template b/.github/workflows/build-artifact/ARTIFACT_INVENTORY.template new file mode 100644 index 00000000..deab42e8 --- /dev/null +++ b/.github/workflows/build-artifact/ARTIFACT_INVENTORY.template @@ -0,0 +1,60 @@ +# Inventory of Container Images and Helm Charts Used by SAS Viya Monitoring for Kubernetes + +The following tables provide information about the container images and Helm charts used by SAS Viya Monitoring for Kubernetes. This information can be useful to users who want to do the following tasks: + +* pre-pull container images +* deploy into an air-gapped Kubernetes cluster + +**Note:** For more information about deploying in an air-gapped environment, refer to +[Configure SAS Viya Monitoring for Kubernetes for an Air-Gapped Environment](https://documentation.sas.com/?cdcId=obsrvcdc&cdcVersion=default&docsetId=obsrvdply&docsetTarget=n0grd8g2pkfglin12bzm3g1oik2p.htm). + +## Table 1. Container Images + +This table provides the fully qualified container-image names for the components of SAS Viya Monitoring for Kubernetes. +These names use the following format: +registry/repository/image_name:version + +| Subsystem| Component | Fully Qualified Container-Image Name (registry/repository/image_name:version)| +|----|----|----| +| Logging | BusyBox (OpenSearch) | __OS_SYSCTL_FULL_IMAGE__ | +| Logging | Fluent Bit | __FB_FULL_IMAGE__ | +| Logging | Elasticsearch Exporter | __ES_EXPORTER_FULL_IMAGE__ | +| Logging | OpenSearch | __OS_FULL_IMAGE__ | +| Logging | OpenSearch Dashboards| __OSD_FULL_IMAGE__ | +| Metrics | Alertmanager | __ALERTMANAGER_FULL_IMAGE__ | +| Metrics | Grafana | __GRAFANA_FULL_IMAGE__ | +| Metrics | Admission Webhook | __ADMWEBHOOK_FULL_IMAGE__ | +| Metrics | Kube State Metrics | __KSM_FULL_IMAGE__ | +| Metrics | Node Exporter | __NODEXPORT_FULL_IMAGE__ | +| Metrics | Prometheus | __PROMETHEUS_FULL_IMAGE__ | +| Metrics | Prometheus Operator | __PROMOP_FULL_IMAGE__ | +| Metrics | Configuration Reloader (Alertmanager, Prometheus) | __CONFIGRELOAD_FULL_IMAGE__ | +| Metrics | Prometheus Pushgateway | __PUSHGATEWAY_FULL_IMAGE__ | +| Metrics | Auto-load Sidecars (Grafana) | __GRAFANA_SIDECAR_FULL_IMAGE__ | +| Metrics | OpenShift OAUTH Proxy (Grafana, OpenShift only) | __OPENSHIFT_OAUTHPROXY_FULL_IMAGE__ | +| Metrics | Tempo | __TEMPO_FULL_IMAGE__ | + +## Table 2. Helm Chart Repositories +This table identifies the Helm repositories that contain the Helm charts used by SAS Viya Monitoring for Kubernetes. +These repositories must be made available to Helm in your environment. Use the `helm repo add` command. + +| Subsystem | Component | Helm Repository | Helm Repository URL | +|--|--|--|--| +| Logging | Fluent Bit | fluent | https://fluent.github.io/helm-charts | +| Logging | OpenSearch and OpenSearch Dashboards | opensearch | https://opensearch-project.github.io/helm-charts | +| Metrics | Grafana | grafana | https://grafana.github.io/helm-charts | +| Both | Several (including Prometheus, Kube Prometheus Stack, Prometheus Pushgateway and Elasticsearch Exporter) | prometheus-community | https://prometheus-community.github.io/helm-charts | + +## Table 3. Helm Chart Information +This table identifies the Helm charts used by SAS Viya Monitoring for Kubernetes. + +| Subsystem | Component | Helm Chart Repository | Helm Chart Name |Helm Chart Version | Helm Archive File Name| +|--|--|--|--|--|--| +| Logging | Elasticsearch Exporter| __ESEXPORTER_HELM_CHART_REPO__ | __ESEXPORTER_HELM_CHART_NAME__ | __ESEXPORTER_HELM_CHART_VERSION__ | __ESEXPORTER_HELM_CHART_ARCHIVE__ | +| Logging | Fluent Bit| __FLUENTBIT_HELM_CHART_REPO__ | __FLUENTBIT_HELM_CHART_NAME__ | __FLUENTBIT_HELM_CHART_VERSION__ | __FLUENTBIT_HELM_CHART_ARCHIVE__ | +| Logging | OpenSearch| __OPENSEARCH_HELM_CHART_REPO__ | __OPENSEARCH_HELM_CHART_NAME__ | __OPENSEARCH_HELM_CHART_VERSION__ | __OPENSEARCH_HELM_CHART_ARCHIVE__ | +| Logging | OpenSearch Dashboard| __OSD_HELM_CHART_REPO__ | __OSD_HELM_CHART_NAME__ | __OSD_HELM_CHART_VERSION__ | __OSD_HELM_CHART_ARCHIVE__ | +| Metrics | Grafana (on OpenShift)| __OPENSHIFT_GRAFANA_CHART_REPO__ | __OPENSHIFT_GRAFANA_CHART_NAME__ | __OPENSHIFT_GRAFANA_CHART_VERSION__ | __OPENSHIFT_GRAFANA_CHART_ARCHIVE__ | +| Metrics | Kube Prometheus Stack| __KUBE_PROM_STACK_CHART_REPO__ | __KUBE_PROM_STACK_CHART_NAME__ | __KUBE_PROM_STACK_CHART_VERSION__ | __KUBE_PROM_STACK_CHART_ARCHIVE__ | +| Metrics | Prometheus Pushgateway| __PUSHGATEWAY_CHART_REPO__ | __PUSHGATEWAY_CHART_NAME__ | __PUSHGATEWAY_CHART_VERSION__ | __PUSHGATEWAY_CHART_ARCHIVE__ | +| Metrics | Tempo | __TEMPO_CHART_REPO__ | __TEMPO_CHART_NAME__ | __TEMPO_CHART_VERSION__ | __TEMPO_CHART_ARCHIVE__ | diff --git a/.github/workflows/build-artifact/generate_inventory.sh b/.github/workflows/build-artifact/generate_inventory.sh new file mode 100644 index 00000000..6f9d1bb7 --- /dev/null +++ b/.github/workflows/build-artifact/generate_inventory.sh @@ -0,0 +1,101 @@ +#! /bin/bash +# Copyright © 2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# NOTE: This script is NOT intended to be run by end-users. It +# is used by the project development team to generate an +# important file documenting the container images and Helm +# charts used by the project. + +V4M_BUILD_REPO=${V4M_BUILD_REPO:-"../v4m-build"} +# V4M_REPO=${V4M_REPO:-"/home/runner/work/viya4-monitoring-kubernetes/viya4-monitoring-kubernetes"} +# cd $V4M_REPO + +CHECK_HELM=false +CHECK_KUBERNETES=false + +source bin/common.sh + +file="ARTIFACT_INVENTORY.md" +template=".github/workflows/artifact/ARTIFACT_INVENTORY.template" + +cp "$template" "$file" + +function buildHelmArchiveFilename { + + local prefix repo name version format chart_archive_filename + + prefix=$1 + repo="${prefix}_CHART_REPO" + name="${prefix}_CHART_NAME" + version="${prefix}_CHART_VERSION" + format="tgz" + chart_archive_filename="${!repo}\/${!name}-${!version}.$format" + v4m_replace "__${prefix}_CHART_REPO__" "${!repo}" "$file" + v4m_replace "__${prefix}_CHART_NAME__" "${!name}" "$file" + v4m_replace "__${prefix}_CHART_VERSION__" "${!version}" "$file" + v4m_replace "__${prefix}_CHART_ARCHIVE__" "$chart_archive_filename" "$file" + +} + +buildHelmArchiveFilename "ESEXPORTER_HELM" +buildHelmArchiveFilename "FLUENTBIT_HELM" +buildHelmArchiveFilename "OPENSEARCH_HELM" +buildHelmArchiveFilename "OSD_HELM" +buildHelmArchiveFilename "OPENSHIFT_GRAFANA" +buildHelmArchiveFilename "KUBE_PROM_STACK" +buildHelmArchiveFilename "PUSHGATEWAY" +buildHelmArchiveFilename "TEMPO" + +parseFullImage "$ALERTMANAGER_FULL_IMAGE" +v4m_replace "__ALERTMANAGER_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$GRAFANA_FULL_IMAGE" +v4m_replace "__GRAFANA_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$GRAFANA_SIDECAR_FULL_IMAGE" +v4m_replace "__GRAFANA_SIDECAR_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$ADMWEBHOOK_FULL_IMAGE" +v4m_replace "__ADMWEBHOOK_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$KSM_FULL_IMAGE" +v4m_replace "__KSM_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$NODEXPORT_FULL_IMAGE" +v4m_replace "__NODEXPORT_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$PROMETHEUS_FULL_IMAGE" +v4m_replace "__PROMETHEUS_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$PROMOP_FULL_IMAGE" +v4m_replace "__PROMOP_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$CONFIGRELOAD_FULL_IMAGE" +v4m_replace "__CONFIGRELOAD_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$FB_FULL_IMAGE" +v4m_replace "__FB_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$OS_FULL_IMAGE" +v4m_replace "__OS_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$OS_SYSCTL_FULL_IMAGE" +v4m_replace "__OS_SYSCTL_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$OSD_FULL_IMAGE" +v4m_replace "__OSD_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$ES_EXPORTER_FULL_IMAGE" +v4m_replace "__ES_EXPORTER_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$OPENSHIFT_OAUTHPROXY_FULL_IMAGE" +v4m_replace "__OPENSHIFT_OAUTHPROXY_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$TEMPO_FULL_IMAGE" +v4m_replace "__TEMPO_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +parseFullImage "$PUSHGATEWAY_FULL_IMAGE" +v4m_replace "__PUSHGATEWAY_FULL_IMAGE__" "$FULL_IMAGE_ESCAPED" "$file" + +log_notice "Be sure to review the generated file [$file] prior to adding/committing it to the repo"