-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4310 from kubernetes-sigs/master
🌱 Rebase with master branch to do a patch release 4.3.1
- Loading branch information
Showing
216 changed files
with
17,008 additions
and
1,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "CodeQL Advanced" | ||
|
||
on: | ||
# We are checking both `master` and `book-v4` branches: | ||
# - `master` represents the latest development work. | ||
# - `book-v4` is the latest stable release branch, which contains the latest published code, | ||
# ensuring that any issues in production are identified and addressed promptly. | ||
schedule: | ||
- cron: '30 20 * * 1' # Runs every Monday at 8:30 PM | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze Go | ||
runs-on: ubuntu-latest | ||
permissions: | ||
security-events: write | ||
packages: read | ||
actions: read | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: Build and install Kubebuilder CLI | ||
run: make install | ||
|
||
# Preparing the project-v4 sample for CodeQL analysis: | ||
# - `go mod tidy` ensures dependencies are fully resolved. | ||
# - `make manifests` generates required manifests for a complete project structure. | ||
# - `make build` builds the project code, ensuring all components are ready for CodeQL analysis. | ||
- name: Build project-v4 sample project | ||
run: | | ||
cd testdata/project-v4 | ||
go mod tidy | ||
echo 'Running build commands for Go in project-v4' | ||
make manifests | ||
make build | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: go | ||
build-mode: autobuild | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: External Plugin | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'pkg/' | ||
- 'docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin' | ||
- '.github/workflows/external-plugin.yml' | ||
pull_request: | ||
paths: | ||
- 'pkg/' | ||
- 'docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin' | ||
- '.github/workflows/external-plugin.yml' | ||
|
||
jobs: | ||
external: | ||
name: Verify external plugin | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | ||
steps: | ||
- name: Clone the code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 # Minimal history to avoid .git permissions issues | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22.3' | ||
|
||
- name: Build Sample External Plugin | ||
working-directory: docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin/v1 | ||
run: | | ||
mkdir -p ./bin | ||
make build | ||
- name: Move Plugin Binary to Plugin Path | ||
run: | | ||
# Define the plugin destination for Linux (XDG_CONFIG_HOME path) | ||
XDG_CONFIG_HOME="${HOME}/.config" | ||
PLUGIN_DEST="$XDG_CONFIG_HOME/kubebuilder/plugins/sampleexternalplugin/v1" | ||
# Ensure destination exists and move the built binary | ||
mkdir -p "$PLUGIN_DEST" | ||
mv docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin/v1/bin/sampleexternalplugin "$PLUGIN_DEST/sampleexternalplugin" | ||
chmod +x "$PLUGIN_DEST/sampleexternalplugin" # Ensure the binary is executable | ||
- name: Build Kubebuilder Binary and Setup Environment | ||
env: | ||
KUBEBUILDER_ASSETS: $GITHUB_WORKSPACE/bin | ||
run: | | ||
# Build Kubebuilder Binary | ||
export kb_root_dir=$(pwd) | ||
go build -o "${kb_root_dir}/bin/kubebuilder" ./cmd | ||
chmod +x "${kb_root_dir}/bin/kubebuilder" # Ensure kubebuilder binary is executable | ||
echo "${kb_root_dir}/bin" >> $GITHUB_PATH # Add to PATH | ||
- name: Create Directory, Run Kubebuilder Commands, and Validate Results | ||
env: | ||
KUBEBUILDER_ASSETS: $GITHUB_WORKSPACE/bin | ||
run: | | ||
# Create a directory named testplugin for running kubebuilder commands | ||
mkdir testplugin | ||
cd testplugin | ||
# Run Kubebuilder commands inside the testplugin directory | ||
kubebuilder init --plugins sampleexternalplugin/v1 --domain sample.domain.com | ||
kubebuilder create api --plugins sampleexternalplugin/v1 --number=2 --group=example --version=v1alpha1 --kind=ExampleKind | ||
kubebuilder create webhook --plugins sampleexternalplugin/v1 --hooked --group=example --version=v1alpha1 --kind=ExampleKind | ||
# Validate generated file contents | ||
grep "DOMAIN: sample.domain.com" ./initFile.txt || exit 1 | ||
grep "NUMBER: 2" ./apiFile.txt || exit 1 | ||
grep "HOOKED!" ./webhookFile.txt || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ linters: | |
enable: | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- copyloopvar | ||
- ginkgolinter | ||
- goconst | ||
- gocyclo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,15 +63,15 @@ esac | |
|
||
# grab mdbook | ||
# we hardcode linux/amd64 since rust uses a different naming scheme and it's a pain to tran | ||
echo "downloading mdBook-v0.4.34-${arch}-${target}.${ext}" | ||
echo "downloading mdBook-v0.4.40-${arch}-${target}.${ext}" | ||
set -x | ||
curl -sL -o /tmp/mdbook.${ext} https://github.com/rust-lang/mdBook/releases/download/v0.4.34/mdBook-v0.4.34-${arch}-${target}.${ext} | ||
curl -sL -o /tmp/mdbook.${ext} https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdBook-v0.4.40-${arch}-${target}.${ext} | ||
${cmd} /tmp/mdbook.${ext} | ||
chmod +x /tmp/mdbook | ||
|
||
echo "grabbing the latest released controller-gen" | ||
go version | ||
go install sigs.k8s.io/controller-tools/cmd/[email protected].1 | ||
go install sigs.k8s.io/controller-tools/cmd/[email protected].4 | ||
|
||
# make sure we add the go bin directory to our path | ||
gobin=$(go env GOBIN) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ jobs: | |
- name: Run linter | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59 | ||
version: v1.61 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ linters: | |
enable: | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- copyloopvar | ||
- ginkgolinter | ||
- goconst | ||
- gocyclo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,26 +118,24 @@ 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/[email protected].0/pkg/metrics/server | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/server | ||
// - https://book.kubebuilder.io/reference/metrics.html | ||
metricsServerOptions := metricsserver.Options{ | ||
BindAddress: metricsAddr, | ||
SecureServing: secureMetrics, | ||
// TODO(user): TLSOpts is used to allow configuring the TLS config used for the server. If certificates are | ||
// not provided, self-signed certificates will be generated by default. This option is not recommended for | ||
// production environments as self-signed certificates do not offer the same level of trust and security | ||
// as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing | ||
// unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName | ||
// to provide certificates, ensuring the server communicates using trusted and secure certificates. | ||
TLSOpts: tlsOpts, | ||
TLSOpts: tlsOpts, | ||
} | ||
|
||
if secureMetrics { | ||
// 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/[email protected].0/pkg/metrics/filters#WithAuthenticationAndAuthorization | ||
// https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/filters#WithAuthenticationAndAuthorization | ||
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization | ||
|
||
// TODO(user): If CertDir, CertName, and KeyName are not specified, controller-runtime will automatically | ||
// generate self-signed certificates for the metrics server. While convenient for development and testing, | ||
// this setup is not recommended for production. | ||
} | ||
|
||
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ | ||
|
Oops, something went wrong.