-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arnaud Tincelin
authored and
Arnaud Tincelin
committed
Sep 10, 2021
1 parent
165e024
commit 258e968
Showing
10 changed files
with
186 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: aks-periscope | ||
spec: | ||
backoffLimit: 0 | ||
template: | ||
metadata: | ||
labels: | ||
app: aks-periscope | ||
spec: | ||
serviceAccountName: aks-periscope-service-account | ||
restartPolicy: Never | ||
containers: | ||
- name: go-test-runner | ||
image: go-test-runner | ||
securityContext: | ||
privileged: true | ||
envFrom: | ||
- configMapRef: | ||
name: containerlogs-config | ||
- configMapRef: | ||
name: kubeobjects-config | ||
- configMapRef: | ||
name: nodelogs-config | ||
env: | ||
- name: IN_CLUSTER | ||
value: "1" # To indicate the tests run from within the cluster | ||
volumeMounts: | ||
- name: varlog | ||
mountPath: /var/log | ||
- name: resolvlog | ||
mountPath: /run/systemd/resolve | ||
- name: etcvmlog | ||
mountPath: /etchostlogs | ||
- name: runner | ||
mountPath: /runner | ||
volumes: | ||
- name: varlog | ||
hostPath: | ||
path: /var/log | ||
- name: resolvlog | ||
hostPath: | ||
path: /run/systemd/resolve | ||
- name: etcvmlog | ||
hostPath: | ||
path: /etc | ||
- name: runner | ||
hostPath: | ||
path: /runner | ||
type: Directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: aks-periscope | ||
|
||
resources: | ||
- job.yaml | ||
- ../../deployment/namespace.yaml | ||
- ../../deployment/cluster-role.yaml | ||
- ../../deployment/cluster-role-binding.yaml | ||
- ../../deployment/config-map.yaml | ||
- ../../deployment/crd.yaml | ||
- ../../deployment/service-account.yaml | ||
|
||
patches: | ||
- path: patch-command.yaml | ||
target: | ||
kind: Job | ||
name: aks-periscope | ||
version: v1 | ||
group: batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:alpine AS builder | ||
|
||
ENV GO111MODULE=on \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux \ | ||
GOARCH=amd64 | ||
|
||
WORKDIR /build | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package collector | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestNewDNSCollector(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
want int | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "get dns logs", | ||
want: 1, | ||
wantErr: false, | ||
}, | ||
} | ||
|
||
c := NewDNSCollector() | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
err := c.Collect() | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("Collect() error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
raw := c.GetData() // kubectl -n aks-periscope exec -it aks-periscope-h7gml -- command which returns > cat etc/resolv.conf | ||
if len(raw) < tt.want { | ||
t.Errorf("len(GetData()) = %v, want %v", len(raw), tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters