<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 
        <base href="https://issues.jboss.org"> 
        <title>Message Title</title> 
    </head> 
    <body class="jira" style="color: #333333; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.429"> 
        <table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt" bgcolor="#f5f5f5"> 
            <!-- header here --> 
            <tbody>
                <tr> 
                    <td id="header-pattern-container" style="padding: 0px; border-collapse: collapse; padding: 10px 20px"> 
                        <table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                            <tbody>
                                <tr> 
                                    <td id="header-avatar-image-container" valign="top" style="padding: 0px; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px" width="32"> <img id="header-avatar-image" class="image_fix" src="https://static.jboss.org/developer/gravatar/bd1946aafd256fc8796cd927befe1353?d=mm&amp;s=48" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top"> </td> 
                                    <td id="header-text-container" valign="middle" style="padding: 0px; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> <a class="user-hover" rel="cmacedo86" id="email_cmacedo86" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=cmacedo86" style="color:#0052cc;; color: #3b73af; text-decoration: none">Camila Macedo</a> <strong>edited a comment</strong> on <a href="https://issues.jboss.org/browse/AEROGEAR-9089" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-e62f83d8-f4c6-45b4-8189-9a699857ff09" height="16" width="16" border="0" align="absmiddle" alt="Task"> AEROGEAR-9089</a> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="email-content-container" style="padding: 0px; border-collapse: collapse; padding: 0 20px"> 
                        <table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0; border-collapse: separate"> 
                            <tbody>
                                <tr> 
                                    <!-- there needs to be content in the cell for it to render in some clients --> 
                                    <td class="email-content-rounded-top mobile-expand" style="padding: 0px; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 15px; background-color: #ffffff; border-left: 1px solid #cccccc; border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px; height: 10px; line-height: 10px; padding: 0 15px 0 16px; mso-line-height-rule: exactly" height="10" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                            <tbody>
                                                <tr> 
                                                    <td style="vertical-align: top;; padding: 0px; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" class="page-title-pattern-header-container"> <span class="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"> <a href="https://issues.jboss.org/browse/AEROGEAR-9089" style="color: #3b73af; text-decoration: none">Re: Change operator to watch specific namespaces and or labels</a> </span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td id="text-paragraph-pattern-top" class="email-content-main mobile-expand  comment-top-special-margin comment-top-pattern" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff; border-bottom: none; padding-bottom: 0" bgcolor="#ffffff"> 
                                        <table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px"> 
                                            <tbody>
                                                <tr> 
                                                    <td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0px; border-collapse: collapse; padding: 0 0 10px 0; padding-top: 10px"> <span class="diffcontext">h4. What was done here?<br><br>In the following PR we added a workaround to not allow apply the APP CR in a namespace which is not declared in an ENV VAR.&nbsp;&nbsp;<br>In this way, the operator will work with apps which are just applied in the specific namespaces as it is done currently for Graphana. <br><br>PR: https://github.com/aerogear/mobile-security-service-operator/pull/57<br><br>h4. Was possible impl the workarround to create N managers to watch/cache just the declared namespaces in the EnvVar?<br> <br>I tried this suggested approach but it doesn't work. Following the code impl to check it in the main.go<br><br><br>{code:java}<br>func main() {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{....}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Create cmd Manager for the Operator<br> namespace, err := k8sutil.GetWatchNamespace()<br> handleManagerPerNamespace(cfg, string(namespace))<br><br> //Get all custom namespace which will be watched by the operator<br> watchAppNamespacesEnvVar , err := utils.GetAppNamespaces()<br> if err != nil {<br>&nbsp;&nbsp;log.Error(err, "Failed to get APP_NAMESPACES")<br>&nbsp;&nbsp;os.Exit(1)<br> }<br><br> //Create a cmd manager and add schemas for each namespace specified in the APP_NAMESPACES env var<br> for _, ns := range strings.Split(watchAppNamespacesEnvVar, ";") {<br>&nbsp;&nbsp;log.Info("Creating manager for the namespace: " +&nbsp;&nbsp;string(ns))<br>&nbsp;&nbsp;handleManagerPerNamespace(cfg, string(ns))<br> }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{....}<br>}<br><br><br><br>//handleManagerPerNamespace create the manager, add schemas and start it<br>func handleManagerPerNamespace(cfg *rest.Config, ns string) {<br> mgr := createNamespaceCmdManager(cfg, ns)<br> addSchemeToManager(mgr)<br> startCmdManager(mgr)<br>}<br><br>//createNamespaceCmdManager creates a manager for an specific Namespace<br>func createNamespaceCmdManager(cfg *rest.Config, namespace string) manager.Manager {<br> // Create a new Cmd to provide shared dependencies and start components<br> mgr, err := manager.New(cfg, manager.Options{<br>&nbsp;&nbsp;Namespace: namespace,<br> })<br><br> if err != nil {<br>&nbsp;&nbsp;log.Error(err, "")<br>&nbsp;&nbsp;os.Exit(1)<br> }<br> return mgr<br>}<br><br>//startCmdManager<br>func startCmdManager(mgr manager.Manager) {<br> log.Info("Starting the Cmd.")<br> // Start the Cmd<br> if err := mgr.Start(signals.SetupSignalHandler()); err != nil {<br>&nbsp;&nbsp;log.Error(err, "Manager exited non-zero")<br>&nbsp;&nbsp;os.Exit(1)<br> }<br>}<br><br>//addSchemeToManager will register the schemas for each manager<br>func addSchemeToManager(mgr manager.Manager) {<br> log.Info("Registering Components.")<br> // Setup Scheme for all resources<br> if err := apis.AddToScheme(mgr.GetScheme()); err != nil {<br>&nbsp;&nbsp;log.Error(err, "")<br>&nbsp;&nbsp;os.Exit(1)<br> }<br> //Add route Openshift scheme<br> if err := routev1.AddToScheme(mgr.GetScheme().); err != nil {<br>&nbsp;&nbsp;log.Error(err, "")<br>&nbsp;&nbsp;os.Exit(1)<br> }<br> // Setup all Controllers<br> if err := controller.AddToManager(mgr); err != nil {<br>&nbsp;&nbsp;log.Error(err, "")<br>&nbsp;&nbsp;os.Exit(1)<br> }<br>}<br><br>{code}<br><br>*IMPORTANT:* The controller/reconcile impl of this oper will use the cmd.manager to manage the resources and it does not work for namespaces which are not passed as an option for its watch/cache.<br><br>h4. Will we able to do it in the future?<br><br>The great news that I'd like to share with you is that the solution for it is impl already and merged in the master branch see the commit[1] and the test[2] with this need attended.&nbsp;&nbsp;&nbsp;<br><br>Unfortunately, show that the version released with, v0.2.0-alpha.0[3], has break changes and cannot be used with the current version of OCP 3.11 and the Kube used by it.<br><br>We opened an issue in this repo to ask if they can release a new stable version for we are able to get this feature/implementation. See here[4]. <br><br>[1] - https://github.com/kubernetes-sigs/controller-runtime/commit/fc804a411c06919561edbcb0453601c436556613<br>[2] - https://github.com/kubernetes-sigs/controller-runtime/blob/68ae79ea094aab567d78d7d8596accac2dc27fd0/pkg/manager/example_test.go#L59<br>[3] - https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.2.0-alpha.0<br>[4] - https://github.com/kubernetes-sigs/controller-runtime/issues/413<br><br>*IMPORTANT:* The author of this impl works in RedHat and I already speak with him before. I am trying to contact him privately to check if they can release a new stable version with just this feature impl to attend us.</span> <span class="diffaddedchars" style="background-color:#ddfade;"> I will send an email in the operator-sdk too and check if they can attend us and/or check what they can suggest/recommend as a workaround.</span> <span class="diffcontext"> <br><br>c/c [~dffrench] [~weil] [~peter.braun] [~chrisfoley]<br><br></span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="actions-pattern-container" valign="middle" style="padding: 0px; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0"> 
                                                        <table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                                            <tbody>
                                                                <tr> 
                                                                    <td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0; vertical-align: middle"> <a href="https://issues.jboss.org/browse/AEROGEAR-9089#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="cid:jira-generated-image-static-comment-icon-0aeca1d5-38f3-4c96-bc60-4d3c916191e3" alt="Add Comment" title="Add Comment" height="16" width="16" border="0" style="vertical-align: middle"> </a> </td> 
                                                                    <td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px"> <a href="https://issues.jboss.org/browse/AEROGEAR-9089#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a> </td> 
                                                                </tr> 
                                                            </tbody>
                                                        </table> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <!-- there needs to be content in the cell for it to render in some clients --> 
                                <tr> 
                                    <td class="email-content-rounded-bottom mobile-expand" style="padding: 0px; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #ffffff; border-top: 0; border-left: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly" height="5" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="footer-pattern" style="padding: 0px; border-collapse: collapse; padding: 12px 20px"> 
                        <table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                            <tbody>
                                <tr> 
                                    <td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0px; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> This message was sent by Atlassian Jira <span id="footer-build-information">(v7.12.1#712002-<span title="609a50578ba6bc73dbf8b05dddd7c04a04b6807c" data-commit-id="609a50578ba6bc73dbf8b05dddd7c04a04b6807c}">sha1:609a505</span>)</span> </td> 
                                    <td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0px; border-collapse: collapse; padding-left: 20px; vertical-align: top"> 
                                        <table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="footer-pattern-logo-desktop-padding" style="padding: 0px; border-collapse: collapse; padding-top: 3px"> <img id="footer-pattern-logo-desktop" src="https://issues.jboss.org/images/mail/atlassian-email-logo.png" alt="Atlassian logo" title="Atlassian logo" width="191" height="24" class="image_fix"> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
            </tbody>
        </table>   
    </body>
</html>