Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added logic to verify the generated prometheus rule file #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ script:
done

- make all
- make generate_k8s
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give a name like kubernetes_object_yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ lint: prometheus_alert_rules.yaml

clean:
rm -rf prometheus_alert_rules.yaml

generate_k8s:
cd extras; cp manifests/prometheus-rules.yaml .; jb install; ./build.sh example.jsonnet; cd -
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of semicolon(;) it's better we use && syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand both have different purpose. With && if previous one is successful then only second would be executed. Anyway let me try that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think line 25 will always fail because jb install; will always clone the upstream. The genterated manifests/prometheus-rules.yaml from ./build.sh example.jsonnet; will always be made from the upstream cloned code. Because of this comparision will always fail.
I think before ./build.sh example.jsonnet; the following line should be added so that the cloned code gets the changes made in the pr : cp -R ./../alerts/* ./vendor/ceph-mixins/alerts/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes while verifying the changes I figured this out. Will test ad send the updated PR soon.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly: And this should copy all the files that the dev can change. Eg config files, alert rule files, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR we will take up later as there are other issues while copying the files under vendor directory like cyclic dependency.

cmp -s extras/prometheus-rules.yaml extras/manifests/prometheus-rules.yaml; \
RETVAL=$$?; \
if [ $$RETVAL -eq 0 ]; then \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "not equal to 0" ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a mistake. Will correct that.

echo "Rule files are different"; \
exit 1; \
fi