Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated helm collector to leverage helm client for go #90

Merged
merged 1 commit into from
Aug 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/ci-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
GO_VERSION: '1.15'
KIND_VERSION: v0.11.1
HELM_VERSION: v3.4.0

jobs:
lint:
Expand Down Expand Up @@ -37,14 +38,17 @@ jobs:
run: go build ./cmd/aks-periscope
tests:
runs-on: ubuntu-latest
# services:
# registry:
# image: registry:2
# ports:
# - 5000:5000
steps:
- uses: actions/checkout@v2
- uses: azure/setup-kubectl@v1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: ${{ env.HELM_VERSION }}
- name: Install Packages
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
Expand Down Expand Up @@ -94,13 +98,19 @@ jobs:
push: true
tags: localhost:5000/periscope:foo
file: ./builder/Dockerfile
- name: Deploy dummy helm chart for tests
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm install happy-panda bitnami/wordpress --namespace default
- name: Deploy AKS Periscope
run: |
(cd ./deployment && kustomize edit set image aksrepos.azurecr.io/staging/aks-periscope=localhost:5000/periscope:foo)
kubectl apply -f <(kustomize build ./deployment)
kubectl -n aks-periscope wait po --all --for condition=ready --timeout=60s
# TODO: run integration tests here
# To deploy HELM releases, use https://github.com/deliverybot/helm ex https://medium.com/swlh/deploying-to-kubernetes-with-helm-and-github-actions-14825e6df1f2
- name: Go tests
run: |
go test -v ./...
- name: Stop kind
run: kind delete cluster
continue-on-error: false
4 changes: 0 additions & 4 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ RUN apk --no-cache add ca-certificates curl openssl bash
ADD https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl /usr/local/bin/kubectl
RUN chmod +x /usr/local/bin/kubectl

RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 \
&& chmod +x get_helm.sh \
&& ./get_helm.sh

COPY --from=builder /build/aks-periscope /

ENTRYPOINT ["/aks-periscope"]
10 changes: 8 additions & 2 deletions cmd/aks-periscope/aks-periscope.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/Azure/aks-periscope/pkg/exporter"
"github.com/Azure/aks-periscope/pkg/interfaces"
"github.com/Azure/aks-periscope/pkg/utils"
restclient "k8s.io/client-go/rest"
)

func main() {
Expand All @@ -36,10 +37,15 @@ func main() {
// We need the cert in order to communicate with the storage account.
if utils.IsAzureStackCloud() {
if err := utils.CopyFileFromHost("/etc/ssl/certs/azsCertificate.pem", "/etc/ssl/certs/azsCertificate.pem"); err != nil {
log.Fatalf("cannot copy cert for Azure Stack Cloud environment: %v", err)
log.Fatalf("Cannot copy cert for Azure Stack Cloud environment: %v", err)
}
}

config, err := restclient.InClusterConfig()
if err != nil {
log.Fatalf("Cannot load kubeconfig: %v", err)
}

dataProducers := []interfaces.DataProducer{}

containerLogsCollector := collector.NewContainerLogsCollector()
Expand All @@ -51,7 +57,7 @@ func main() {
nodeLogsCollector := collector.NewNodeLogsCollector()
kubeletCmdCollector := collector.NewKubeletCmdCollector()
systemPerfCollector := collector.NewSystemPerfCollector()
helmCollector := collector.NewHelmCollector()
helmCollector := collector.NewHelmCollector(config)
osmCollector := collector.NewOsmCollector()
smiCollector := collector.NewSmiCollector()

Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ require (
github.com/Azure/go-autorest/autorest/adal v0.9.14 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/onsi/gomega v1.13.0
github.com/pkg/errors v0.9.1 // indirect
helm.sh/helm/v3 v3.6.3
k8s.io/cli-runtime v0.21.3
k8s.io/client-go v0.21.3
rsc.io/letsencrypt v0.0.3 // indirect
)
Loading