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

Delegated PKI and adapt to k8s 1.15.3+ #412

Merged
merged 7 commits into from
May 28, 2020

Conversation

Wiston999
Copy link
Contributor

This PR is the result of adapting the module to be used to replace a kubespray based deployment for a k8s 1.15.3 version.
The main relevant changes in the PR are the following:

  • Add a delegated_pki option. If set to true, all the required x509 certificates under /etc/kubernetes/pki/ must be provided externally by the module user by other means. We added that option as we are providing all certificates (including sa.pub and sa.key) from a Hashicorp Vault server dinamically instead of the ones generated by kubetool.
  • Fix docker daemon.json templates.
    • Respect docker_cgroup_driver variable for /etc/docker/daemon.json generated file.
    • Don't add extra , when docker_storage_opts is empty.
    • Don't add extra , when docker_extra_daemon_config is an empty string
    • Added spec cases to verify that generated daemon.json file is actually a JSON valid file.
  • Added extra options to etcd:
  • Add join_discovery_file variable to kubernetes class.
    • Used to be passed to kubeadm join to use a --discovery-file instead of --config parameters. This is needed when certificates are provided externally.
  • Add kube_api_bind_port variable kubernetes class. Used to override default port for bindPort for InitConfiguration in /etc/kubernetes/config.yaml
  • Use v1beta2 kubeadm configuration version for kubernetes 1.15.3+. (Probably can be used for all 1.15 versions).
  • Add some additional test cases to cover new variables.

Wiston999 and others added 3 commits May 18, 2020 13:41
Merge from upstream repository
# Este es el mensaje del 1er commit:

Add extra etcd configuration settings

# Este es el mensaje del commit #2:

Adapt generic etcd configuration file too

# Este es el mensaje del commit puppetlabs#3:

Add delegated_pki variable

# Este es el mensaje del commit puppetlabs#4:

Optional for certs

# Este es el mensaje del commit puppetlabs#5:

More optionals and some checking

# Este es el mensaje del commit puppetlabs#6:

|| to or

# Este es el mensaje del commit puppetlabs#7:

Print docker/daemon.json , conditionally in debian

# Este es el mensaje del commit puppetlabs#8:

Add etcd_max_wals var to proper place

# Este es el mensaje del commit puppetlabs#9:

Actually fix docker/daemon.json

# Este es el mensaje del commit puppetlabs#10:

Use hostname in initial advertise if SRV discovery

# Este es el mensaje del commit puppetlabs#11:

Add more missing etcd vars to config/kubeadm.pp

# Este es el mensaje del commit puppetlabs#12:

Add more missing etcd vars to config/kubeadm.pp, use variant

# Este es el mensaje del commit puppetlabs#13:

Forward cgroup driver to docker daemon too

# Este es el mensaje del commit puppetlabs#14:

Forward cgroup driver to docker daemon too, fix redhat docker.json template

# Este es el mensaje del commit puppetlabs#15:

parametrize kube_api_bind_port
Make sa_* optionals

Escape version dot

Use v1beta2 on 1.15.3 and more

Add resourceContainer: / to kube-proxy config

Manage kubeadm join discovery file

Manage kubeadm join discovery file

Don't add --config if --discovery-file is present

Test that docker/daemon.json is a valid JSON when generated, small fixes to template

Adjust comment in init.pp and add test for kube_api_bind_port

Add some test to kubeadm_* resources
@Wiston999 Wiston999 requested a review from a team as a code owner May 19, 2020 15:08
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2020

Codecov Report

Merging #412 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #412   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           2       2           
  Lines          44      44           
======================================
  Misses         44      44           
Impacted Files Coverage Δ
lib/puppet/parser/functions/kubeadm_join_flags.rb 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1cee53...0c795cf. Read the comment docs.

@carabasdaniel
Copy link
Contributor

Hi @Wiston999,

This PR looks awesome. Can you just add in one more small change to https://github.com/puppetlabs/puppetlabs-kubernetes/pull/412/files#diff-c02a38238e7c64b900f10d4e5ae14800R40 as etcd versions prior to 3.3.0 do not have the auto-compaction-mode parameter ?

Bumping the default etcd version of the module to 3.4.0 resulted in having all acceptance test green as you can see here:
image

Once you add a condition in the etcd template for the older versions of etcd we can get this merged.
Thanks.

…reater than 3.3.0. Adapt some specs to verify templates
@daianamezdrea
Copy link
Contributor

Hi @Wiston999, great job! Thank you for all your work!

@daianamezdrea daianamezdrea merged commit db64105 into puppetlabs:master May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants