UNCLASSIFIED - NO CUI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bigbang
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Big Bang
bigbang
Commits
d65fe81c
Commit
d65fe81c
authored
3 years ago
by
Micah Nagel
Committed by
Ryan Garcia
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add CoreDNS Patch for RKE2
parent
b161191f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!917
Add CoreDNS Patch for RKE2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+5
-0
5 additions, 0 deletions
.gitlab-ci.yml
tests/tests/03_helm_tests.sh
+38
-7
38 additions, 7 deletions
tests/tests/03_helm_tests.sh
with
43 additions
and
7 deletions
.gitlab-ci.yml
+
5
−
0
View file @
d65fe81c
...
...
@@ -326,6 +326,11 @@ aws/rke2/bigbang test:
-
unknown_failure
-
stuck_or_timeout_failure
-
runner_system_failure
artifacts
:
paths
:
-
"
test-artifacts/"
expire_in
:
3 days
when
:
always
# Uninstall BigBang on RKE2 cluster on AWS
aws/rke2/bigbang down
:
...
...
This diff is collapsed.
Click to expand it.
tests/tests/03_helm_tests.sh
+
38
−
7
View file @
d65fe81c
...
...
@@ -3,8 +3,19 @@
# exit on error
set
-e
# Get original CoreDNS config
kubectl get configmap
-n
kube-system coredns
-o
jsonpath
=
'{.data.NodeHosts}'
>
newhosts
# Check clusterType and get original CoreDNS config
clusterType
=
"unknown"
coreDnsName
=
"unknown"
touch
newhosts
if
kubectl get configmap
-n
kube-system coredns &>/dev/null
;
then
clusterType
=
"k3d"
coreDnsName
=
"coredns"
kubectl get configmap
-n
kube-system
${
coreDnsName
}
-o
jsonpath
=
'{.data.NodeHosts}'
>
newhosts
elif
kubectl get configmap
-n
kube-system rke2-coredns-rke2-coredns &>/dev/null
;
then
clusterType
=
"rke2"
coreDnsName
=
"rke2-coredns-rke2-coredns"
kubectl get configmap
-n
kube-system
${
coreDnsName
}
-o
jsonpath
=
'{.data.Corefile}'
>
newcorefile
fi
# Safeguard in case configmap doesn't end with newline
if
[[
$(
tail
-c
1 newhosts
)
!=
""
]]
;
then
...
...
@@ -18,7 +29,13 @@ for vs in $(kubectl get virtualservice -A -o go-template='{{range .items}}{{.met
hosts
=
$(
kubectl get virtualservice
${
vs_name
}
-n
${
vs_namespace
}
-o
go-template
=
'{{range .spec.hosts}}{{.}}{{" "}}{{end}}'
)
gateway
=
$(
kubectl get virtualservice
${
vs_name
}
-n
${
vs_namespace
}
-o
jsonpath
=
'{.spec.gateways[0]}'
|
awk
-F
/
'{print $2}'
)
ingress_gateway
=
$(
kubectl get gateway
-n
istio-system
$gateway
-o
jsonpath
=
'{.spec.selector.app}'
)
external_ip
=
$(
kubectl get svc
-n
istio-system
$ingress_gateway
-o
jsonpath
=
'{.status.loadBalancer.ingress[0].ip}'
)
external_ip
=
""
if
[[
${
clusterType
}
==
"k3d"
]]
;
then
external_ip
=
$(
kubectl get svc
-n
istio-system
$ingress_gateway
-o
jsonpath
=
'{.status.loadBalancer.ingress[0].ip}'
)
elif
[[
${
clusterType
}
==
"rke2"
]]
;
then
external_hostname
=
$(
kubectl get svc
-n
istio-system
$ingress_gateway
-o
jsonpath
=
'{.status.loadBalancer.ingress[0].hostname}'
)
external_ip
=
$(
dig +short
${
external_hostname
}
|
tail
-n1
)
fi
for
host
in
$hosts
;
do
host
=
$(
echo
${
host
}
| xargs
)
# Remove previous entry if on upgrade job
...
...
@@ -30,9 +47,23 @@ done
# Patch CoreDNS and restart pod
echo
"Setting up CoreDNS for VS resolution..."
hosts
=
$(
cat
newhosts
)
yq e
-n
'.data.NodeHosts = strenv(hosts)'
>
patch.yaml
kubectl patch configmap
-n
kube-system coredns
--patch
"
$(
cat
patch.yaml
)
"
kubectl rollout restart deployment
-n
kube-system coredns
kubectl rollout status deployment
-n
kube-system coredns
--timeout
=
30s
# For k3d
if
[[
${
clusterType
}
==
"k3d"
]]
;
then
kubectl patch configmap
-n
kube-system
${
coreDnsName
}
--patch
"
$(
cat
patch.yaml
)
"
kubectl rollout restart deployment
-n
kube-system
${
coreDnsName
}
kubectl rollout status deployment
-n
kube-system
${
coreDnsName
}
--timeout
=
30s
# For rke2
elif
[[
${
clusterType
}
==
"rke2"
]]
;
then
# Add an entry to the corefile
sed
-i
'/prometheus/i \ \ \ \ hosts /etc/coredns/NodeHosts {\n ttl 60\n reload 15s\n fallthrough\n }'
newcorefile
corefile
=
$(
cat
newcorefile
)
yq e
-i
'.data.Corefile = strenv(corefile)'
patch.yaml
kubectl patch configmap
-n
kube-system
${
coreDnsName
}
--patch
"
$(
cat
patch.yaml
)
"
kubectl patch deployment
${
coreDnsName
}
-n
kube-system
-p
'{"spec":{"template":{"spec":{"volumes":[{"name":"config-volume","configMap":{"items":[{"key":"Corefile","path":"Corefile"},{"key":"NodeHosts","path":"NodeHosts"}],"name":"'
${
coreDnsName
}
'"}}]}}}}'
kubectl rollout status deployment
-n
kube-system
${
coreDnsName
}
--timeout
=
30s
# Add other distros in future as needed, catchall so tests won't error on this
else
echo
"No known CoreDNS deployment found, skipping patching."
fi
# Gather all HRs we should test
installed_helmreleases
=
$(
helm list
-n
bigbang
-o
json | jq
'.[].name'
|
tr
-d
'"'
|
grep
-v
"bigbang"
)
...
...
@@ -102,4 +133,4 @@ if [ $ERRORS -gt 0 ]; then
exit
123
else
echo
"✅ All helm tests run successfully."
fi
\ No newline at end of file
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment