Skip to content

Commit

Permalink
bump Kubecost to 1.106.0 (#140)
Browse files Browse the repository at this point in the history
* 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
chipzoller authored Sep 22, 2023
1 parent 1a9fb00 commit fa63dc4
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 deletions.
7 changes: 1 addition & 6 deletions eks-anywhere-common/Addons/Partner/Kubecost/kubecost.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@ spec:
kind: HelmRepository
name: kubecost-charts
namespace: flux-system
version: 1.92.0
version: 1.106.0
interval: 1m0s
targetNamespace: kubecost
values:
global:
thanos:
enabled: false
valuesFrom:
- kind: Secret
name: kubecost-secret
valuesKey: kubecost-token
targetPath: kubecostToken

63 changes: 63 additions & 0 deletions eks-anywhere-common/Testers/Kubecost/kubecost-testJob.yaml
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

0 comments on commit fa63dc4

Please sign in to comment.