Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

helm-service: Make public deployment URI configurable #2362

Closed
3 tasks
christian-kreuzberger-dtx opened this issue Sep 16, 2020 · 5 comments · Fixed by #2882 or #2916
Closed
3 tasks

helm-service: Make public deployment URI configurable #2362

christian-kreuzberger-dtx opened this issue Sep 16, 2020 · 5 comments · Fixed by #2882 or #2916
Assignees
Labels
area:helm-service Everything related to the helm-service good first issue Issues for getting started developing Keptn type:improvement Improves/enhances an existing feature
Milestone

Comments

@christian-kreuzberger-dtx
Copy link
Member

With Keptn 0.7.x we introduced the option for continuous deployments to configure the ingress port, protocol, and suffix, e.g.:
https://keptn.sh/docs/0.7.x/continuous_delivery/expose_services/#create-configmap-with-ingress-information

This is already used here:

svc.Name + "." + c.getNamespace(project, stageName) + "." + mesh.GetIngressHostnameSuffix(), // service_name.dev.123.45.67.89.xip.io

and here
publicDeploymentURI := protocol + "://" + keptnHandler.KeptnBase.Event.GetService() + "." + keptnHandler.KeptnBase.Event.GetProject() + "-" + keptnHandler.KeptnBase.Event.GetStage() + "." + ingressHostnameSuffix + ":" + port

This generates hostnames that look as follows:

${INGRESS_PROTOCOL}://${service}.${project}-${stage}.${INGRESS_HOSTNAME}:${INGRESS_PORT}

Example: https://carts.sockshop-dev.127.0.0.1.nip.io:443

Enhancement

I believe that we can go one step further and make the hostname generation fully configurable, by introducing a config with placeholders, e.g.:

HOSTNAME_TEMPLATE=${INGRESS_PROTOCOL}://${service}.${project}-${stage}.${INGRESS_HOSTNAME}:${INGRESS_PORT}

In addition, this allows users to change certain parts of the logic, e.g.,

  • ...${service}-${stage}.${project}... (carts-dev.sockshop.127.0.0.1.nip.io)
  • ...${service}-${stage}-${project}... (carts-dev-sockshop.127.0.0.1.nip.io)

The later has the benefit that you can use a wildcard certificate for ${INGRESS_HOSTNAME}, instead of having to generate wildcard certificates for each stage.

Definition of Done

  • extend ingress_config.go with a function to read HOSTNAME_TEMPLATE
  • Change the URL generation in helm-service such that it uses and processes the hostname template (please use a built-in templating syntax of GoLang)
  • The default behaviour (service.project-stage....) must still work as it was
@christian-kreuzberger-dtx christian-kreuzberger-dtx added good first issue Issues for getting started developing Keptn area:helm-service Everything related to the helm-service type:improvement Improves/enhances an existing feature labels Sep 16, 2020
@lonerapier
Copy link

If anyone is not working on this, then I would like to take the issue. I may need some guidance on how to approach this.

@christian-kreuzberger-dtx christian-kreuzberger-dtx added this to Backlog in Working items via automation Sep 25, 2020
@christian-kreuzberger-dtx christian-kreuzberger-dtx moved this from Backlog to Assigned and committed in Working items Sep 25, 2020
@christian-kreuzberger-dtx
Copy link
Member Author

Hi! Thanks for approaching us, I've assigned this ticket to you.

I may need some guidance on how to approach this.

For organizational questions and processes, please go through our Contribution Guide.

For coding, first thing I recommend is installing Keptn with continuous delivery enabled on a Kubernetes cluster (either in the Cloud or locally using K3s) - see https://keptn.sh/docs/0.7.x/operate/install/ for options.

Fork and clone this repo, branch away from master (e.g., git checkout -b feature/2362/helm_deployment_uri) and start coding in the helm-service directory ;)

I've linked two files and the respective lines of code in the issue above, this should be a good starting point. If you need any more guidance, please let us know.

@lonerapier
Copy link

@christian-kreuzberger-dtx I am not able to understand how are we going to define HOSTNAME_TEMPLATE and how would we use it? Is it going to be an env variable also? Or do we have to define a new struct for HOSTNAME_TEMPLATE?
Can you elaborate a bit more?

@christian-kreuzberger-dtx
Copy link
Member Author

For now HOSTNAME_TEMPLATE is going to be an environment variable, same as here

@christian-kreuzberger-dtx
Copy link
Member Author

Re-assigning this issue to @warber

@warber warber moved this from Assigned and committed to Backlog in Working items Oct 14, 2020
@johannes-b johannes-b moved this from Backlog to Assigned and committed in Working items Oct 15, 2020
@johannes-b johannes-b added this to the 0.8.0 milestone Nov 12, 2020
@warber warber removed their assignment Dec 9, 2020
@warber warber moved this from Assigned and committed to Backlog in Working items Dec 9, 2020
@bacherfl bacherfl self-assigned this Dec 14, 2020
@bacherfl bacherfl moved this from Backlog to Assigned and committed in Working items Dec 14, 2020
@bacherfl bacherfl moved this from Assigned and committed to In progress in Working items Dec 14, 2020
bacherfl added a commit that referenced this issue Jan 7, 2021
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@bacherfl bacherfl moved this from In progress to Ready for review in Working items Jan 7, 2021
bacherfl added a commit that referenced this issue Jan 12, 2021
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
@bacherfl bacherfl moved this from Ready for review to Done/presented in community review (column will be cleaned regularly) in Working items Jan 15, 2021
bacherfl added a commit that referenced this issue Jan 15, 2021
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
bacherfl added a commit that referenced this issue Jan 15, 2021
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
bacherfl added a commit that referenced this issue Jan 15, 2021
* #2362 added missing configmap reference

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>

* #2362 consider hostname_template in virtual service creation

Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:helm-service Everything related to the helm-service good first issue Issues for getting started developing Keptn type:improvement Improves/enhances an existing feature
Projects
No open projects
Working items
Done/presented in community review (c...
5 participants