Skip to content

Commit

Permalink
feat(devcontainer): ✨ Devcontainer configuration file for
Browse files Browse the repository at this point in the history
kubebuilder

Add Go templates for scaffolding DevContainer related configuration
files in a new Kubebuilder project.

refactor(dev-container): Add separate post-create.sh script.

refactor(dev-container): Use separate shell post create shell script in the container.

fix(dev-container): Remove redudant /bin/bash field.

:seedling: Bump github.com/onsi/ginkgo/v2 from 2.19.0 to 2.19.1

Bumps [github.com/onsi/ginkgo/v2](https:/onsi/ginkgo) from 2.19.0 to 2.19.1.
- [Release notes](https:/onsi/ginkgo/releases)
- [Changelog](https:/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](onsi/ginkgo@v2.19.0...v2.19.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

:seedling: Bump github.com/onsi/gomega from 1.33.1 to 1.34.1

Bumps [github.com/onsi/gomega](https:/onsi/gomega) from 1.33.1 to 1.34.1.
- [Release notes](https:/onsi/gomega/releases)
- [Changelog](https:/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.33.1...v1.34.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

fix: typo in designs template

Signed-off-by: Gabriele Quaresima <[email protected]>

refactor(.devcontainer/Dockerfile): Use Go to install Kind binary.

fix(.devcontainer): 🐛 Paas host network & update post-install script path.

Use Host network to connect with the Host OS's Docker network. Also, execute the post-install.sh script from .devcontainer sub-directory, not the root.

refactor(.devcontainer): Change go's version to 1.22.0.

refactor(.devcontainer/Dockefile): Download Kubebuilder binary directly.

refactor(.devcontainer/post-install.sh) Remove Makefile command.

refactor(.devcontainer): Add check for verifying the existing Kind cluster.

refactor(.devcontainer): Remove debug flag from post-install.sh

fix(.devcontainer): Change interpreter from sh to bash in post-install.sh.

refactor(templates): Add template for generating .devcontainer settings.

⚠️  (cleanup/fix): ImplementWebhooks method should only be used by the e2e tests and should be under its package (kubernetes-sigs#4065)

(cleanup/fix): ImplementWebhooks method should only be used by the e2e tests and should be under its package

(cleanup): cleanup tests for plugin/util functions

pkg/plugin/utils: add tests to cover funcs

🐛 (go/v4): add missing cancel context to controller's suite-test (kubernetes-sigs#4067)

fix: add missing cancel context to controller's suite-test

Upgrade the muilt-version sample to the latest

:seedling: Bump github.com/onsi/ginkgo/v2 from 2.19.1 to 2.20.0

Bumps [github.com/onsi/ginkgo/v2](https:/onsi/ginkgo) from 2.19.1 to 2.20.0.
- [Release notes](https:/onsi/ginkgo/releases)
- [Changelog](https:/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](onsi/ginkgo@v2.19.1...v2.20.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

📖  docs:samples:cronjob: change makefile to generate the CRD without description to allow apply CRDs (kubernetes-sigs#4075)

docs:samples:cronjob: fix makefile to generate the CRD with less description

🌱 Cleanup hack generate docs by removing code duplication (kubernetes-sigs#4076)

(cleanup) hack docs

fix(devcontainer.go): Resolve golangci-lint related issues.

fix(devcontainer.go): Use bash command instead of '.' due to permission issuses.

chore: Remove testDev Container files.

docs(devcontainer): Generate documentation.

test(devcontainer): Add a GH Action for testing dev-container build.

test(devcontainer): Downgrade GH Runner to 20.04 Ubuntu.

refactor(templates): Remove commented settings, and fix licencse year.

ci(devcontainer): Remove commented code.

sparkles: Add support to k8s 1.31 and upgrade dependencies (kubernetes-sigs#4080)

Add support to k8s 1.31

Upgrade controller-gen used to generate the docs from 0.15.0 to 0.16.1

docs: improve and make clear info about setup envtest and its binaries

✨ upgrade kustomize from v5.4.2 to v5.4.3 (kubernetes-sigs#4084)

upgrade kustomize from v5.4.2 to v5.4.3

refactor(devcontainer): Remove Dockerfile template.

docs(devcontainer): Update test data files.

ci(devcontainer): Run CI workflow on everpy PR, and push.

chore: Fix linting typo.

docs(devcontainer): Update test data files.

ci(devcontainer): Run CI workflow on everpy PR, and push.

chore: Fix linting typo.

fix(devcontainer): Add license details in post-install.sh.

ci(devcontainer): Update runner image.

docs(devcontainer): Regenerate docs with license details.
  • Loading branch information
TAM360 committed Aug 17, 2024
1 parent e98ff58 commit 4dcdfaa
Show file tree
Hide file tree
Showing 144 changed files with 1,527 additions and 1,497 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test-devcontainer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test DevContainer Image

on:
push:
pull_request:

jobs:
test-devcontainer:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Go 1.22.x
uses: actions/setup-go@v5
with:
go-version: "1.22.x"

# required for installing devcontainer CLI
- name: Setup NodeJS 20.x
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Setup Devcontainer CLI
run: |
npm install -g @devcontainers/cli
- name: Build and Validate DevContainer
run: |
cd testdata/project-v4
OUTPUT=$(devcontainer up --workspace-folder=./)
STATUS=$(echo "$OUTPUT" | jq -r '.outcome')
if [[ "$STATUS" == "success" ]]; then
echo "Devcontainer setup was successful."
exit 0
else
echo "Devcontainer setup failed."
exit 1
fi
5 changes: 3 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ This action will caall the job [./build/.goreleaser.yml](./build/.goreleaser.yml

### (Deprecated) - To build the Kubebuilder-tools: (Artifacts required to use ENV TEST)

> We are working on to move all out from GCP Kubebuilder project. As it fits as part of Controller-Runtime domain of responsability it is under a ongoing work to change the build of those binaries to controller-tools and how it is implemented in controller-runtime. For further information see the PR: https:/kubernetes-sigs/controller-runtime/pull/2811
> We no longer build the artifacts and the promotion of those is deprecated. For more info
see: https:/kubernetes-sigs/kubebuilder/discussions/4082

Kubebuilder projects requires artifacts which are used to do test with ENV TEST (when we call `make test` target)
These artifacts can be checked in the service page: https://storage.googleapis.com/kubebuilder-tools
Expand All @@ -86,7 +87,7 @@ For further information see the [README](https:/kubernetes-sigs/kube

### (Deprecated) - To build the `kube-rbac-proxy` images:

> We no longer build and promote those images. For more info
> We no longer build the images and the promotion of those images is deprecated. For more info
see: https:/kubernetes-sigs/kubebuilder/discussions/3907

These images are built from the project [brancz/kube-rbac-proxy](https:/brancz/kube-rbac-proxy).
Expand Down
2 changes: 1 addition & 1 deletion build/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ builds:
- darwin_amd64
- darwin_arm64
env:
- KUBERNETES_VERSION=1.30.0
- KUBERNETES_VERSION=1.31.0
- CGO_ENABLED=0

# Only binaries of the form "kubebuilder_${goos}_${goarch}" will be released.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/install-and-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ chmod +x /tmp/mdbook

echo "grabbing the latest released controller-gen"
go version
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1

# make sure we add the go bin directory to our path
gobin=$(go env GOBIN)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Kubebuilder DevContainer",
"image": "golang:1.22-bullseye",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/git:1": {}
},

// Required for running Kind inside DevContainer
"runArgs": ["--network=host"],

"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ms-azuretools.vscode-docker"
]
}
},

"onCreateCommand": "bash .devcontainer/post-install.sh"
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2024 The Kubernetes Authors.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -x

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/kind

curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64
chmod +x kubebuilder
mv kubebuilder /usr/local/bin/

curl -L -o kubectl https://dl.k8s.io/release/v1.31.0/bin/linux/amd64/kubectl
chmod +x kubectl
mv kubectl /usr/local/bin/kubectl

kind version
kubebuilder version
docker --version
go version
kubectl version --client
8 changes: 4 additions & 4 deletions docs/book/src/cronjob-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.0
ENVTEST_K8S_VERSION = 1.31.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -162,9 +162,9 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.2
CONTROLLER_TOOLS_VERSION ?= v0.15.0
ENVTEST_VERSION ?= release-0.18
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.59.1

.PHONY: kustomize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var _ = BeforeSuite(func() {
// Note that you must have the required binaries setup under the bin directory to perform
// the tests directly. When we run make test it will be setup and used automatically.
BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s",
fmt.Sprintf("1.30.0-%s-%s", runtime.GOOS, runtime.GOARCH)),
fmt.Sprintf("1.31.0-%s-%s", runtime.GOOS, runtime.GOARCH)),

WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "config", "webhook")},
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func main() {

// Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
// More info:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.18.4/pkg/metrics/server
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/server
// - https://book.kubebuilder.io/reference/metrics.html
metricsServerOptions := metricsserver.Options{
BindAddress: metricsAddr,
Expand All @@ -135,7 +135,7 @@ func main() {
// FilterProvider is used to protect the metrics endpoint with authn/authz.
// These configurations ensure that only authorized users and service accounts
// can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
// https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.18.4/pkg/metrics/filters#WithAuthenticationAndAuthorization
// https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.19.0/pkg/metrics/filters#WithAuthenticationAndAuthorization
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
}

Expand Down
Loading

0 comments on commit 4dcdfaa

Please sign in to comment.