Skip to content

Commit

Permalink
Merge pull request #491 from solarwinds/bugfix/fix-autoupdate
Browse files Browse the repository at this point in the history
Fixing autoupdate and bumping version to 3.1.1
  • Loading branch information
gantrior authored Nov 30, 2023
2 parents ab135b2 + c278d6c commit df15716
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 112 deletions.
216 changes: 108 additions & 108 deletions .github/workflows/buildAndDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,114 +146,114 @@ jobs:

- name: Run unit tests
run: helm unittest deploy/helm

helm_test_auto_update_against_last_published:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Deploy Kubernetes
uses: ./.github/actions/deploy-kubernetes

- name: Add dependency chart repos
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add solarwinds https://helm.solarwinds.com
helm repo update
- name: Deploy mocks.yaml
run: kubectl apply -f tests/deploy/base/mocks.yaml

- name: Create Dockerfile with Helm repository
run: |
cat <<EOF > Dockerfile
FROM python:3.8-alpine
WORKDIR /app
COPY . .
EXPOSE 5000
CMD ["python", "-m", "http.server", "5000"]
EOF
- name: Package and build Helm repository image
run: |
helm dependency build deploy/helm
helm package deploy/helm
helm repo index .
docker build -t helm-repo:latest .
- name: Deploy Helm repository in Kubernetes cluster
run: |
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: helm-repo
spec:
selector:
matchLabels:
app: helm-repo
replicas: 1
template:
metadata:
labels:
app: helm-repo
spec:
containers:
- name: helm-repo
image: helm-repo:latest
imagePullPolicy: Never
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: helm-repo
spec:
selector:
app: helm-repo
ports:
- protocol: TCP
port: 5000
targetPort: 5000
type: ClusterIP
EOF
- name: Deploy swo-k8s-collector Helm chart
run: |
helm install swo-k8s-collector solarwinds/swo-k8s-collector \
--create-namespace \
--namespace swo-k8s-collector \
--set cluster.name=test-cluster \
--set cluster.uid=test-cluster \
--set otel.endpoint=timeseries-mock-service:9082 \
--set prometheus.enabled=true \
--set autoupdate.enabled=true \
--set autoupdate.devel=true \
--set otel.metrics.swi_endpoint_check=false \
--set otel.metrics.prometheus_check=false \
--set otel.metrics.resources.requests.memory=100Mi \
--set otel.events.resources.requests.memory=100Mi \
--set otel.logs.resources.requests.memory=100Mi
- name: Update AutoUpdate ConfigMap to use local Helm repository
run: |
kubectl get configmap swo-k8s-collector-autoupdate-script -n swo-k8s-collector -o yaml > autoupdate-script.yaml
sed -i 's|https://helm.solarwinds.com|http://helm-repo.default.svc.cluster.local:5000|' autoupdate-script.yaml
kubectl apply -f autoupdate-script.yaml
cat autoupdate-script.yaml
- name: Trigger helm-autoupdate CronJob and verify
run: |
kubectl create job --from=cronjob/helm-autoupdate helm-autoupdate-manual-trigger -n swo-k8s-collector
kubectl wait --for=condition=complete --timeout=300s job/helm-autoupdate-manual-trigger -n swo-k8s-collector
- name: Trigger helm-autoupdate CronJob logs
if: ${{ always() }}
run: |
kubectl logs jobs/helm-autoupdate-manual-trigger -n swo-k8s-collector --all-containers=true
# Since this job is installing last published Helm chart, it is temporarily disabled until we release new version which has image repo fixed
# helm_test_auto_update_against_last_published:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Deploy Kubernetes
# uses: ./.github/actions/deploy-kubernetes

# - name: Add dependency chart repos
# run: |
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# helm repo add solarwinds https://helm.solarwinds.com
# helm repo update

# - name: Deploy mocks.yaml
# run: kubectl apply -f tests/deploy/base/mocks.yaml

# - name: Create Dockerfile with Helm repository
# run: |
# cat <<EOF > Dockerfile
# FROM python:3.8-alpine
# WORKDIR /app
# COPY . .
# EXPOSE 5000
# CMD ["python", "-m", "http.server", "5000"]
# EOF

# - name: Package and build Helm repository image
# run: |
# helm dependency build deploy/helm
# helm package deploy/helm
# helm repo index .
# docker build -t helm-repo:latest .

