Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster_config: init cluster variables on startup #1059

Merged
merged 3 commits into from
Oct 3, 2024

Commits on Oct 2, 2024

  1. cluster_config: move type definitions to the beginning of the file

    Just a bit more clarity
    
    Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
    ykaliuta committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    3a7c707 View commit details
    Browse the repository at this point in the history
  2. cluster_config: init cluster variables on startup

    Cluster configuration is supposed to be the same during operator pod
    lifetime. There is no point to detect it on every reconcile cycle
    keeping in mind that it can causes many api requests.
    
    Do the initialization on startup. Keep GetOperatorNamespace()
    returning error since it defines some logic in the DSCInitialization
    reconciler.
    
    Automatically called init() won't work here due to need to check
    error of the initialization.
    
    Wrap logger into context and use it in the Init() like
    controller-runtime does [1][2].
    
    Save root context without the logger for mgr.Start since "setup"
    logger does not fit normal manager's work.
    
    Leave GetDomain() as is since it uses OpenshiftIngress configuration
    which is created when DSCInitialization instantiated.
    
    Log cluster configuration on success from Init, so remove platform
    logging from main.
    
    [1] https://github.com/kubernetes-sigs/controller-runtime/blob/38546806f2faf5973e3321a7bd5bb3afdbb5767d/pkg/internal/controller/controller.go#L297
    [2] https://github.com/kubernetes-sigs/controller-runtime/blob/38546806f2faf5973e3321a7bd5bb3afdbb5767d/pkg/internal/controller/controller.go#L111
    
    Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
    ykaliuta committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    5dea823 View commit details
    Browse the repository at this point in the history
  3. cluster: do not return error from GetRelease

    GetRelease return values are defined at startup, the error checked
    in main, so no point to return error anymore.
    
    Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
    ykaliuta committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    f8d6e88 View commit details
    Browse the repository at this point in the history