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

Update ingress apiVersion and make hardcoded variables dynamic #64

Conversation

rudivanhierden
Copy link
Contributor

@rudivanhierden rudivanhierden commented Aug 30, 2022

Description

Use networking.k8s.io/v1 version for ingress. This PR completes the upgrade to the new ingress apiVersion started in openstad/openstad-kubernetes#71.

IMPORTANT: This requires Kubernetes version v1.19 due to switching from networking.k8s.io/v1beta1 to networking.k8s.io/v1.
See https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingress-v122 for more details.

Some ingress values (service name & port for instance) were hardcoded. This PR also uses the already available environment variables to build these ingress values if needed (and falls back to the hardcoded values if they're not). This also fixes the systemIngresses array which caused namespaced installations to have their systemIngresses removed, due to not being openstad-frontend but openstad-NAMESPACE-frontend.

Issue reference

Type of change

feature

Documentation

No updated documentation - changelog is updated

Tests

Locally & test cluster

Branch

Due to the deprecation of networking.k8s.io/v1beta1 in favor of networking.k8s.io/v1 in version 1.22 we must update the Ingress structure.

IMPORTANT: This requires Kubernetes v1.19 (see https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingress-v122).
@rudivanhierden rudivanhierden requested a review from nlsvgtr August 30, 2022 14:01
Copy link
Contributor

@nlsvgtr nlsvgtr left a comment

Choose a reason for hiding this comment

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

LGTM

@rudivanhierden rudivanhierden merged commit d878880 into openstad:development Sep 1, 2022
const systemIngresses = ['openstad-admin', "openstad-frontend", "openstad-image", "openstad-api", "openstad-auth"];
const ingressPrefix = (process.env.KUBERNETES_NAMESPACE ? process.env.KUBERNETES_NAMESPACE : 'openstad');

const systemIngresses = [`${ingressPrefix}-admin`, `${ingressPrefix}-frontend`, `${ingressPrefix}-image`, `${ingressPrefix}-api`, `${ingressPrefix}-auth`];
Copy link
Contributor

Choose a reason for hiding this comment

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

This adds a bug when you are in a different namespace (e.g. acc-2022) but your release name is still openstad.

This will create ingresses with the names openstad-api, openstad-auth etc. but in the namespace acc-2022 and this piece of code will remove the default ingresses.

So this array should be instead:

const systemIngresses = [`${ingressPrefix}-admin`, `${ingressPrefix}-frontend`, `${ingressPrefix}-image`, `${ingressPrefix}-api`, `${ingressPrefix}-auth`, 'openstad-admin', "openstad-frontend", "openstad-image", "openstad-api", "openstad-auth"];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants