Skip to content

Commit 0ecb227

Browse files
committed
Removes some steps that has been built into kubebuidler
1 parent ce639cb commit 0ecb227

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

docs/addon/walkthrough/README.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -88,55 +88,6 @@ manifests:
8888
EOF
8989
```
9090

91-
### Adding the framework into our types
92-
93-
We now want to plug the framework into our types, so that our CRs will look like
94-
other addon operators.
95-
96-
We begin by editing the api type, we add some common fields. The idea is that
97-
CommonSpec and CommonStatus form a common contract that we expect all addons to
98-
support (and we can hopefully evolve the contract with just a recompile!)
99-
100-
Modify `api/v1alpha1/guestbook_types.go` to:
101-
102-
* add an import for `addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1"`
103-
* add a field `addonv1alpha1.CommonSpec` to the Spec object
104-
* add a field `addonv1alpha1.CommonStatus` to the Status object
105-
* add the accessor functions (ComponentName, CommonSpec, ..)
106-
107-
Your `guestbook_types.go` file should now additionally contain:
108-
109-
```go
110-
import addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1"
111-
112-
type GuestbookSpec struct {
113-
addonv1alpha1.CommonSpec `json:",inline"`
114-
}
115-
116-
type GuestbookStatus struct {
117-
addonv1alpha1.CommonStatus `json:",inline"`
118-
}
119-
120-
var _ addonv1alpha1.CommonObject = &Guestbook{}
121-
122-
func (c *Guestbook) ComponentName() string {
123-
return "guestbook"
124-
}
125-
126-
func (c *Guestbook) CommonSpec() addonv1alpha1.CommonSpec {
127-
return c.Spec.CommonSpec
128-
}
129-
130-
func (c *Guestbook) GetCommonStatus() addonv1alpha1.CommonStatus {
131-
return c.Status.CommonStatus
132-
}
133-
134-
func (c *Guestbook) SetCommonStatus(s addonv1alpha1.CommonStatus) {
135-
c.Status.CommonStatus = s
136-
}
137-
138-
```
139-
14091
### Using the framework in the controller
14192

14293
We replace the controller code `controllers/guestbook_controller.go`:

0 commit comments

Comments
 (0)