Skip to content

Commit

Permalink
Merge pull request #383 from justinsb/mock_kubeapiserver_support_secr…
Browse files Browse the repository at this point in the history
…et_plaintext

mockkubeapiserver: Support stringData when creating a secret
  • Loading branch information
k8s-ci-robot authored Jul 29, 2024
2 parents a248ed1 + 82a46e7 commit fb467ab
Show file tree
Hide file tree
Showing 45 changed files with 1,432 additions and 170 deletions.
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/[email protected]
go get k8s.io/[email protected]
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

0 comments on commit fb467ab

Please sign in to comment.