Skip to content

Commit

Permalink
Sending an empty data to the certsReady channel (#2196)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
  • Loading branch information
tenzen-y authored Aug 5, 2023
1 parent 923d0fc commit 888bec3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/katib-controller/v1beta1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ func main() {

ctx := signals.SetupSignalHandler()
certsReady := make(chan struct{})

defer close(certsReady)
if initConfig.CertGeneratorConfig.Enable {
if err = cert.AddToManager(mgr, initConfig.CertGeneratorConfig, certsReady); err != nil {
log.Error(err, "Failed to set up cert-generator")
}
} else {
close(certsReady)
certsReady <- struct{}{}
}

// The setupControllers will register controllers to the manager
Expand Down
3 changes: 3 additions & 0 deletions docs/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ Once the `cert-generator` finished, the Katib controller starts to register cont

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

NOTE: the Katib also supports the [cert-manager](https://cert-manager.io/) to generate certs for the admission webhooks instead of using cert-generator.
You can find the installation with the cert-manager [here](../manifests/v1beta1/installs/katib-cert-manager).

## Implement a new algorithm and use it in Katib

Please see [new-algorithm-service.md](./new-algorithm-service.md).
Expand Down
4 changes: 2 additions & 2 deletions pkg/certgenerator/v1beta1/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func (c *CertGenerator) Start(ctx context.Context) error {
if err := c.generate(ctx); err != nil {
return err
}
// Close a certsReady means start to register controllers to the manager.
close(c.certsReady)
// Sending an empty data to a certsReady means it starts to register controllers to the manager.
c.certsReady <- struct{}{}
return nil
}

Expand Down

0 comments on commit 888bec3

Please sign in to comment.