-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove login to AWS ECR for production & NUC installations (#1693)
* split retrieval of kubeconfig file from k3s installation * Disable aws ecr login for Production and NUC installs Production servers and NUCs use public images from public.ecr.aws/thecombine by default so no login is needed.
- Loading branch information
Showing
7 changed files
with
75 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
# Used to setup the certificate for kubectl | ||
# Can be overridden by specific groups/hosts | ||
k8s_dns_name: "{{ combine_server_name }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
- name: Get home directory for {{ k8s_user }} | ||
shell: > | ||
getent passwd {{ k8s_user }} | awk -F: '{ print $6 }' | ||
register: k8s_user_home | ||
changed_when: false | ||
|
||
- name: Save kubectl configuration on host | ||
fetch: | ||
src: "{{ k8s_user_home.stdout }}/.kube/config" | ||
dest: "{{ kubecfg }}" | ||
flat: yes | ||
|
||
- name: Restrict permissions to kubeconfig to owner | ||
delegate_to: localhost | ||
become: no | ||
file: | ||
path: "{{ kubecfg }}" | ||
state: file | ||
mode: 0600 | ||
|
||
# The kubeconfig file that is generated by k3s on the target | ||
# system identifies the server by the IP address. This updates | ||
# the file when it has been copied to the host to replace the | ||
# IP address with the server name. This is needed in the a | ||
# cloud environment where the IP address seen on the host is not | ||
# the public IP address. For example: | ||
# server: 10.0.0.40:6443 | ||
# is changed to: | ||
# server: nuc2:6443 | ||
# (kubectl communicates with the cluster over port 16443 or 6443) | ||
- name: Replace server IP with DNS name in site_files copy | ||
delegate_to: localhost | ||
become: no | ||
lineinfile: | ||
state: present | ||
path: "{{ kubecfg }}" | ||
regexp: '^(\s+server: https:\/\/)[.0-9]+:(1?6443)' | ||
backrefs: yes | ||
line: '\1{{ k8s_dns_name }}:\2' | ||
|
||
- name: Replace 'default' cluster, user, etc with {{ kubecfgdir }} | ||
delegate_to: localhost | ||
become: no | ||
replace: | ||
path: "{{ kubecfg }}" | ||
regexp: "^(.*)default(.*)$" | ||
replace: '\1{{ kubecfgdir }}\2' | ||
|
||
- name: Link ~/.kube/config to {{ kubecfg }} | ||
delegate_to: localhost | ||
become: no | ||
file: | ||
state: link | ||
src: "{{ kubecfg }}" | ||
dest: "{{ lookup('env', 'HOME') }}/.kube/config" | ||
mode: 0600 | ||
when: link_kubeconfig | default(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters