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

Combine deploy enhancements #1694

Merged
merged 10 commits into from
Jul 20, 2022
Merged

Combine deploy enhancements #1694

merged 10 commits into from
Jul 20, 2022

Conversation

jmgrady
Copy link
Collaborator

@jmgrady jmgrady commented Jul 19, 2022

This PR includes the following enhancements to the combine_deploy image that can be used to setup The Combine on a NUC:

  • Adds scripts to store/restore setup information to a volume when mounted as /config; the information saved is:

    • /etc/hosts
    • $HOME/.ssh
    • $HOME/.kube

    This obviates the need to re-run the setup_target.py script and the Ansible playbook each time the image is run.

  • Adds a check_cert.py to print the expiration time of any TLS certificates installed on the target.


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2022

Codecov Report

Merging #1694 (cf6c017) into master (e9e64f2) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1694   +/-   ##
=======================================
  Coverage   52.21%   52.21%           
=======================================
  Files         275      275           
  Lines        8498     8498           
  Branches      616      616           
=======================================
  Hits         4437     4437           
  Misses       3568     3568           
  Partials      493      493           
Flag Coverage Δ
backend 80.22% <ø> (ø)
frontend 32.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 e9e64f2...cf6c017. Read the comment docs.

Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 7 files at r1, all commit messages.
Reviewable status: 1 of 7 files reviewed, 5 unresolved discussions (waiting on @jmgrady)


deploy/Dockerfile line 39 at r1 (raw file):

# Copy configuration management scripts
COPY docker_home/* ${HOME}/

Extra newline after this one, but not between the others?


deploy/docker_home/.bashrc line 45 at r1 (raw file):

# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

Is the color_prompt stuff useful to keep around?


deploy/docker_home/restore_config.sh line 3 at r1 (raw file):

# restore /etc/hosts entries for combine targets
if [ -f "/config/hosts" ] ; then
    cp /config/hosts /etc/hosts

Is the /hosts necessary in /etc/hosts?


deploy/scripts/check_certs.py line 73 at r1 (raw file):

        ["kubectl"]
        + kubectl_opts
        + ["get", "secrets", "--field-selector", "type=kubernetes.io/tls", "-o", "name"]

If this array is short enough to fit on one line, might as well do the same for two shorter arrays earlier in the script.


deploy/scripts/setup_target.py line 71 at r1 (raw file):

def main() -> None:
    """Setup access to the the target specified on the command line."""

"the the"

Copy link
Collaborator Author

@jmgrady jmgrady left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 7 files reviewed, 5 unresolved discussions (waiting on @imnasnainaec and @jmgrady)


deploy/Dockerfile line 39 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

Extra newline after this one, but not between the others?

Added newlines after the others - made it more readable (at least to me).


deploy/docker_home/.bashrc line 45 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

Is the color_prompt stuff useful to keep around?

Yes, for 2 reasons:

  1. the intent was to use the default .bashrc and add the call to restore the configuration files; and
  2. this image is designed to be used in interactive mode and the color in the script output is very helpful.
    docker-screenshot.png

deploy/docker_home/restore_config.sh line 3 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

Is the /hosts necessary in /etc/hosts?

It is not necessary but both forms are correct; listing the file makes it clearer (in my mind) which file will be overwritten - helpful for an important system file.


deploy/scripts/check_certs.py line 73 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

If this array is short enough to fit on one line, might as well do the same for two shorter arrays earlier in the script.

That is all formatted by tox -e fmt. If we put it all on one line, the CI Python tests will fail.


deploy/scripts/setup_target.py line 71 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

"the the"

Duplicated for emphasis. (Not really!)
Fixed.

Add a short form output for check_certs.py so that the script
is more useful in command pipelines
Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 7 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jmgrady)

@jmgrady jmgrady merged commit ae4f5af into master Jul 20, 2022
@jmgrady jmgrady deleted the combine-deploy-enhancements branch July 20, 2022 15:18
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.

3 participants