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

Ci improvements #51

Merged
merged 3 commits into from
Sep 3, 2023
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
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
20 changes: 14 additions & 6 deletions .github/workflows/merge-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: build-lint-test

on:
pull_request:
Expand All @@ -13,13 +13,21 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: "go.mod"

- name: Install dependencies
run: go get .

- name: Vet
run: go vet ./...

- name: Set up Go
uses: actions/setup-go@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
go-version: 1.20.2
version: latest

- name: Build
run: go build -v ./...
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ builds:
- darwin
goarch:
- amd64
- arm64

- id: windows-amd64
binary: kor
Expand Down
8 changes: 7 additions & 1 deletion pkg/kor/serviceaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func getServiceAccountsFromRoleBindings(clientset *kubernetes.Clientset, namespa

func retrieveUsedSA(kubeClient *kubernetes.Clientset, namespace string) ([]string, []string, []string, error) {

podServiceAccounts := []string{}
var podServiceAccounts []string

// Retrieve pods in the specified namespace
pods, err := kubeClient.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})
Expand All @@ -82,7 +82,13 @@ func retrieveUsedSA(kubeClient *kubernetes.Clientset, namespace string) ([]strin
}

roleServiceAccounts, err := getServiceAccountsFromRoleBindings(kubeClient, namespace)
if err != nil {
return nil, nil, nil, err
}
clusterRoleServiceAccounts, err := getServiceAccountsFromClusterRoleBindings(kubeClient, namespace)
if err != nil {
return nil, nil, nil, err
}
return podServiceAccounts, roleServiceAccounts, clusterRoleServiceAccounts, nil
}

Expand Down