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

fix: broken tls in jx preview #2129

Merged
merged 3 commits into from Nov 21, 2018

Conversation

Projects
None yet
6 participants
@vbehar
Copy link
Contributor

vbehar commented Oct 31, 2018

Submitter checklist

  • Change is code complete and matches issue description.
  • Change is covered by existing or new tests.

Description

TLS was broken in jx preview because:

  • the omitempty json tag was missing from the ExposeControllerConfig struct, which resulted in empty values being present in the extraValues.yaml file - thus overriding valid values from the values.yaml file
  • the cmdline flags passed through jx preview for the ExposeControllerConfig struct were not used to generate the extraValues.yaml file
  • ths tls-acme flag's default value was "false", which was not an empty value, and thus was overriding the value from the values.yaml file. If we use the empty string as default value, it will still default to false in the exposecontroller, while allowing the values.yaml file from the preview chart to enable TLS

Special notes for the reviewer(s)

I've created a new func to build the PreviewValuesConfig, so that I can unit test it - making sure values from the PreviewOptions ends up in the PreviewValuesConfig

Which issue this PR fixes

fixes #2196

@ccojocar

This comment has been minimized.

Copy link
Member

ccojocar commented Nov 1, 2018

/test bdd

Domain: domain,
},
},
ExposeController: o.HelmValuesConfig.ExposeController,

This comment has been minimized.

@ccojocar

ccojocar Nov 1, 2018

Member

ExposeController can be nil in the HelmValueConfig. Please could you add a check for this, and create a default one if is nil? It would be great if you could add a small test for this scenario.

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from 8fdaa30 to c0d28cc Nov 7, 2018

@vbehar vbehar changed the title preview: use expose-controller values fix: broken tls in jx preview Nov 7, 2018

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from c0d28cc to 4f54f02 Nov 7, 2018

@jenkins-x-bot jenkins-x-bot added size/L and removed size/S labels Nov 7, 2018

@vbehar

This comment has been minimized.

Copy link
Contributor

vbehar commented Nov 7, 2018

/test bdd

@jenkins-x-bot

This comment has been minimized.

Copy link
Contributor

jenkins-x-bot commented Nov 7, 2018

@vbehar: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test bdd

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@vbehar

This comment has been minimized.

Copy link
Contributor

vbehar commented Nov 7, 2018

@ccojocar hi, sorry about the long time to fix this. I checked for nil and added a unit test, and also rebased on master

@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 7, 2018

/ok-to-test
/test bdd

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch 2 times, most recently from 5790bdd to 54672fc Nov 8, 2018

@rawlingsj

This comment has been minimized.

Copy link
Member

rawlingsj commented Nov 9, 2018

/test bdd

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from 54672fc to 1b45f93 Nov 9, 2018

@vbehar

This comment has been minimized.

Copy link
Contributor

vbehar commented Nov 9, 2018

/test bdd

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from 1b45f93 to 97d35b0 Nov 12, 2018

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from 97d35b0 to b9079ed Nov 13, 2018

@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 14, 2018

/retest
/approve

@jenkins-x-bot

This comment has been minimized.

Copy link
Contributor

jenkins-x-bot commented Nov 14, 2018

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jstrachan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from b9079ed to 894583d Nov 19, 2018

@vbehar

This comment has been minimized.

Copy link
Contributor

vbehar commented Nov 20, 2018

@ccojocar @jstrachan Hi, can you please help me understand why the test is failing ? It's a little hard to get information ;-)

I tried to run make docker-test locally, and the promote tests fail, but it's because of some missing ctx on my end (unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined). If I skip the promote tests, everything works.

and if I try to login through dex, I got an internal server error: Failed to return user's identity.

thanks

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from 894583d to 34b269a Nov 20, 2018

fix(preview): broken tls in jx preview
fixes #2196

- the `omitempty` json tag was missing from the ExposeControllerConfig struct, which resulted in empty values being present in the extraValues.yaml file - thus overriding valid values from the values.yaml file
- the cmdline flags passed through `jx preview` for the ExposeControllerConfig struct were not used to generate the extraValues.yaml file
- ths `tls-acme` flag's default value was `"false"`, which was not an empty value, and thus was overriding the value from the values.yaml file. If we use the empty string as default value, it will still default to false in the exposecontroller, while allowing the values.yaml file from the preview chart to enable TLS

