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

mockkubeapiserver: Support stringData when creating a secret #383

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 8 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ name: CI

env:
GOPROXY: https://proxy.golang.org
GOPATH: ${{ github.workspace }}/go

jobs:
verify-goimports:
runs-on: ubuntu-latest
steps:
- name: Set up go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.22'
stable: true

- run: |
echo "GOPATH=${HOME}/go" >> $GITHUB_ENV

- uses: actions/checkout@v2

- name: verify goimports
Expand All @@ -37,22 +33,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.22'
stable: true

- run: |
echo "GOPATH=${HOME}/go" >> $GITHUB_ENV

- uses: actions/checkout@v2

- run: dev/format-gomod

- run: |
changes=$(git status --porcelain)
if [[ -n "${changes}" ]]; then
echo "::error Changes detected from go mod tidy:"
echo "::error Changes detected from dev/format-gomod:"
echo "::error (You may need to run go clean -cache -modcache)"
git diff | head -n60
echo "${changes}"
exit 1
fi
Expand All @@ -62,15 +57,15 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install latest version of Kind
run: |
GO111MODULE=on go get sigs.k8s.io/kind
go get sigs.k8s.io/kind
- name: Create Kind cluster
run: |
PATH=$(go env GOPATH)/bin:$PATH kind create cluster --config .github/workflows/kind-config.yaml
kind create cluster --config .github/workflows/kind-config.yaml
- name: Run some sanity checks
# kubectl is already installed on the Github Ubuntu worker
run: |
Expand Down
3 changes: 2 additions & 1 deletion applylib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
Expand All @@ -35,7 +36,7 @@ require (
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
Expand Down
7 changes: 2 additions & 5 deletions applylib/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxER
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro=
github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down Expand Up @@ -168,8 +167,7 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down Expand Up @@ -440,7 +438,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
20 changes: 12 additions & 8 deletions dev/format-gomod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.


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

set -o errexit
set -o nounset
Expand All @@ -25,10 +25,14 @@ set -o pipefail
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "${REPO_ROOT}"

# Run go mod tidy in each go module
for module in $(find . -name "go.mod"); do
dir="$(dirname ${module})"
pushd "${dir}"
go mod tidy
popd
done
# Print the go version
go version

# Updates the go.mod in each go module
# Note: go work sync is not entirely deterministic; I had to clear my modcache with `go clean -cache -modcache`
go work sync

# Pin mockkubeapiserver an older version of kube, so mockkubeapiserver can be used from repos that aren't on the latest kube
cd ${REPO_ROOT}/mockkubeapiserver
go get k8s.io/client-go@v0.26.2
go get k8s.io/apimachinery@v0.26.2
5 changes: 4 additions & 1 deletion dev/update-golden
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ chmod +x bin/kubectl
export PATH="${REPO_ROOT}/bin:$PATH"
echo "kubectl version is $(kubectl version --client)"

WRITE_GOLDEN_OUTPUT=1 go test -count=1 -v ./...
WRITE_GOLDEN_OUTPUT=1 go test -count=1 -v ./...

cd "${REPO_ROOT}/mockkubeapiserver"
WRITE_GOLDEN_OUTPUT=1 go test -count=1 -v ./...
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"testing"

api "sigs.k8s.io/kubebuilder-declarative-pattern/examples/guestbook-operator/api/v1alpha1"

"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/test/golden"
)

Expand Down
9 changes: 9 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
go 1.22.4

use (
.
./applylib
./examples/guestbook-operator
./ktest
./mockkubeapiserver
)
Loading
Loading