diff --git a/.github/workflows/lint-test-matrix.yaml b/.github/workflows/lint-test-matrix.yaml new file mode 100644 index 0000000..8210774 --- /dev/null +++ b/.github/workflows/lint-test-matrix.yaml @@ -0,0 +1,141 @@ +name: K8S Matrix - Helm Lint and Test Charts + +on: pull_request + +jobs: + lint-test: + strategy: + # max-parallel: 5 + matrix: + # k8sVersion: [v1.24.0, v1.23.5, v1.22.7, v1.21.10, v1.20.15, v1.19.16, v1.17.17, v1.16.15, v1.15.12, v1.14.10 ] + # k8sVersion: [v1.24.0, v1.23.5, v1.22.7, v1.21.10, v1.20.15, v1.19.16, v1.18.20, v1.17.17, v1.16.15, v1.15.12, v1.14.10, v1.13.12] + k8sVersion: [ v1.24.0, v1.23.5, v1.22.7, v1.21.10, v1.20.15 ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.4.0 + + - uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.0.1 + + - name: Setup go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: install masterminds/vert + run: go install github.com/Masterminds/vert@latest + - name: setup yq + run: sudo snap install yq + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --config ct.yaml) + if [[ -n "$changed" ]]; then + echo "::set-output name=changed::true" + fi + otherschanged=$(ct list-changed --config ct.yaml || "no change" | egrep -v "argus") + if [[ -n "$otherschanged" ]]; then + echo "::set-output name=otherschanged::true" + fi + arguschanged=$(ct list-changed --config ct.yaml || "no change" | grep argus) + if [[ -n "$arguschanged" ]]; then + echo "::set-output name=arguschanged::true" + fi + + - name: Run chart-testing (lint) + run: ct lint --config ct.yaml + + - name: Create kind cluster + uses: helm/kind-action@v1.3.0 + with: + config: kind-conf.yaml + node_image: kindest/node:${{ matrix.k8sVersion }} + if: steps.list-changed.outputs.changed == 'true' + #- name: Pull images beforehand ct install + # run: | + # ksmVersion=$(yq charts/argus/Chart.yaml -o json | jq ".dependencies[] | select(. | .name == \"kube-state-metrics\")" | jq .version | tr -d '"') + # version=$(helm search repo -r prometheus/kube-state-metrics --version $ksmVersion -o json | jq ".[0].app_version" | tr -d '"') + # docker pull k8s.gcr.io/kube-state-metrics/kube-state-metrics:v$version + # cnm=$(kind get clusters) + # kind load docker-image k8s.gcr.io/kube-state-metrics/kube-state-metrics:v$version --name $cnm + # cscVersion=$(yq charts/collectorset-controller/Chart.yaml -o json | jq .appVersion | tr -d '"') + # argusVersion=$(yq charts/argus/Chart.yaml -o json | jq .appVersion | tr -d '"') + # docker pull logicmonitor/collectorset-controller:$cscVersion + # kind load docker-image logicmonitor/collectorset-controller:$cscVersion --name $cnm + # docker pull logicmonitor/argus:$argusVersion + # kind load docker-image logicmonitor/argus:$argusVersion --name $cnm + + - name: Run chart-testing (install) - except argus + if: steps.list-changed.outputs.otherschanged == 'true' + run: | + export K8SVERSION=${{ matrix.k8sVersion }} + while read -r line ; do + echo "installing chart $line" + ct install --config ct.yaml --charts=$line && EXIT_CODE=$(echo $?) || EXIT_CODE=$(echo $?) + if [[ $EXIT_CODE -eq 0 ]] + then + echo "$line is installable on mentioned kubernetes version $K8SVERSION" + else + vc=$(yq $line/Chart.yaml -o json | jq ".kubeVersion" | tr -d '"' | tr -d "'") + echo $vc + v=$(vert "$vc" "$K8SVERSION" || echo "") + if [[ "v$v" == "$K8SVERSION" ]] + then + echo "Error: kubeVersion constraint expects chart to be installed on $K8SVERSION, but it failed to install" + sync + exit 2 + else + echo "installation failed as per constraint" + fi + fi + done < <(ct list-changed --config ct.yaml | egrep -v argus) + + - name: Run chart-testing (install) - only argus + if: steps.list-changed.outputs.arguschanged == 'true' + run: | + export K8SVERSION=${{ matrix.k8sVersion }} + vcs=$(vert ">= 1.16.0-0" "$K8SVERSION" || echo "") + if [[ "v$vcs" == "$K8SVERSION" ]] + then + kubectl apply -f charts/collectorset-controller/crds/collectorset.yaml + else + kubectl apply -f v1beta1-cs-crd.yaml + fi + while read -r line ; do + ct install --config ct.yaml --charts=$line && EXIT_CODE=$(echo $?) || EXIT_CODE=$(echo $?) + if [[ $EXIT_CODE -eq 0 ]] + then + echo "$line is installable on mentioned kubernetes version $K8SVERSION" + else + vc=$(yq $line/Chart.yaml -o json | jq ".kubeVersion" | tr -d '"' | tr -d "'") + echo $vc + v=$(vert "$vc" "$K8SVERSION" || echo "") + if [[ "v$v" == "$K8SVERSION" ]] + then + echo "Error: kubeVersion constraint expects chart to be installed on $K8SVERSION, but it failed to install" + sync + exit 3 + else + echo "installation failed as per constraint" + fi + fi + done < <(echo "charts/argus") + if [[ "v$vcs" == "$K8SVERSION" ]] + then + kubectl delete -f charts/collectorset-controller/crds/collectorset.yaml + else + kubectl delete -f v1beta1-cs-crd.yaml + fi + diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml new file mode 100644 index 0000000..e6c8abf --- /dev/null +++ b/.github/workflows/stale.yaml @@ -0,0 +1,21 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '0 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.' + stale-pr-message: 'This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thank you for your contribution.' + close-issue-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.' + close-pr-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.' + days-before-stale: 15 + days-before-close: 5 + exempt-issue-labels: 'on-hold' + exempt-pr-labels: 'on-hold' + operations-per-run: 500 diff --git a/charts/argus/Chart.yaml b/charts/argus/Chart.yaml index fc15d5e..11624ca 100644 --- a/charts/argus/Chart.yaml +++ b/charts/argus/Chart.yaml @@ -11,6 +11,6 @@ maintainers: - email: argus@logicmonitor.com name: LogicMonitor name: argus -version: 3.0.0-ea5 +version: 3.0.0 home: https://logicmonitor.github.io/helm-charts -appVersion: v8.0.0-ea1 +appVersion: v8.0.0 diff --git a/charts/argus/README.md b/charts/argus/README.md index 29dae62..fc330f8 100644 --- a/charts/argus/README.md +++ b/charts/argus/README.md @@ -2,100 +2,4 @@ This Helm chart installs [Argus](https://github.com/logicmonitor/k8s-argus). A [LogicMonitor](https://www.logicmonitor.com) account is required. -**Install Argus:** - -Get the configuration file downloaded from the LogicMonitor UI or you can create from the template [here](https://github.com/logicmonitor/k8s-helm-charts/blob/master/config-templates/Configuration.md#argus). - -Update configuration parameters in configuration file. - -```bash -# Export the configuration file path & use it in the helm command. -$ export ARGUS_CONF_FILE= - -$ helm upgrade \ - --install \ - --debug \ - --wait \ - --namespace="$NAMESPACE" \ - -f "$ARGUS_CONF_FILE" \ - argus logicmonitor/argus -``` - ---- - -Required Values: - -- **accessID (default: `""`):** The LogicMonitor API key ID. -- **accessKey (default: `""`):** The LogicMonitor API key. -- **account (default: `""`):** The LogicMonitor account name. -- **clusterName (default: `""`):** A unique name given to the cluster's resource group. -- **debug (default: `false`):** To enable verbose logging at debug level. -- **deleteDevices (default: `true`):** On a delete event, either delete from LogicMonitor or move the resource to the `_deleted` resource group. -- **disableAlerting (default: `false`):** Disables LogicMonitor alerting for all the cluster resources. -- **collector.replicas (default: `1`):** The number of collectors to create and use with Argus. -- **collector.size (default: `""`):** The collector size to install. Can be nano, small, medium, or large. -- **collector.imageRepository (default: `logicmonitor/collector`):** The image repository of the [Collector](https://hub.docker.com/r/logicmonitor/collector) container. -- **collector.imageTag:** The image tag of the [Collector](https://hub.docker.com/r/logicmonitor/collector/tags) container. -- **collector.imagePullPolicy (default: `Always`):** The image pull policy of the Collector container. -- **collector.secretName (default: `"collector"`):** The Secret resource name of the collectors. - -Optional Values: - -- **enableRBAC (default: `true`):** Enable RBAC. If your cluster does not have RBAC enabled, this value should be set to false. -- **clusterGroupID (default: `0`):** A parent group id of the cluster's resource group. -- **etcdDiscoveryToken (default: `""`):** The public etcd discovery token used to add etcd hosts to the cluster resource group. -- **imagePullPolicy (default: `"Always"`):** The image pull policy of the Argus container. -- **imageRepository (default: `"logicmonitor/argus"`):** The image respository of the [Argus](https://hub.docker.com/r/logicmonitor/argus) container. -- **imageTag:** The image tag of the [Argus](https://hub.docker.com/r/logicmonitor/argus/tags) container. -- **proxyURL (default: `""`):** The Http/s proxy url. -- **proxyUser (default: `""`):** The Http/s proxy username. -- **proxyPass (default: `""`):** The Http/s proxy password. -- **nodeSelector (default: `{}`):** It provides the simplest way to run Pod on particular Node(s) based on labels on the node. -- **affinity (default: `{}`):** It allows you to constrain which nodes your pod is eligible to be scheduled on. -- **priorityClassName (default: `""`):** The priority class name for Pod priority. If this parameter is set then user must have PriorityClass resource created otherwise Pod will be rejected. -- **tolerations (default: `[]`):** Tolerations are applied to pods, and allow the pods to schedule onto nodes with matching taints. -- **filters.pod (default: `""`):** The filtered expression for Pod resource type. Based on this parameter, Pods would be added/deleted for discovery on LM. -- **filters.service (default: `""`):** The filtered expression for Service resource type. Based on this parameter, Services would be added/deleted for discovery on LM. -- **filters.node (default: `""`):** The filtered expression for Node resource type. Based on this parameter, Nodes would be added/deleted for discovery on LM. -- **filters.deployment (default: `""`):** The filtered expression for Deployment resource type. Based on this parameter, Deployments would be added/deleted for discovery on LM. -- **collector.groupID (default: `0`):** The ID of the group of the collectors. -- **collector.escalationChainID (default: `0`):** The ID of the escalation chain of the collectors. -- **collector.collectorVersion (default: `0`):** The version of the collectors. -- **collector.useEA (default: `false`):** On a collector downloading event, either download the latest EA version or the latest GD version. -- **collector.proxyURL (default: `""`):** The Http/s proxy url of the collectors. -- **collector.proxyUser (default: `""`):** The Http/s proxy username of the collectors. -- **collector.proxyPass (default: `""`):** The Http/s proxy password of the collectors. -- **collector.statefulsetspec:** Holds the Collector pod's Statefulfulset specification as per the Kubernetes statefulset object's spec format. Refer [statefulset basics](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/) for more info - ---- - -**Tolerations Example:** - -```bash -$ helm upgrade --reuse-values \ - --set tolerations[0].key="key1" \ - --set tolerations[0].operator="Equal" \ - --set tolerations[0].value="value1" \ - --set tolerations[0].effect="NoSchedule" \ - argus logicmonitor/argus -``` - -**Discovery Filter Example:** - -```bash -helm upgrade --reuse-values \ - --set filters.deployment="app =~ 'QA' || app =~ 'Dev'" - --set filters.pod="app =~ 'node-app'" \ - --set filters.service=\"*\" - argus logicmonitor/argus -``` - -**Discovery Filter Example:** - -```bash -helm upgrade --reuse-values \ - --set filters.deployment="app =~ 'QA' || app =~ 'Dev'" - --set filters.pod="app =~ 'node-app'" \ - --set filters.service=\"*\" - argus logicmonitor/argus -``` +See [Logicmonitor Support Documentation](https://www.logicmonitor.com/support/monitoring/containers/kubernetes/about-logicmonitors-kubernetes-monitoring) for more details on installation \ No newline at end of file diff --git a/charts/argus/ci/dummy-values.yaml b/charts/argus/ci/base-sanity-values.yaml similarity index 99% rename from charts/argus/ci/dummy-values.yaml rename to charts/argus/ci/base-sanity-values.yaml index d882f8b..d958c4f 100644 --- a/charts/argus/ci/dummy-values.yaml +++ b/charts/argus/ci/base-sanity-values.yaml @@ -9,6 +9,5 @@ clusterName: "dummy" collector: size: nano - probe: enabled: false diff --git a/charts/argus/templates/_helpers.tpl b/charts/argus/templates/_helpers.tpl index adecc56..882b614 100644 --- a/charts/argus/templates/_helpers.tpl +++ b/charts/argus/templates/_helpers.tpl @@ -121,7 +121,7 @@ Return the appropriate apiVersion for rbac. {{- define "monitoring.disable" }} -{{ $alwaysDisable := list "configmaps" "secrets" "networkpolicies"}} +{{ $alwaysDisable := list "secrets" "networkpolicies"}} {{ $resultList := ( concat $alwaysDisable $.Values.monitoring.disable | uniq ) }} {{- toYaml $resultList | nindent 0}} {{- end }} diff --git a/charts/collectorset-controller/Chart.yaml b/charts/collectorset-controller/Chart.yaml index 9887225..645b75c 100644 --- a/charts/collectorset-controller/Chart.yaml +++ b/charts/collectorset-controller/Chart.yaml @@ -6,6 +6,6 @@ maintainers: - email: argus@logicmonitor.com name: LogicMonitor name: collectorset-controller -version: 2.0.0-ea3 +version: 2.0.0 home: https://logicmonitor.github.io/helm-charts -appVersion: v4.0.0-ea +appVersion: v4.0.0 diff --git a/charts/collectorset-controller/README.md b/charts/collectorset-controller/README.md index e60fe5c..d5045c9 100644 --- a/charts/collectorset-controller/README.md +++ b/charts/collectorset-controller/README.md @@ -2,58 +2,4 @@ This Helm chart installs [collectorset-controller](https://github.com/logicmonitor/k8s-collectorset-controller). A [LogicMonitor](https://www.logicmonitor.com) account is required. -**Install Collectorset-controller:** - -Get the configuration file downloaded from the LogicMonitor UI or you can create from the template [here](https://github.com/logicmonitor/k8s-helm-charts/blob/master/config-templates/Configuration.md#collectorset-controller). - -Update configuration parameters in configuration file. - -```bash -# Export the configuration file path & use it in the helm command. -$ export COLLECTORSET_CONTROLLER_CONF_FILE= - -$ helm upgrade \ - --install \ - --debug \ - --wait \ - --namespace="$NAMESPACE" \ - -f "$COLLECTORSET_CONTROLLER_CONF_FILE" \ - collectorset-controller logicmonitor/collectorset-controller -``` - ---- - -Required Values: - -- **accessID (default: `""`):** The LogicMonitor API key ID. -- **accessKey (default: `""`):** The LogicMonitor API key. -- **account (default: `""`):** The LogicMonitor account name. -- **debug (default: `false`):** To enable verbose logging at debug level. - -Optional Values: - -- **enableRBAC (default: `true`):** Enable RBAC. If your cluster does not have RBAC enabled, this value should be set to false. -- **etcdDiscoveryToken (default: `""`):** The public etcd discovery token used to add etcd hosts to the cluster device group. -- **imagePullPolicy (default: `"Always"`):** The image pull policy of the Collectorset-controller container. -- **imageRepository (default: `"logicmonitor/collectorset-controller"`):** The image repository of the [Collectorset-controller](https://hub.docker.com/r/logicmonitor/collectorset-controller) container. -- **imageTag:** The image tag of the [Collectorset-controller](https://hub.docker.com/r/logicmonitor/collectorset-controller/tags) container. -- **proxyURL (default: `""`):** The Http/s proxy url. -- **proxyUser (default: `""`):** The Http/s proxy username. -- **proxyPass (default: `""`):** The Http/s proxy password. -- **nodeSelector (default: `{}`):** It provides the simplest way to run Pod on particular Node(s) based on labels on the node. -- **affinity (default: `{}`):** It allows you to constrain which nodes your pod is eligible to be scheduled on. -- **priorityClassName (default: `""`):** The priority class name for Pod priority. If this parameter is set then user must have PriorityClass resource created otherwise Pod will be rejected. -- **tolerations (default: `[]`):** Tolerations are applied to pods, and allow the pods to schedule onto nodes with matching taints. - ---- - -**Tolerations Example** - -```bash -$ helm upgrade --reuse-values \ - --set tolerations[0].key="key1" \ - --set tolerations[0].operator="Equal" \ - --set tolerations[0].value="value1" \ - --set tolerations[0].effect="NoSchedule" \ - collectorset-controller logicmonitor/collectorset-controller -``` +See [Logicmonitor Support Documentation](https://www.logicmonitor.com/support/monitoring/containers/kubernetes/about-logicmonitors-kubernetes-monitoring) for more details on installation \ No newline at end of file diff --git a/charts/collectorset-controller/ci/dummy-values.yaml b/charts/collectorset-controller/ci/base-sanity-values.yaml similarity index 100% rename from charts/collectorset-controller/ci/dummy-values.yaml rename to charts/collectorset-controller/ci/base-sanity-values.yaml diff --git a/charts/collectorset-controller/templates/collector-rbac.yaml b/charts/collectorset-controller/templates/collector-rbac.yaml index bd244c9..9f25e62 100644 --- a/charts/collectorset-controller/templates/collector-rbac.yaml +++ b/charts/collectorset-controller/templates/collector-rbac.yaml @@ -30,6 +30,8 @@ rules: - pods - containers - nodes + - nodes/proxy + - nodes/metrics - componentstatuses - replicasets - persistentvolumes @@ -39,6 +41,7 @@ rules: - endpoints - pods/log - events + - configmaps verbs: - list - get @@ -91,6 +94,7 @@ rules: - /healthz - /healthz/* - /metrics + - /proxy verbs: - get --- diff --git a/kind-conf.yaml b/kind-conf.yaml new file mode 100644 index 0000000..2509664 --- /dev/null +++ b/kind-conf.yaml @@ -0,0 +1,7 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane +- role: worker +- role: worker +- role: worker