# - name: Deploy Helm repository in Kubernetes cluster
# run: |
# cat <<EOF | kubectl apply -f -
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: helm-repo
# spec:
# selector:
# matchLabels:
# app: helm-repo
# replicas: 1
# template:
# metadata:
# labels:
# app: helm-repo
# spec:
# containers:
# - name: helm-repo
# image: helm-repo:latest
# imagePullPolicy: Never
# ports:
# - containerPort: 5000
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: helm-repo
# spec:
# selector:
# app: helm-repo
# ports:
# - protocol: TCP
# port: 5000
# targetPort: 5000
# type: ClusterIP
# EOF

# - name: Deploy swo-k8s-collector Helm chart
# run: |
# helm install swo-k8s-collector solarwinds/swo-k8s-collector \
# --create-namespace \
# --namespace swo-k8s-collector \
# --set cluster.name=test-cluster \
# --set cluster.uid=test-cluster \
# --set otel.endpoint=timeseries-mock-service:9082 \
# --set prometheus.enabled=true \
# --set autoupdate.enabled=true \
# --set autoupdate.devel=true \
# --set otel.metrics.swi_endpoint_check=false \
# --set otel.metrics.prometheus_check=false \
# --set otel.metrics.resources.requests.memory=100Mi \
# --set otel.events.resources.requests.memory=100Mi \
# --set otel.logs.resources.requests.memory=100Mi

# - name: Update AutoUpdate ConfigMap to use local Helm repository
# run: |
# kubectl get configmap swo-k8s-collector-autoupdate-script -n swo-k8s-collector -o yaml > autoupdate-script.yaml
# sed -i 's|https://helm.solarwinds.com|http://helm-repo.default.svc.cluster.local:5000|' autoupdate-script.yaml
# kubectl apply -f autoupdate-script.yaml
# cat autoupdate-script.yaml

# - name: Trigger helm-autoupdate CronJob and verify
# run: |
# kubectl create job --from=cronjob/helm-autoupdate helm-autoupdate-manual-trigger -n swo-k8s-collector
# kubectl wait --for=condition=complete --timeout=300s job/helm-autoupdate-manual-trigger -n swo-k8s-collector

# - name: Trigger helm-autoupdate CronJob logs
# if: ${{ always() }}
# run: |
# kubectl logs jobs/helm-autoupdate-manual-trigger -n swo-k8s-collector --all-containers=true

deploy_dockerhub:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions deploy/helm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [3.1.1] - 2023-11-30

### Fixed
- Fixed autoupdate job to use right image

## [3.1.0] - 2023-11-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: swo-k8s-collector
version: 3.1.0
version: 3.1.1
appVersion: "0.8.10"
description: SolarWinds Kubernetes Integration
keywords:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/templates/autoupdate/autoupdate-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- end }}
containers:
- name: helm-upgrade
image: "{{ .Values.otel.image.repository | default "alpine/k8s" }}:{{ .Values.otel.image.tag | default "1.27.2@sha256:bbdbcb2e799b50958beb278de4a309d60bd238c14bdaff50c4e5ae42e446f745" }}"
image: "{{ .Values.autoupdate.image.repository | default "alpine/k8s" }}:{{ .Values.autoupdate.image.tag | default "1.27.2@sha256:bbdbcb2e799b50958beb278de4a309d60bd238c14bdaff50c4e5ae42e446f745" }}"
imagePullPolicy: {{ .Values.otel.image.pullPolicy }}
command:
- /bin/bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Fargate logging ConfigMap spec should include additional filters when they are c
Match *
Add sw.k8s.cluster.uid <CLUSTER_UID>
Add sw.k8s.log.type container
Add sw.k8s.agent.manifest.version "3.1.0"
Add sw.k8s.agent.manifest.version "3.1.1"
flb_log_cw: "false"
output.conf: |
[OUTPUT]
Expand Down Expand Up @@ -64,7 +64,7 @@ Fargate logging ConfigMap spec should match snapshot when Fargate logging is ena
Match *
Add sw.k8s.cluster.uid <CLUSTER_UID>
Add sw.k8s.log.type container
Add sw.k8s.agent.manifest.version "3.1.0"
Add sw.k8s.agent.manifest.version "3.1.1"
flb_log_cw: "false"
output.conf: |
[OUTPUT]
Expand Down

0 comments on commit df15716

Please sign in to comment.