File: README.md
โ ๏ธ IMPORTANT NOTICE: Images under
gcr.io/kubebuilder/Will Be Unavailable SoonIf your project uses
gcr.io/kubebuilder/kube-rbac-proxyit will be affected.
Your project may fail to work if the image cannot be pulled. You must move as soon as possible, sometime from early 2025, the GCR will go away.The usage of the project kube-rbac-proxy was discontinued from Kubebuilder and Operator-SDK.
It was replaced for similar protection usingauthn/authzvia Controller-Runtime's feature WithAuthenticationAndAuthorization.For more information and guidance see the discussion https://github.com/kubernetes-sigs/kubebuilder/discussions/3907
Documentation
Docs can be found on the Operator SDK website.
Overview
This project is a component of the Operator Framework, an
open source toolkit to manage Kubernetes native applications, called
Operators, in an effective, automated, and scalable way. Read more in
the introduction blog post.
Operators make it easy to manage complex stateful
applications on top of Kubernetes. However writing an Operator today can
be difficult because of challenges such as using low level APIs, writing
boilerplate, and a lack of modularity which leads to duplication.
The Operator SDK is a framework that uses the
controller-runtime library to make writing
operators easier by providing:
- High level APIs and abstractions to write the operational logic more intuitively
- Tools for scaffolding and code generation to bootstrap a new project fast
- Extensions to cover common Operator use cases
Dependency and platform support
Go version
Release binaries will be built with the Go compiler version specified in the developer guide.
A Go Operator project's Go version can be found in its go.mod file.
Kubernetes versions
Supported Kubernetes versions for your Operator project or relevant binary can be determined
by following this compatibility guide.
Platforms
The set of supported platforms for all binaries and images can be found in these tables.
Community and how to get involved
How to contribute
Check out the contributor documentation.
License
Operator SDK is under Apache 2.0 license. See the LICENSE file for details.
File: proposals/README.md
Operator SDK Proposals
This directory contains design documents for accepted proposals. To
propose a new feature use the template document. Note that
if the proposal gets accepted whoever is the proposal implementation
owner is expected to carry out the implementation, the implementation
owner can be different to the proposal creator.
File: testdata/helm/memcached-operator/helm-charts/memcached/README.md
Memcached
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Based on the memcached chart from the Bitnami Charts repository.
TL;DR;
$ helm install stable/memcachedIntroduction
This chart bootstraps a Memcached deployment on a Kubernetes cluster using the Helm package manager.
Installing the Chart
To install the chart with the release name my-release:
$ helm install --name my-release stable/memcachedThe command deploys Memcached on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.
Tip: List all releases using
helm list
Uninstalling the Chart
To uninstall/delete the my-release deployment:
$ helm delete my-releaseThe command removes all the Kubernetes components associated with the chart and deletes the release.
Configuration
The following table lists the configurable parameters of the Memcached chart and their default values.
| Parameter | Description | Default |
|---|---|---|
image |
The image to pull and run | A recent official memcached tag |
imagePullPolicy |
Image pull policy | Always if imageTag is latest, else IfNotPresent |
memcached.verbosity |
Verbosity level (v, vv, or vvv) | Un-set. |
memcached.maxItemMemory |
Max memory for items (in MB) | 64 |
memcached.extraArgs |
Additional memcached arguments | [] |
extraContainers |
Container sidecar definition(s) as string | Un-set |
extraVolumes |
Volume definitions to add as string | Un-set |
kind |
Install as StatefulSet or Deployment | StatefulSet |
podAnnotations |
Map of annotations to add to the pod(s) | {} |
podLabels |
Custom Labels to be applied to statefulset | Un-set |
nodeSelector |
Simple pod scheduling control | {} |
tolerations |
Allow or deny specific node taints | {} |
affinity |
Advanced pod scheduling control | {} |
securityContext.enabled |
Enable security context | true |
securityContext.fsGroup |
Group ID for the container | 1001 |
securityContext.runAsUser |
User ID for the container | 1001 |
updateStrategy.type |
Update strategy for the StatefulSet/Deployment | RollingUpdate |
priorityClassName |
Specifies the pod's priority class name | Un-set |
The above parameters map to memcached params. For more information please refer to the Memcached documentation.
Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,
$ helm install --name my-release \
--set memcached.verbosity=v \
stable/memcachedThe above command sets the Memcached verbosity to v.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
$ helm install --name my-release -f values.yaml stable/memcachedTip: You can use the default values.yaml
Upgrading to 3.x from a previous major version
Version 3.0.0 of this chart makes an incompatible change to the way StatefulSet/Deployment selectors are configured. If you try to upgrade from a previous major version, you will see an error like this:
Error: UPGRADE FAILED: Deployment.apps "mc-test-memcached" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"mc-test-memcached", "chart":"memcached-3.0.0", "custom":"value", "heritage":"Tiller", "release":"mc-test"}: `selector` does not match template `labels`To upgrade from a previous major version, you'll either need to perform a small manual fix or delete and reinstall the chart.
Upgrading with `kind: StatefulSet`
If you're using a StatefulSet, you'll have to manually delete it and allow Helm to re-create it. Run kubectl delete --cascade=false sts name-goes-here to delete the StatefulSet without deleting the pods. Once you've done this, upgrade the chart as normal, and the newly-created StatefulSet will adopt the old pods.
Upgrading with `kind: Deployment`
If you're using a Deployment, the manual fix is to remove all selectors from the spec except app and release. Run kubectl edit deploy name-goes-here, and you should see a part like this in your editor about 20 lines down:
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: mc-test-memcached
chart: memcached-2.10.2
heritage: Tiller
release: mc-testRemove the lines under matchLabels except app: ... and release: ..., and don't change any other lines. The part from above should look like this when you're done:
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: mc-test-memcached
release: mc-testOnce you've done this, you can upgrade to 3.x with Helm as normal.
If you want prometheus-operator scrap all serviceMonitors in your cluster you need to set:
prometheus:
prometheusSpec:
serviceMonitorSelectorNilUsesHelmValues: falseIf you want to be specific:
prometheus:
prometheusSpec:
serviceMonitorSelector:
matchLabels:
app: memcachedYou can have more intel in prometheus-operator values and here github
File: testdata/go/v4/monitoring/memcached-operator/docs/monitoring/runbooks/memcachedDeploymentSizeUndesired.md
MemcachedDeploymentSizeUndesired
Meaning
MemcachedDeploymentSizeUndesired is triggered when the number of availablememcached-sample replicas doesn't match the requested configuration.
Impact
Unavailability of distributed memory object caching system in the cluster.
Diagnosis
Check memcached-sample's pod namespace:
export NAMESPACE="$(kubectl get deployment -A | grep memcached-sample | awk '{print $1}')"Observe the status of the memcached-sample deployment:
kubectl get deploy memcached-sample -n $NAMESPACE -o yamlObserve the logs of the memcached manager pod, to see why it cannot create the memcached-sample pods.
kubectl get logs <memcached-operator-controller-manager-pod> -n memcached-operator-system
Mitigation
There can be several reasons. Like:
- Node resource exhaustion
- Not enough memory on the cluster
- Nodes are down
Try to identify the root cause and fix it.
File: testdata/go/v4/monitoring/memcached-operator/docs/monitoring/runbooks/memcachedOperatorDown.md
MemcachedOperatorDown
Meaning
No running memcached-operator-controller-manager pods were detected in the last 5 min.
Impact
Complete failure in the Memcached CR lifecycle management.
i.e. launching a new Memcached instance or shutting down an existing one.
Diagnosis
Observe the status of the memcached-operator-controller-manager deployment:
kubectl get deploy memcached-operator-controller-manager -n mecmached-operator-system -o yaml
Mitigation
There can be several reasons for the memcached-operator-controller-manager pod to be down, identify the root cause and fix it.
- Check the status of the memcached-operator-controller-manager deployment to
find out more information. The following command will provide the associated events and show if there are any issues with pulling an image, crashing pod, etc.
kubectl describe deploy memcached-operator-controller-manager -n memcached-operator-system
Check if there are issues with the nodes. For example, if they are in a NotReady state.
kubectl get nodes
File: testdata/go/v4/monitoring/memcached-operator/docs/monitoring/metrics.md
Operator Metrics
This document aims to help users that are not familiar with metrics exposed by this operator.
The metrics documentation is auto-generated by the utility tool "monitoring/metricsdocs" and reflects all of the metrics that are exposed by the operator.
Operator Metrics List
memcached_deployment_size_undesired_count_total
Total number of times the deployment size was not as desired. Type: Counter.
Developing new metrics
After developing new metrics or changing old ones, please run "make generate-metricsdocs" to regenerate this document.
If you feel that the new metric doesn't follow these rules, please change "monitoring/metricsdocs" according to your needs.
File: testdata/go/v4/monitoring/memcached-operator/README.md
memcached-operator
// TODO(user): Add simple overview of use/purpose
Description
// TODO(user): An in-depth paragraph about your project and overview of use
Getting Started
Prerequisites
- go version v1.24.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
To Deploy on the cluster
Build and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/memcached-operator:tagNOTE: This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
Make sure you have the proper permission to the registry if the above commands donโt work.
Install the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/memcached-operator:tagNOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin
privileges or be logged in as admin.
Create instances of your solution
You can apply the samples (examples) from the config/sample:
kubectl apply -k config/samples/NOTE: Ensure that the samples has default values to test it out.
To Uninstall
Delete the instances (CRs) from the cluster:
kubectl delete -k config/samples/Delete the APIs(CRDs) from the cluster:
make uninstallUnDeploy the controller from the cluster:
make undeployProject Distribution
Following the options to release and provide this solution to the users.
By providing a bundle with all YAML files
- Build the installer for the image built and published in the registry:
make build-installer IMG=<some-registry>/memcached-operator:tagNOTE: The makefile target mentioned above generates an 'install.yaml'
file in the dist directory. This file contains all the resources built
with Kustomize, which are necessary to install this project without its
dependencies.
- Using the installer
Users can just run 'kubectl apply -f ' to install
the project, i.e.:
kubectl apply -f https://raw.githubusercontent.com/<org>/memcached-operator/<tag or branch>/dist/install.yamlBy providing a Helm Chart
- Build the chart using the optional helm plugin
operator-sdk edit --plugins=helm/v1-alpha- See that a chart was generated under 'dist/chart', and users
can obtain this solution from there.
NOTE: If you change the project, you need to update the Helm Chart
using the same command above to sync the latest changes. Furthermore,
if you create webhooks, you need to use the above command with
the '--force' flag and manually ensure that any custom configuration
previously added to 'dist/chart/values.yaml' or 'dist/chart/manager/manager.yaml'
is manually re-applied afterwards.
Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project
NOTE: Run make help for more information on all potential make targets
More information can be found via the Kubebuilder Documentation
License
Copyright 2026.
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.0Unless 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.
File: testdata/go/v4/memcached-operator/README.md
memcached-operator
// TODO(user): Add simple overview of use/purpose
Description
// TODO(user): An in-depth paragraph about your project and overview of use
Getting Started
Prerequisites
- go version v1.24.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
To Deploy on the cluster
Build and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/memcached-operator:tagNOTE: This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
Make sure you have the proper permission to the registry if the above commands donโt work.
Install the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/memcached-operator:tagNOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin
privileges or be logged in as admin.
Create instances of your solution
You can apply the samples (examples) from the config/sample:
kubectl apply -k config/samples/NOTE: Ensure that the samples has default values to test it out.
To Uninstall
Delete the instances (CRs) from the cluster:
kubectl delete -k config/samples/Delete the APIs(CRDs) from the cluster:
make uninstallUnDeploy the controller from the cluster:
make undeployProject Distribution
Following the options to release and provide this solution to the users.
By providing a bundle with all YAML files
- Build the installer for the image built and published in the registry:
make build-installer IMG=<some-registry>/memcached-operator:tagNOTE: The makefile target mentioned above generates an 'install.yaml'
file in the dist directory. This file contains all the resources built
with Kustomize, which are necessary to install this project without its
dependencies.
- Using the installer
Users can just run 'kubectl apply -f ' to install
the project, i.e.:
kubectl apply -f https://raw.githubusercontent.com/<org>/memcached-operator/<tag or branch>/dist/install.yamlBy providing a Helm Chart
- Build the chart using the optional helm plugin
operator-sdk edit --plugins=helm/v1-alpha- See that a chart was generated under 'dist/chart', and users
can obtain this solution from there.
NOTE: If you change the project, you need to update the Helm Chart
using the same command above to sync the latest changes. Furthermore,
if you create webhooks, you need to use the above command with
the '--force' flag and manually ensure that any custom configuration
previously added to 'dist/chart/values.yaml' or 'dist/chart/manager/manager.yaml'
is manually re-applied afterwards.
Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project
NOTE: Run make help for more information on all potential make targets
More information can be found via the Kubebuilder Documentation
License
Copyright 2026.
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.0Unless 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.