Skip to content

Commit c52ad99

Browse files
authored
Upgrade operator SDK (#13)
* Migrate to v0.16.0 * Migrate to v0.17.2 * Migrate to v0.18.2 * Migrated to OperatorSDK 1.14.0 * Adding gotestsum * Switch to Github Actions * Autofixing golangci-lint * Use UBI image * Update CRD * Update README * Bundle build works well * Adding release YAMl task
1 parent 1bec934 commit c52ad99

92 files changed

Lines changed: 2270 additions & 1749 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
build/Dockerfile
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bundle.Dockerfile
24
Dockerfile
5+
bin/
6+
build/
7+
testbin/

.github/workflows/go.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Make
2+
3+
on:
4+
push:
5+
branches: [ 'main', 'master', 'release-*' ]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
go-version:
17+
- '1.17'
18+
- '1.16'
19+
steps:
20+
21+
- name: Set up Go ${{ matrix.go-version }}
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
id: go
26+
27+
- name: Check out code into the Go module directory
28+
uses: actions/checkout@v2
29+
30+
- name: Build & Test
31+
run: make test

.github/workflows/security.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Security
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
scan:
12+
name: Snyk code scanning
13+
runs-on: ubuntu-18.04
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Run Snyk to check for vulnerabilities
19+
uses: snyk/actions/golang@master
20+
# To make sure that SARIF upload gets called
21+
continue-on-error: true
22+
env:
23+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
24+
with:
25+
args: --sarif-file-output=snyk.sarif
26+
27+
- name: Upload result to GitHub Code Scanning
28+
uses: github/codeql-action/upload-sarif@v1
29+
with:
30+
sarif_file: snyk.sarif

.gitignore

Lines changed: 22 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,31 @@
1-
# Temporary Build Files
2-
build/_output
3-
build/_test
4-
# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
5-
### Emacs ###
6-
# -*- mode: gitignore; -*-
7-
*~
8-
\#*\#
9-
/.emacs.desktop
10-
/.emacs.desktop.lock
11-
*.elc
12-
auto-save-list
13-
tramp
14-
.\#*
15-
# Org-mode
16-
.org-id-locations
17-
*_archive
18-
# flymake-mode
19-
*_flymake.*
20-
# eshell files
21-
/eshell/history
22-
/eshell/lastdir
23-
# elpa packages
24-
/elpa/
25-
# reftex files
26-
*.rel
27-
# AUCTeX auto folder
28-
/auto/
29-
# cask packages
30-
.cask/
31-
dist/
32-
# Flycheck
33-
flycheck_*.el
34-
# server auth directory
35-
/server/
36-
# projectiles files
37-
.projectile
38-
projectile-bookmarks.eld
39-
# directory configuration
40-
.dir-locals.el
41-
# saveplace
42-
places
43-
# url cache
44-
url/cache/
45-
# cedet
46-
ede-projects.el
47-
# smex
48-
smex-items
49-
# company-statistics
50-
company-statistics-cache.el
51-
# anaconda-mode
52-
anaconda-mode/
53-
### Go ###
1+
542
# Binaries for programs and plugins
553
*.exe
564
*.exe~
575
*.dll
586
*.so
597
*.dylib
60-
# Test binary, build with 'go test -c'
8+
bin
9+
testbin/*
10+
11+
# Test binary, build with `go test -c`
6112
*.test
13+
6214
# Output of the go coverage tool, specifically when used with LiteIDE
6315
*.out
64-
### Vim ###
65-
# swap
66-
.sw[a-p]
67-
.*.sw[a-p]
68-
# session
69-
Session.vim
70-
# temporary
71-
.netrwhist
72-
# auto-generated tag files
73-
tags
74-
### VisualStudioCode ###
75-
.vscode/*
76-
.history
77-
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
16+
17+
# Kubernetes Generated files - skip generated files, except for vendored files
18+
19+
!vendor/**/zz_generated.*
20+
21+
# editor and IDE paraphernalia
22+
.idea
23+
*.swp
24+
*.swo
25+
*~
26+
27+
build/
28+
bundle/
29+
30+
# kustomize manager file
31+
config/manager/kustomization.yaml

.golangci.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
run:
2+
timeout: 5m
3+
build-tags:
4+
- e2e
5+
6+
linters:
7+
disable-all: false
8+
presets:
9+
- bugs
10+
- unused
11+
- complexity
12+
- format
13+
- performance
14+
- style
15+
enable:
16+
- gci
17+
disable:
18+
- paralleltest
19+
- nlreturn
20+
- exhaustivestruct
21+
- wsl
22+
- godox
23+
- scopelint
24+
- maligned
25+
- interfacer
26+
- golint
27+
28+
issues:
29+
exclude-rules:
30+
- path: _test\.go
31+
linters:
32+
- wrapcheck
33+

.revive.toml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
ignoreGeneratedHeader = true
2+
severity = "warning"
3+
4+
# confidence <= 0.2 generate a lot of errors from package-comments rule. It marks files that do not contain
5+
# package-level comments as a warning irrespective of existing package-level coment in one file.
6+
confidence = 0.25
7+
errorCode = 1
8+
warningCode = 1
9+
10+
# Rules block.
11+
# ⚠ Make sure to sort rules alpabetically for readability! ⚠
12+
13+
# argument-limit rule is setting up a maximum number of parameters that can be passed to the functions/methods.
14+
[rule.argument-limit]
15+
arguments = [5]
16+
17+
# atomic rule checks for commonly mistaken usages of the sync/atomic package.
18+
[rule.atomic]
19+
20+
# blank-imports rule disallows blank imports.
21+
[rule.blank-imports]
22+
23+
# bool-literal-in-expr suggests removing boolean literals from logic expressions like `bar == true`, `arg == false`,
24+
# `r != true`, `false && boolExpr` and `boolExpr || true`.
25+
[rule.bool-literal-in-expr]
26+
27+
# constant-logical-expr rule warns on constant logical expressions, like `name == name`.
28+
[rule.constant-logical-expr]
29+
30+
# context-as-argument rule makes sure that context.Context is the first argument of a function.
31+
[rule.context-as-argument]
32+
33+
# context-keys-type rule disallows the usage of basic types in context.WithValue
34+
[rule.context-keys-type]
35+
36+
# confusing-naming rule warns on methods with names that differ only by capitalization.
37+
[rule.confusing-naming]
38+
39+
# confusing-results rule suggests to name potentially confusing function results.
40+
[rule.confusing-results]
41+
42+
# cyclomatic rule sets restriction for maximum Cyclomatic complexity.
43+
[rule.cyclomatic]
44+
arguments = [15]
45+
46+
# deep-exit rule looks for program exits in funcs other than `main()` or `init()`.
47+
[rule.deep-exit]
48+
49+
# dot-imports rule forbids `.` imports.
50+
[rule.dot-imports]
51+
52+
# empty-block warns on empty code blocks.
53+
[rule.empty-block]
54+
55+
# error-return rule ensure that the error return parameter is the last.
56+
[rule.error-return]
57+
58+
# error-strings rule ensure conventions around error strings.
59+
[rule.error-strings]
60+
61+
# error-naming rule ensure naming of error variables (has `Err` or `err` prefix).
62+
[rule.error-naming]
63+
64+
# errorf rule warns on usage errors.New(fmt.Sprintf()) instead of fmt.Errorf()
65+
[rule.errorf]
66+
67+
# exported rule ensure naming and commenting conventions on exported symbols.
68+
[rule.exported]
69+
70+
# flag-parameter rule warns on boolean parameters that create a control coupling.
71+
[rule.flag-parameter]
72+
73+
# get-return rule warns on getters that do not yield any result.
74+
[rule.get-return]
75+
76+
# if-return rule warns redundant if when returning an error.
77+
[rule.if-return]
78+
79+
# increment-decrement rule forces to use `i++` and `i--` instead of `i += 1` and `i -= 1`.
80+
[rule.increment-decrement]
81+
82+
# indent-error-flow rule prevents redundant else statements.
83+
[rule.indent-error-flow]
84+
85+
# modifies-value-receiver warns on assignments to value-passed method receivers.
86+
[rule.modifies-value-receiver]
87+
88+
# package-comments rule ensures package commenting conventions.
89+
[rule.package-comments]
90+
91+
# range rule prevents redundant variables when iterating over a collection.
92+
[rule.range]
93+
94+
# range-val-in-closure warns if range value is used in a closure dispatched as goroutine.
95+
[rule.range-val-in-closure]
96+
97+
# receiver-naming ensures conventions around the naming of receivers.
98+
[rule.receiver-naming]
99+
100+
# redefines-builtin-id warns on redefinitions of built-in (constants, variables, function and types) identifiers,
101+
# like `true := "false"` etc.
102+
[rule.redefines-builtin-id]
103+
104+
# rule.superfluous-else prevents redundant else statements (extends indent-error-flow). Checks for `if-then-else`where
105+
# the then block ends with branching statement like `continue`, `break`, or `goto`.
106+
[rule.superfluous-else]
107+
108+
# rule.struct-tag checks common struct tags like `json`, `xml`, `yaml`.
109+
[rule.struct-tag]
110+
111+
# time-naming rule conventions around the naming of time variables. Like not to use unit suffixes (sec, min etc.) in
112+
# naming variables of type `time.Time` or `time.Duration`.
113+
[rule.time-naming]
114+
115+
# unexported-return rule warns when a public return is from unexported type.
116+
[rule.unexported-return]
117+
118+
# unnecessary-stmt suggests removing or simplifying unnecessary statements like breaks at the end of cases or return at
119+
# the end of bodies of functions returning nothing.
120+
[rule.unnecessary-stmt]
121+
122+
# unreachable-code rule warns on the unreachable code.
123+
[rule.unreachable-code]
124+
125+
# unused-parameter rule suggests to rename or remove unused function parameters.
126+
[rule.unused-parameter]
127+
128+
# var-declaration rule reduces redundancies around variable declaration.
129+
[rule.var-declaration]
130+
131+
# var-naming checks naming rules.
132+
[rule.var-naming]
133+
134+
# waitgroup-by-value rule warns on functions taking `sync.WaitGroup` as a by-value parameter.
135+
[rule.waitgroup-by-value]

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)