Skip to content

Notes on Go tutorial #6314

@dharmit

Description

@dharmit

What is the URL of the document?

https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/

Which section(s) is the issue in?

  1. Define the api section asks to add // +kubebuilder:validation:Maximum=3 marker. This, in turn, causes the kubectl patch command to fail with:
    $ kubectl patch memcached memcached-sample -p '{"spec":{"size": 5}}' --type=merge
    The Memcached "memcached-sample" is invalid: spec.size: Invalid value: 5: spec.size in body should be less than or equal to 3
  2. The default main.go generated using operator-sdk command doesn't have MemcachedReconciler.Recorder initialized like here. It causes the controller to panic in the Reconcile method.
  3. The CR mentioned in Create a Memcached CR section fails to get created due to missing value for containerPort. Adding containerPort: 11211 to the spec helps fix it.

What needs fixing?

  1. Correcting the kubectl patch command or, adding a note in the doc would be helpful.
  2. Mentioning it somewhere in the doc would be helpful, IMO, and save a lot of time for someone trying to get started with Operators for the first time.
  3. Adding containerPort: 11211 to the spec helps fix it.

Additional context

I'm trying the operator-sdk tutorial for the first time, so let me know if I'm making a mistake instead of something being amiss in the docs.

Metadata

Metadata

Assignees

Labels

kind/documentationCategorizes issue or PR as related to documentation.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions