-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2522 from amazeeio/fix-long-autogen-host-backport
Limit the size of the CN field in certificate requests (backport)
- Loading branch information
Showing
21 changed files
with
192 additions
and
1 deletion.
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
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
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
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
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
43 changes: 43 additions & 0 deletions
43
tests/checks/check-auto-generated-ingress-short-router-url.yaml
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,43 @@ | ||
--- | ||
- name: > | ||
{{ testname }} - Check if auto-generated ingress of namespace | ||
{{ project }}-{{ lagoon_environment }} has the short-router-url in TLS hosts | ||
shell: | | ||
set -e | ||
set -x | ||
export KUBECONFIG=$(mktemp) | ||
echo "{{ kubeconfig }}" > $KUBECONFIG | ||
# replace with the IP of host from within container | ||
sed -i "s/localhost/$(ip -4 route list match 0/0 | cut -d' ' -f3)/" $KUBECONFIG | ||
INGRESS_JSON=$(kubectl -n {{ project }}-{{ lagoon_environment }} get ingress -o json) | ||
NUM_TLS_HOSTS=$(echo $INGRESS_JSON | jq -er '.items[] | select(.metadata.name == "node") | .spec.tls[0].hosts | length') | ||
if [ $NUM_TLS_HOSTS -lt 2 ]; then | ||
echo NUM_TLS_HOSTS: $NUM_TLS_HOSTS | ||
echo $INGRESS_JSON | ||
exit 1 | ||
fi | ||
FIRST_HOST_LEN=$(echo $INGRESS_JSON | jq -er '.items[] | select(.metadata.name == "node") | .spec.tls[0].hosts[0] | length') | ||
if [ $FIRST_HOST_LEN -gt 63 ]; then | ||
echo FIRST_HOST_LEN: $FIRST_HOST_LEN | ||
echo $INGRESS_JSON | ||
exit 1 | ||
fi | ||
SECOND_HOST_LEN=$(echo $INGRESS_JSON | jq -er '.items[] | select(.metadata.name == "node") | .spec.tls[0].hosts[1] | length') | ||
if [ $SECOND_HOST_LEN -lt 63 ]; then | ||
echo SECOND_HOST_LEN: $SECOND_HOST_LEN | ||
echo $INGRESS_JSON | ||
exit 1 | ||
fi | ||
register: result | ||
retries: 30 | ||
delay: 10 | ||
until: result.rc == 0 | ||
- name: > | ||
{{ testname }} - Check if {{ ingress }} ingress of namespace | ||
{{ project }}-{{ lagoon_environment }} has the short-router-url in TLS hosts | ||
debug: msg="Success!!!" |
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,48 @@ | ||
|
||
- name: "{{ testname }} - init git, add files, commit, git push" | ||
hosts: localhost | ||
serial: 1 | ||
vars: | ||
git_files: "features/" | ||
tasks: | ||
- include: ../../tasks/git-init.yaml | ||
- include: ../../tasks/git-add-commit-push.yaml | ||
|
||
- name: "{{ testname }} - api deployEnvironmentBranch on {{ project }}" | ||
hosts: localhost | ||
serial: 1 | ||
vars: | ||
branch: "{{ branch }}" | ||
project: "{{ project }}" | ||
tasks: | ||
- include: ../../tasks/api/deploy-no-sha.yaml | ||
|
||
- name: > | ||
{{ testname }} - check that the auto-generated ingress has the | ||
short-router-url | ||
hosts: localhost | ||
serial: 1 | ||
vars: | ||
branch: "{{ branch }}" | ||
project: "{{ project }}" | ||
lagoon_environment: "{{ lagoon_environment }}" | ||
tasks: | ||
- include: ../../checks/check-auto-generated-ingress-short-router-url.yaml | ||
|
||
- name: "{{ testname }} - api deleteEnvironment on {{ project }}, which should remove all resources" | ||
hosts: localhost | ||
serial: 1 | ||
vars: | ||
project: "{{ project }}" | ||
branch: "{{ branch }}" | ||
tasks: | ||
- include: ../../tasks/api/remove.yaml | ||
|
||
- name: "{{ testname }} - check if site for {{ project }} does not exist anymore" | ||
hosts: localhost | ||
serial: 1 | ||
vars: | ||
url: "{{ check_url }}" | ||
expected_returncode: "{{ lookup('env','DELETED_STATUS_CODE') }}" | ||
tasks: | ||
- include: ../../checks/check-url-returncode.yaml |