also extracting the preview values config in a func, to unit test it

@vbehar vbehar force-pushed the vbehar:fix-exposecontroller-config branch from 34b269a to 050020a Nov 21, 2018

@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 21, 2018

/retest

@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 21, 2018

@vbehar looks like the bdd tests issue is related to the BDD tests stuff (jx step bdd) and nothing to do with your PR - am investigating...

@vbehar

This comment has been minimized.

Copy link
Contributor

vbehar commented Nov 21, 2018

ok thanks!

@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 21, 2018

/retest

1 similar comment
@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 21, 2018

/retest

@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 21, 2018

@vbehar so it looks like these changes break the BDD tests as when running the BDD tests with this build we get:

 ./build/linux/jx step bdd -b --provider=gke --git-provider=ghe --git-provider-url=https://github.beescloud.com --git-username **** --git-api-token **** --default-****-password **** --no-delete-app --no-delete-repo --tests install --tests test-create-spring
Warning failed to load version: No Major.Minor.Patch elements found
Creating team bdd-ghe-jx-pr-2129-17
Namespace bdd-ghe-jx-pr-2129-17 created
 Updated the team settings in namespace bdd-ghe-jx-pr-2129-17
Storing the kubernetes provider gke in the TeamSettings
Updated the team settings in namespace bdd-ghe-jx-pr-2129-17
Enabling helm template mode in the TeamSettings
Updated the team settings in namespace bdd-ghe-jx-pr-2129-17
Git configured for user: JenkinsXBot and email jenkins-x@googlegroups.com
Using helm2
Skipping tiller
Updated the team settings in namespace bdd-ghe-jx-pr-2129-17
helm installed and configured
Updated the team settings in namespace bdd-ghe-jx-pr-2129-17
existing ingress controller found, no need to install a new one
Waiting for external loadbalancer to be created and update the nginx-ingress-controller service in kube-system namespace
Note: this loadbalancer will fail to be provisioned if you have insufficient quotas, this can happen easily on a GKE free account. To view quotas run: gcloud compute project-info describe
External loadbalancer created
Waiting to find the external host name of the ingress controller Service in namespace kube-system with name jxing-nginx-ingress-controller
No domain flag provided so using default 104.155.31.11.nip.io to generate Ingress rules
nginx ingress controller installed and configured
Saving Git token configuration for server https://github.beescloud.com and user name ****.
Cloning the Jenkins X cloud environments repo to /builder/home/.jx/cloud-environments
Cloning the Jenkins X cloud environments repo to /builder/home/.jx/cloud-environments
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Compressing objects: 100% (8/8), done.
Total 1219 (delta 2), reused 4 (delta 1), pack-reused 1210
Creating Secret jx-install-config in namespace bdd-ghe-jx-pr-2129-17
Generated helm values /builder/home/.jx/extraValues.yaml
Installing Jenkins X platform helm chart from: /builder/home/.jx/cloud-environments/env-gke
Using local value overrides file /home/jenkins/go/src/github.com/jenkins-x/jx/myvalues.yaml
Installing jx into namespace bdd-ghe-jx-pr-2129-17
error: Failed to install team bdd-ghe-jx-pr-2129-17: failed to parse TLS exposecontroller boolean strconv.ParseBool: parsing "": invalid syntax

so it looks like we'll need to fix the BDD tests + the jenkins X installer to handle blank values for ExposeControllerConfig

@jenkins-x-bot jenkins-x-bot merged commit 0bc33a7 into jenkins-x:master Nov 21, 2018

3 checks passed

Hound 1 violation found.
serverless-jenkins succeeded
tide In merge pool.
Details
@jstrachan

This comment has been minimized.

Copy link
Member

jstrachan commented Nov 21, 2018

@vbehar I fixed the parsing if blank strings so the rebase worked in the BDD tests

@vbehar

This comment has been minimized.

Copy link
Contributor

vbehar commented Nov 21, 2018

great, thanks @jstrachan !

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