Skip to content

Commit 888bec3

Browse files
authored
Sending an empty data to the certsReady channel (#2196)
Signed-off-by: Yuki Iwai <[email protected]>
1 parent 923d0fc commit 888bec3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

cmd/katib-controller/v1beta1/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ func main() {
135135

136136
ctx := signals.SetupSignalHandler()
137137
certsReady := make(chan struct{})
138-
138+
defer close(certsReady)
139139
if initConfig.CertGeneratorConfig.Enable {
140140
if err = cert.AddToManager(mgr, initConfig.CertGeneratorConfig, certsReady); err != nil {
141141
log.Error(err, "Failed to set up cert-generator")
142142
}
143143
} else {
144-
close(certsReady)
144+
certsReady <- struct{}{}
145145
}
146146

147147
// The setupControllers will register controllers to the manager

docs/developer-guide.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ Once the `cert-generator` finished, the Katib controller starts to register cont
114114

115115
You can find the `cert-generator` source code [here](../pkg/certgenerator/v1beta1).
116116

117+
NOTE: the Katib also supports the [cert-manager](https://cert-manager.io/) to generate certs for the admission webhooks instead of using cert-generator.
118+
You can find the installation with the cert-manager [here](../manifests/v1beta1/installs/katib-cert-manager).
119+
117120
## Implement a new algorithm and use it in Katib
118121

119122
Please see [new-algorithm-service.md](./new-algorithm-service.md).

pkg/certgenerator/v1beta1/generator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func (c *CertGenerator) Start(ctx context.Context) error {
6767
if err := c.generate(ctx); err != nil {
6868
return err
6969
}
70-
// Close a certsReady means start to register controllers to the manager.
71-
close(c.certsReady)
70+
// Sending an empty data to a certsReady means it starts to register controllers to the manager.
71+
c.certsReady <- struct{}{}
7272
return nil
7373
}
7474

0 commit comments

Comments
 (0)