sigs.k8s.io/kubebuilder/v3@v3.14.0/hack/docs/internal/cronjob-tutorial/main_revisited.go (about) 1 /* 2 Copyright 2023 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package cronjob 18 19 const MainBatch = ` 20 // +kubebuilder:docs-gen:collapse=Imports 21 22 /* 23 The first difference to notice is that kubebuilder has added the new API 24 group's package (` + "`" + `batchv1` + "`" + `) to our scheme. This means that we can use those 25 objects in our controller. 26 27 If we would be using any other CRD we would have to add their scheme the same way. 28 Builtin types such as Job have their scheme added by` + " `" + `clientgoscheme` + "`" + `. 29 */` 30 31 const MainEnableWebhook = ` 32 33 /* 34 We'll also set up webhooks for our type, which we'll talk about next. 35 We just need to add them to the manager. Since we might want to run 36 the webhooks separately, or not run them when testing our controller 37 locally, we'll put them behind an environment variable. 38 39 We'll just make sure to set` + " `" + `ENABLE_WEBHOOKS=false` + "`" + ` when we run locally. 40 */`