Skip to content

Commit

Permalink
Merge pull request #4514 from kubernetes-sigs/master
Browse files Browse the repository at this point in the history
📖 Update the docs with latest release 4.5.0
  • Loading branch information
k8s-ci-robot authored Jan 21, 2025
2 parents 08d9299 + 7153119 commit e8b5541
Show file tree
Hide file tree
Showing 199 changed files with 15,186 additions and 636 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Expand Up @@ -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
Expand All @@ -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
Expand Down
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
Expand Up @@ -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)
Expand Down
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": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/cronjob-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions docs/book/src/cronjob-tutorial/testdata/project/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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 @@ -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,
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -2820,6 +2853,8 @@ spec:
runAsUser:
format: int64
type: integer
seLinuxChangePolicy:
type: string
seLinuxOptions:
properties:
level:
Expand Down
Loading

0 comments on commit e8b5541

Please sign in to comment.