Skip to content

Commit fb467ab

Browse files
authored
Merge pull request #383 from justinsb/mock_kubeapiserver_support_secret_plaintext
mockkubeapiserver: Support stringData when creating a secret
2 parents a248ed1 + 82a46e7 commit fb467ab

File tree

45 files changed

+1432
-170
lines changed

Some content is hidden

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

45 files changed

+1432
-170
lines changed

.github/workflows/main.yml

+8-13
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,17 @@ name: CI
66

77
env:
88
GOPROXY: https://proxy.golang.org
9-
GOPATH: ${{ github.workspace }}/go
109

1110
jobs:
1211
verify-goimports:
1312
runs-on: ubuntu-latest
1413
steps:
1514
- name: Set up go
16-
uses: actions/setup-go@v2
15+
uses: actions/setup-go@v5
1716
with:
1817
go-version: '1.22'
1918
stable: true
2019

21-
- run: |
22-
echo "GOPATH=${HOME}/go" >> $GITHUB_ENV
23-
2420
- uses: actions/checkout@v2
2521

2622
- name: verify goimports
@@ -37,22 +33,21 @@ jobs:
3733
runs-on: ubuntu-latest
3834
steps:
3935
- name: Set up go
40-
uses: actions/setup-go@v2
36+
uses: actions/setup-go@v5
4137
with:
4238
go-version: '1.22'
4339
stable: true
4440

45-
- run: |
46-
echo "GOPATH=${HOME}/go" >> $GITHUB_ENV
47-
4841
- uses: actions/checkout@v2
4942

5043
- run: dev/format-gomod
5144

5245
- run: |
5346
changes=$(git status --porcelain)
5447
if [[ -n "${changes}" ]]; then
55-
echo "::error Changes detected from go mod tidy:"
48+
echo "::error Changes detected from dev/format-gomod:"
49+
echo "::error (You may need to run go clean -cache -modcache)"
50+
git diff | head -n60
5651
echo "${changes}"
5752
exit 1
5853
fi
@@ -62,15 +57,15 @@ jobs:
6257
runs-on: [ubuntu-latest]
6358
steps:
6459
- uses: actions/checkout@v1
65-
- uses: actions/setup-go@v1
60+
- uses: actions/setup-go@v5
6661
with:
6762
go-version: '1.22'
6863
- name: Install latest version of Kind
6964
run: |
70-
GO111MODULE=on go get sigs.k8s.io/kind
65+
go get sigs.k8s.io/kind
7166
- name: Create Kind cluster
7267
run: |
73-
PATH=$(go env GOPATH)/bin:$PATH kind create cluster --config .github/workflows/kind-config.yaml
68+
kind create cluster --config .github/workflows/kind-config.yaml
7469
- name: Run some sanity checks
7570
# kubectl is already installed on the Github Ubuntu worker
7671
run: |

applylib/go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ require (
2323
require (
2424
github.com/davecgh/go-spew v1.1.1 // indirect
2525
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
26+
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
2627
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
2728
github.com/go-logr/logr v1.4.1 // indirect
2829
github.com/go-openapi/jsonpointer v0.19.6 // indirect
@@ -35,7 +36,7 @@ require (
3536
github.com/google/gofuzz v1.2.0 // indirect
3637
github.com/google/uuid v1.3.0 // indirect
3738
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
38-
github.com/imdario/mergo v0.3.12 // indirect
39+
github.com/imdario/mergo v0.3.15 // indirect
3940
github.com/josharian/intern v1.0.0 // indirect
4041
github.com/json-iterator/go v1.1.12 // indirect
4142
github.com/mailru/easyjson v0.7.7 // indirect

applylib/go.sum

+2-5
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxER
5050
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
5151
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
5252
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
53-
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
54-
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
53+
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
5554
github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro=
5655
github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
5756
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -168,8 +167,7 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
168167
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
169168
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
170169
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
171-
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
172-
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
170+
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
173171
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
174172
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
175173
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@@ -440,7 +438,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
440438
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
441439
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
442440
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
443-
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
444441
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
445442
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
446443
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

dev/format-gomod

+12-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717

18-
# CI script to run all the test commands
18+
# CI script to keep all our go.mod/go.sum updated
1919

2020
set -o errexit
2121
set -o nounset
@@ -25,10 +25,14 @@ set -o pipefail
2525
REPO_ROOT=$(git rev-parse --show-toplevel)
2626
cd "${REPO_ROOT}"
2727

28-
# Run go mod tidy in each go module
29-
for module in $(find . -name "go.mod"); do
30-
dir="$(dirname ${module})"
31-
pushd "${dir}"
32-
go mod tidy
33-
popd
34-
done
28+
# Print the go version
29+
go version
30+
31+
# Updates the go.mod in each go module
32+
# Note: go work sync is not entirely deterministic; I had to clear my modcache with `go clean -cache -modcache`
33+
go work sync
34+
35+
# Pin mockkubeapiserver an older version of kube, so mockkubeapiserver can be used from repos that aren't on the latest kube
36+
cd ${REPO_ROOT}/mockkubeapiserver
37+
go get k8s.io/[email protected]
38+
go get k8s.io/[email protected]

dev/update-golden

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ chmod +x bin/kubectl
1919
export PATH="${REPO_ROOT}/bin:$PATH"
2020
echo "kubectl version is $(kubectl version --client)"
2121

22-
WRITE_GOLDEN_OUTPUT=1 go test -count=1 -v ./...
22+
WRITE_GOLDEN_OUTPUT=1 go test -count=1 -v ./...
23+
24+
cd "${REPO_ROOT}/mockkubeapiserver"
25+
WRITE_GOLDEN_OUTPUT=1 go test -count=1 -v ./...

examples/guestbook-operator/controllers/guestbook_controller_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"testing"
2121

2222
api "sigs.k8s.io/kubebuilder-declarative-pattern/examples/guestbook-operator/api/v1alpha1"
23-
2423
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/test/golden"
2524
)
2625

go.work

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
go 1.22.4
2+
3+
use (
4+
.
5+
./applylib
6+
./examples/guestbook-operator
7+
./ktest
8+
./mockkubeapiserver
9+
)

0 commit comments

Comments
 (0)