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

📖 Update the docs with latest release 4.5.0 #4514

Merged
merged 22 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d063d5a
📖 Add helm-plugin to the summary of available plugins (#4485)
camilamacedo86 Jan 12, 2025
69cee01
:book: Bump sigs.k8s.io/kubebuilder/v4
dependabot[bot] Jan 14, 2025
0e988a6
:bug: Update golang version to 1.23.0 in init validation logic
dmvolod Jan 16, 2025
b4c7e44
Merge pull request #4491 from dmvolod/update-init-validation-golang-v…
k8s-ci-robot Jan 16, 2025
3fb09bf
Merge pull request #4488 from kubernetes-sigs/dependabot/go_modules/d…
k8s-ci-robot Jan 16, 2025
61337b5
⚠️ Upgrade controller-runtime from v0.19.4 to v0.20.0 and k8s deps fr…
camilamacedo86 Jan 17, 2025
c9e3c03
✨ Upgrade controller-gen from v0.17.0 to v0.17.1 (#4493)
camilamacedo86 Jan 17, 2025
990251e
✨ Upgrade GolangCI Lint from v1.62.2 to v1.63.4 (#4494)
camilamacedo86 Jan 17, 2025
40ece86
Upgrade cert-manager version used from v1.16.0 to v1.16.3
camilamacedo86 Jan 17, 2025
3f5ebd6
Merge pull request #4497 from camilamacedo86/cert-up
k8s-ci-robot Jan 17, 2025
fa4a500
fix: kubebuilder alpha generate command to allow re-create projects w…
camilamacedo86 Jan 17, 2025
dcba8e5
(helm/alpha-v1): fix yaml lint in the ServiceMonitor file
camilamacedo86 Jan 17, 2025
6ea54ee
CLI: Remove unused doc.go
camilamacedo86 Jan 17, 2025
929b016
Merge pull request #4502 from camilamacedo86/fix-yaml-lint
k8s-ci-robot Jan 17, 2025
8c048ff
Merge pull request #4504 from camilamacedo86/remove-unsued-generate
k8s-ci-robot Jan 17, 2025
3debe11
✨ (go/v4): Follow cert-manager org name changes
zchee Jan 19, 2025
c559069
Merge pull request #4501 from camilamacedo86/fix-generate-external
k8s-ci-robot Jan 19, 2025
9d93a04
Merge pull request #4505 from zchee/gov4-cert-manager-org
k8s-ci-robot Jan 19, 2025
48db38c
🌱 (ci): Add GH action to validate generated helm charts for tutorials…
akagami-harsh Jan 20, 2025
19862ad
🌱 fix: alpha generate command. If the output-dir path is not informed…
camilamacedo86 Jan 20, 2025
7564499
fix: use explicit docker.io prefix for Docker Hub images
pl4nty Jan 21, 2025
7153119
Merge pull request #4513 from pl4nty/patch-1
k8s-ci-robot Jan 21, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/lint-sample.yml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
version: v1.63.4
working-directory: ${{ matrix.folder }}
args: --config .golangci.yml ./...
- name: Run linter via makefile target
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
version: v1.63.4

yamllint:
runs-on: ubuntu-latest
101 changes: 101 additions & 0 deletions .github/workflows/test-helm-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Helm Docs Tutorials

on:
push:
paths:
- "docs/book/src/cronjob-tutorial/testdata/project/**"
- "docs/book/src/getting-started/testdata/project/**"
- "docs/book/src/multiversion-tutorial/testdata/project/**"
- ".github/workflows/test-helm-book.yml"
pull_request:
paths:
- "docs/book/src/cronjob-tutorial/testdata/project/** "
- "docs/book/src/getting-started/testdata/project/**"
- "docs/book/src/multiversion-tutorial/testdata/project/**"
- ".github/workflows/test-helm-book.yml"

jobs:
helm-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
folder: [
"docs/book/src/getting-started/testdata/project",
"docs/book/src/cronjob-tutorial/testdata/project",
"docs/book/src/multiversion-tutorial/testdata/project"
]
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Set project name
id: project
run: echo "name=$(basename ${{ matrix.folder }})" >> $GITHUB_OUTPUT

- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

- name: Verify kind installation
run: kind version

- name: Create kind cluster
run: kind create cluster

- name: Prepare project
run: |
cd ${{ matrix.folder }}
go mod tidy
make docker-build IMG=${{ steps.project.outputs.name}}:v0.1.0
kind load docker-image ${{ steps.project.outputs.name}}:v0.1.0

- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

- name: Verify Helm installation
run: helm version

- name: Lint Helm chart
run: |
helm lint ${{ matrix.folder }}/dist/chart

- name: Install Prometheus Operator CRDs
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus-crds prometheus-community/prometheus-operator-crds

- name: Install cert-manager via Helm
run: |
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true

- name: Wait for cert-manager to be ready
run: |
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook

- name: Render Helm chart
run: |
helm template ${{ matrix.folder }}/dist/chart --namespace=${{ steps.project.outputs.name }}-system

- name: Install Helm chart
run: |
helm install my-release ${{ matrix.folder }}/dist/chart --create-namespace --namespace ${{ steps.project.outputs.name}}-system

- name: Check Helm release status
run: |
helm status my-release --namespace ${{ steps.project.outputs.name}}-system

11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -89,9 +89,16 @@ generate-docs: ## Update/generate the docs
./hack/docs/generate.sh

.PHONY: generate-charts
generate-charts: build ## Re-generate the helm chart testdata only
generate-charts: build ## Re-generate the helm chart testdata and docs samples
rm -rf testdata/project-v4-with-plugins/dist/chart
rm -rf docs/book/src/getting-started/testdata/project/dist/chart
rm -rf docs/book/src/cronjob-tutorial/testdata/project/dist/chart
rm -rf docs/book/src/multiversion-tutorial/testdata/project/dist/chart

(cd testdata/project-v4-with-plugins && ../../bin/kubebuilder edit --plugins=helm/v1-alpha)
(cd docs/book/src/getting-started/testdata/project && ../../../../../../bin/kubebuilder edit --plugins=helm/v1-alpha)
(cd docs/book/src/cronjob-tutorial/testdata/project && ../../../../../../bin/kubebuilder edit --plugins=helm/v1-alpha)
(cd docs/book/src/multiversion-tutorial/testdata/project && ../../../../../../bin/kubebuilder edit --plugins=helm/v1-alpha)

.PHONY: check-docs
check-docs: ## Run the script to ensure that the docs are updated
@@ -118,7 +125,7 @@ GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.62.2 ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.63.4 ;\
}

.PHONY: apidiff
21 changes: 0 additions & 21 deletions doc.go

This file was deleted.

1 change: 1 addition & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -120,6 +120,7 @@
- [go/v4](./plugins/available/go-v4-plugin.md)
- [grafana/v1-alpha](./plugins/available/grafana-v1-alpha.md)
- [deploy-image/v1-alpha](./plugins/available/deploy-image-plugin-v1-alpha.md)
- [helm/v1-alpha](./plugins/available/helm-v1-alpha.md)
- [kustomize/v2](./plugins/available/kustomize-v2.md)
- [Extending](./plugins/extending.md)
- [CLI and Plugins](./plugins/extending/extending_cli_features_and_plugins.md)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Kubebuilder DevContainer",
"image": "golang:1.23",
"image": "docker.io/golang:1.23",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/git:1": {}
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.62.2
version: v1.63.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Test Chart

on:
push:
pull_request:

jobs:
test-e2e:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

- name: Verify kind installation
run: kind version

- name: Create kind cluster
run: kind create cluster

- name: Prepare project
run: |
go mod tidy
make docker-build IMG=project:v0.1.0
kind load docker-image project:v0.1.0

- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

- name: Verify Helm installation
run: helm version

- name: Lint Helm Chart
run: |
helm lint ./dist/chart

# TODO: Uncomment if cert-manager is enabled
# - name: Install cert-manager via Helm
# run: |
# helm repo add jetstack https://charts.jetstack.io
# helm repo update
# helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
#
# - name: Wait for cert-manager to be ready
# run: |
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook

# TODO: Uncomment if Prometheus is enabled
# - name: Install Prometheus Operator CRDs
# run: |
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# helm repo update
# helm install prometheus-crds prometheus-community/prometheus-operator-crds
#
# - name: Install Prometheus via Helm
# run: |
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# helm repo update
# helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace
#
# - name: Wait for Prometheus to be ready
# run: |
# kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server

- name: Install Helm chart for project
run: |
helm install my-release ./dist/chart --create-namespace --namespace project-system

- name: Check Helm release status
run: |
helm status my-release --namespace project-system

# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created
# - name: Check Presence of ServiceMonitor
# run: |
# kubectl wait --namespace project-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-controller-manager-metrics-monitor
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.23 AS builder
FROM docker.io/golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH

4 changes: 2 additions & 2 deletions docs/book/src/cronjob-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
@@ -177,12 +177,12 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint

## Tool Versions
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.17.0
CONTROLLER_TOOLS_VERSION ?= v0.17.1
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
GOLANGCI_LINT_VERSION ?= v1.62.2
GOLANGCI_LINT_VERSION ?= v1.63.4

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
2 changes: 2 additions & 0 deletions docs/book/src/cronjob-tutorial/testdata/project/PROJECT
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
domain: tutorial.kubebuilder.io
layout:
- go.kubebuilder.io/v4
plugins:
helm.kubebuilder.io/v1-alpha: {}
projectName: project
repo: tutorial.kubebuilder.io/project
resources:
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
@@ -155,7 +155,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.19.4/pkg/metrics/server
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.0/pkg/metrics/server
// - https://book.kubebuilder.io/reference/metrics.html
metricsServerOptions := metricsserver.Options{
BindAddress: metricsAddr,
@@ -167,7 +167,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.19.4/pkg/metrics/filters#WithAuthenticationAndAuthorization
// https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.0/pkg/metrics/filters#WithAuthenticationAndAuthorization
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
}

Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.0
controller-gen.kubebuilder.io/version: v0.17.1
name: cronjobs.batch.tutorial.kubebuilder.io
spec:
group: batch.tutorial.kubebuilder.io
@@ -2778,6 +2778,39 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
resources:
properties:
claims:
items:
properties:
name:
type: string
request:
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
type: object
restartPolicy:
type: string
runtimeClassName:
@@ -2820,6 +2853,8 @@ spec:
runAsUser:
format: int64
type: integer
seLinuxChangePolicy:
type: string
seLinuxOptions:
properties:
level:
Loading