Skip to content

Add condition to disable nginx even if not exposing via ingress - #1687

Open
rgarcia89 wants to merge 9 commits into
goharbor:mainfrom
rgarcia89:nginx
Open

Add condition to disable nginx even if not exposing via ingress#1687
rgarcia89 wants to merge 9 commits into
goharbor:mainfrom
rgarcia89:nginx

Conversation

@rgarcia89

Copy link
Copy Markdown
Contributor

No description provided.

…e via ingress

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
@Vad1mo

Vad1mo commented Jan 22, 2024

Copy link
Copy Markdown
Member

This is the same as #1073

we should unite those two PRs.

@zyyw @ninjadq @wy65701436, we need such a PR more than ever more and more people are using different Ingresses nowadays, especially with GatewayAPI. Harbor can not support all the different options, so IMO we should add the option to not render the Ingress at all as we can not cover all the edge cases.

@Vad1mo
Vad1mo self-requested a review January 22, 2024 09:19

@Vad1mo Vad1mo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to update the README.

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
@Vad1mo
Vad1mo self-requested a review January 22, 2024 14:23

@Vad1mo Vad1mo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
Comment thread README.md Outdated
| Parameter | Description | Default |
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| **Expose** | | |
| `expose.enabled` | Set to false if no `ingress`, `clusterIP`, `nodePort` or `loadBalancer` should be created or you plan to expose Harbor in a way not offered by this chart. | `true` |

@wy65701436 wy65701436 Jan 25, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding a new item, I prefer to include additional Enums such as "None" for the expose type. This approach will not overly complicate the code.

And when set the value of expose type to none, we do nothing for ingress and nginx.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my humble opinion, I believe that an enable setter aligns better with the current chart structure.
internalTLS, persistence, trivy, metrics, and trace each have one.
So, essentially, all dispensable components have one. Why deviate from this approach here now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree enable = true/false is common practice in Helm Chart development, we also use it in that chart. While it seem to be more verbose in code it is much easier and straightforward to understand for users what is going on and what is going to happen

@MinerYang MinerYang Jan 25, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enabled more like a two sides thing, like whether using internalTLS or not, there's no third choice. But for expose, we have so many choices already, and made our control flow sometimes redundant with both type and enabled . We would like to make our templates as simple as possible and in the meantime fulfill the requirements.
I will take some time to maybe have an overall adjustment for this part, and please @rgarcia89 help to review on it if your are willing to.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understnad why you think this is to complex logic.

{{- if and (ne .Values.expose.type "ingress") .Values.nginx.enabled }}
  • This is common practice, in writing helm charts, every best practice blog mentions that practive.
  • it is much easier to test in the subsequent logic .Values.nginx.enabled instead of .if Values.expose.type == None
  • It doesn't follow that https://en.wikipedia.org/wiki/Single_responsibility_principle. Values.expose.type would have two different meaning and depending on the value cause implicitly different behaivor, which is difficult to reason about in the long run. especially for the average Chart Developer. (I never knew I would say that in terms of YAML, but its true)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @Vad1mo on that. I don't see why adding an enable switch should increase the complexity of the template. From my understanding, this is following a very simple approach and is not creating a misleading situation, which could be created by a type: none expose.

@MinerYang MinerYang Jan 26, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is not complex, and my first thoughts was could we make it more simple when we only use expose.type as the only entry-point instead of combine with expose.type and nginx.enabled for the proxy usage.
maybe have something like this in values.yaml

expose:
    ## enum type Nginx, Ingress, ClusterIP,  NodePort, Loadbalancer, Others
    type:
    nginx:
        image:
        ...
    ingress:
       hosts:
       ...
    clusterIP:
        name:
        ...
    loadBalancer:
        name:
        ...
    nodeport:
        name:
        ...

While the templates would be something like this

{{- if Values.expose.type == nginx }}

Sure I will take your comments into consideration, And please point me out if I have something understood wrong. Thx~

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update here?

@github-actions

Copy link
Copy Markdown

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

@Vad1mo

Vad1mo commented Apr 19, 2024

Copy link
Copy Markdown
Member

@MinerYang @wy65701436, can we get this thing merged in? What is topping us from doing so?

@MinerYang MinerYang added the enhancement New feature or request label May 30, 2024
@rgarcia89

Copy link
Copy Markdown
Contributor Author

Any update here?

@Vad1mo

Vad1mo commented Sep 27, 2024

Copy link
Copy Markdown
Member

@rgarcia89, can you resolve the conflicts, por favor?

Signed-off-by: Raul Garcia Sanchez <info@raulgarcia.de>
@rgarcia89

Copy link
Copy Markdown
Contributor Author

@Vad1mo todo listo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants