-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump Kubecost to 1.106.0 and remove superfluous values Signed-off-by: chipzoller <[email protected]> * add health test Signed-off-by: chipzoller <[email protected]> * Update Signed-off-by: chipzoller <[email protected]> * rework Signed-off-by: chipzoller <[email protected]> * use dynamic svc get Signed-off-by: chipzoller <[email protected]> --------- Signed-off-by: chipzoller <[email protected]>
- Loading branch information
1 parent
1a9fb00
commit fa63dc4
Showing
2 changed files
with
64 additions
and
6 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
63 changes: 63 additions & 0 deletions
63
eks-anywhere-common/Testers/Kubecost/kubecost-testJob.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,63 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: kubecost-healthtest | ||
namespace: kubecost | ||
spec: | ||
schedule: "*/10 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: tester | ||
containers: | ||
- name: test-kubecost | ||
image: alpine/k8s:1.26.9 | ||
command: | ||
- /bin/sh | ||
args: | ||
- -c | ||
- >- | ||
svc=$(kubectl -n kubecost get svc -l app.kubernetes.io/name=cost-analyzer -o json | jq -r .items[0].metadata.name); | ||
echo Getting current Kubecost state.; | ||
response=$(curl -sL http://${svc}:9090/model/getConfigs); | ||
code=$(echo ${response} | jq .code); | ||
if [ "$code" -eq 200 ]; then | ||
echo "Got Kubecost working configuration. Successful." | ||
exit 0 | ||
else | ||
echo "Failed to fetch Kubecost configuration. Response was $response" | ||
exit 1 | ||
fi | ||
restartPolicy: Never | ||
backoffLimit: 1 | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: test-role | ||
namespace: kubecost | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["services"] | ||
verbs: ["list"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: test-rolebinding | ||
namespace: kubecost | ||
subjects: | ||
- kind: ServiceAccount | ||
name: tester | ||
namespace: kubecost | ||
roleRef: | ||
kind: Role | ||
name: test-role | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: tester | ||
namespace: kubecost |