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

fix: broken tls in jx preview #2129

Merged
merged 3 commits into from
Nov 21, 2018

Conversation

vbehar
Copy link

@vbehar 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
Copy link
Contributor

ccojocar commented Nov 1, 2018

/test bdd

Domain: domain,
},
},
ExposeController: o.HelmValuesConfig.ExposeController,
Copy link
Contributor

@ccojocar ccojocar Nov 1, 2018

Choose a reason for hiding this comment

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

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 fix-exposecontroller-config branch from 8fdaa30 to c0d28cc Compare November 7, 2018 14:35
@vbehar vbehar changed the title preview: use expose-controller values fix: broken tls in jx preview Nov 7, 2018
@vbehar vbehar force-pushed the fix-exposecontroller-config branch from c0d28cc to 4f54f02 Compare November 7, 2018 16:55
@vbehar
Copy link
Author

vbehar commented Nov 7, 2018

/test bdd

@jenkins-x-bot
Copy link
Contributor

@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
Copy link
Author

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
Copy link
Member

/ok-to-test
/test bdd

@vbehar vbehar force-pushed the fix-exposecontroller-config branch 2 times, most recently from 5790bdd to 54672fc Compare November 8, 2018 15:33
@rawlingsj
Copy link
Member

/test bdd

@vbehar vbehar force-pushed the fix-exposecontroller-config branch from 54672fc to 1b45f93 Compare November 9, 2018 07:49
@vbehar
Copy link
Author

vbehar commented Nov 9, 2018

/test bdd

@jstrachan
Copy link
Member

/retest
/approve

@jenkins-x-bot
Copy link
Contributor

[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
Copy link
Author

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

fixes jenkins-x#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
@jstrachan
Copy link
Member

/retest

@jstrachan
Copy link
Member

@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
Copy link
Author

vbehar commented Nov 21, 2018

ok thanks!

@jstrachan
Copy link
Member

/retest

1 similar comment
@jstrachan
Copy link
Member

/retest

@jstrachan
Copy link
Member

@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
@jstrachan
Copy link
Member

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

@vbehar
Copy link
Author

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TLS is broken in jx preview
6 participants