<!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-8990" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-6083d321-52b3-434e-a6c9-db9bd6c6ed12" height="16" width="16" border="0" align="absmiddle" alt="Task"> AEROGEAR-8990</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-8990" style="color: #3b73af; text-decoration: none">Re: Impl to get automatically clusterHost IP</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">*Following the progress on this task*<br><br>h4. Regards get the cluster IP and protocol automatically via ks8 api:<br><br>The following works when the project is executed with the command "make run-local" but not when the operator is deployed by the image, using the command "make create-all" the IP returned is not the master one.&nbsp;&nbsp;<br><br>* If it is running in a cluster the os.Getenv("KUBERNETES_SERVICE_HOST") has a value which is returned here and is not the value expected. ("https://172.30.0.1:443")<br><br>* When run locally, "outside of the cluster" the&nbsp;&nbsp;KUBERNETES_SERVICE_HOST is empty and the value expected is returned. ("https://192.168.64.19:8443")<br><br>{code:java}<br>func getClusterProtocol() string {<br> cfg, _:= config.GetConfig()<br> cfgHost := cfg.Host<br> cfgHost = strings.Replace(cfgHost, "//", "", 2)<br> host := strings.Split(cfgHost, ":")<br><br> return host[0]<br>}<br><br><br>func getHostIP() string {<br> cfg, _:= config.GetConfig()<br> cfgHost := cfg.Host<br> cfgHost = strings.Replace(cfgHost, "//", "", 2)<br> host := strings.Split(cfgHost, ":")<br><br> return host[1]<br>}<br><br>{code}<br> <br>The same behaviour happened if we try to use the func `rest.InClusterConfig()` as follows.<br><br>{code:java}<br>func getClusterProtocol() string {<br> cfg, _:= rest.InClusterConfig()<br> cfgHost := cfg.Host<br> cfgHost = strings.Replace(cfgHost, "//", "", 2)<br> host := strings.Split(cfgHost, ":")<br> log.Info("Utils - ConfigHost", cfg.Host)<br> return host[0]<br>}<br><br><br>func getHostIP() string {<br> cfg, _:= rest.InClusterConfig()<br> cfgHost := cfg.Host<br> cfgHost = strings.Replace(cfgHost, "//", "", 2)<br> host := strings.Split(cfgHost, ":")<br> log.Info("Utils - ConfigHost", cfg.Host)<br><br> return host[1]<br>}<br>{code}<br><br>h4. Tests with suggestion<br><br>* Tests doing exactly the same of the code suggested by [~weil] [here|https://github.com/linzhuangrong/prometheus-operator/blob/9874ab3427f7395b57b1fd696f24ca52ff928f55/test/framework/ingress.go#L24]<br>* See [here|https://issues.jboss.org/browse/AEROGEAR-8990?focusedCommentId=13724577&amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13724577], the OCP did not create the router based on the ingress source generated. <br>* Also, shows that this is just used to test the operator and not to expose the service on it. <br>* Shows that prometheus is using the host as we are doing. See [here|https://github.com/linzhuangrong/prometheus-operator/blob/9874ab3427f7395b57b1fd696f24ca52ff928f55/helm/alertmanager/templates/ingress.yaml#L24] and asking for setup the host see [here|https://github.com/linzhuangrong/prometheus-operator/blob/9874ab3427f7395b57b1fd696f24ca52ff928f55/helm/grafana/README.md#L47]<br>* Prometheus shows expose the services by shell too see [here|https://github.com/linzhuangrong/prometheus-operator/blob/9874ab3427f7395b57b1fd696f24ca52ff928f55/helm/grafana/templates/NOTES.txt#L11]<br><br>h4. Looking for examples. <br><br>* Integr8ly is informing the host as we are doing here. See [here|https://github.com/integr8ly/gitea-operator/blob/9b58cafe5e57b28606fafb569fbd0b2928021af2/templates/gitea-ingress.yaml#L10] and [here|https://github.com/integr8ly/gitea-operator/blob/9b58cafe5e57b28606fafb569fbd0b2928021af2/templates/gitea-config.yaml#L31]<br><br>* The WordPress operator shows request the domain definition for the host too. See [here|https://github.com/presslabs/wordpress-operator/blob/55cede40032a0f6a4188239cf394afc8dbcf6ba2/chart/wordpress-operator/templates/crds.yaml#L100] and [here|https://github.com/presslabs/wordpress-operator/blob/1d285e7cff886ac42fe88a9ec742b824b3c05e17/pkg/controller/wordpress/internal/sync/ingress.go#L66]<br><br>* This one is informing the domain too. [here|https://github.com/infinimesh/operator/blob/72eedaa87d5feb12eedc676fd38780c79593602e/pkg/controller/platform/apiserver_rest.go#L128] and [here|https://github.com/infinimesh/operator/blob/f77e95bc90f944af9197458a2e939149001a9e1c/config/samples/infinimesh_v1beta1_platform.yaml#L14]<br><br>* The vault.operator shows also requiring the host. See [here|https://github.com/coreos/vault-operator/blob/9f310f12f67d3080e16d1fa5dc0d345aa543a966/doc/user/tectonic/ingress.md#L3] and [here|https://github.com/coreos/vault-operator/blob/9f310f12f67d3080e16d1fa5dc0d345aa543a966/doc/user/tectonic/vault-ui.md#L40]<br><br>* The CrunchyData shows request to the user create the ingress/route manually. See [here|https://github.com/CrunchyData/postgres-operator/blob/7e867ebf211b488def26dfaf10d7b2b5bbd6f5f6/hugo/content/Installation/_index.md#pgo-cli-installation]<br> <br>*Conclusion: Shows that all operators are informing the host and it is a config value made by the user, or leading the steps to expose the service to the user by describing how to do it via README. Also, I could find a case where the expose of the service is made by running the shell command by the project which will install the operator instead of using the resources*<br><br><br>h4.NOTES:<br><br>* The following commands will return the master.<br><br>{code:java}<br>$ kubectl config view -o jsonpath='{.clusters[0].cluster.server}'<br><br>$ oc status | grep server<br><br>$ kubectl cluster-info<br><br>$ kubectl cluster-info dump | grep -m 1 hostIP<br><br>{code}<br><br>* The command "kubectl config view" return the config file from kube (.kube/)</span> <span class="diffaddedchars" style="background-color:#ddfade;"><br><br>h4. Next Steps<br><br>* Raise questions to eng of operator-sdk and/or ocp to see if we can find a great solution<br>* If not: ( just improve it but keep the need to inform the hostname as all other oprators )<br>*&nbsp;&nbsp;Replace the name clusterIP for Hostname and describe on CR and README that it is the IP and/or the hostname <br>* Create a shell script to get the clusterIP and a make command calling it. <br>* Updade the readme </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-8990#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-d2c0c8c4-6edc-4b56-a037-f435632a7ab8" 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-8990#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>