-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add makefile to vagrant to install collection, receiver-mock, grafana and supports avalanche #815
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
779def1
Add makefile to vagrant
8a4b06d
Install make in vagrant
8ea9828
vagrant: makefile: Rename provision to upgrade and support any location
80de716
vagrant: makefile: Add clean command to Makefile
225bf90
vagrant: makefile: Add expose-prometheus command
dcd10ac
vagrant: Preload dashboards in grafana
8501f4f
vagrant: Add metrics generator (avalanche)
50cb530
vagrant: Remove utils from dashboard
4d3c38d
vagrant: Add README for vagrant
7609b4d
vagrant: Update grafana dashboards
46d67f9
vagrant: Move configuration to values.yaml
7f10481
vagrant: Expose Makefile as sumologic in vagrant
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/usr/bin/make -f | ||
|
||
# mkfile_path is absolute path of this file | ||
# The intention is to be able to run this file from any location | ||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
# root_dir is a root directory of the project (github repo) | ||
root_dir := $(dir $(abspath $(mkfile_path)/..)) | ||
helm_path = ${root_dir}deploy/helm/sumologic | ||
k8s_path = ${root_dir}vagrant/k8s | ||
dashboards_path = ${root_dir}vagrant/dashboards | ||
|
||
# Collector configuration | ||
name = collection | ||
namespace = sumologic | ||
|
||
# Collector section | ||
## Collector upgrade | ||
upgrade: | ||
${mkfile_path} \ | ||
patch-context \ | ||
remove-tmp \ | ||
apply-namespace \ | ||
apply-receiver-mock \ | ||
create-secrets \ | ||
grafana-dashboards \ | ||
helm-dependencies \ | ||
helm-upgrade \ | ||
apply-service-monitors | ||
|
||
# Remove temporary charts | ||
remove-tmp: | ||
rm -rf ${helm_path}/tmpcharts | ||
|
||
apply-namespace: | ||
kubectl apply -f ${k8s_path}/sumologic.yaml | ||
|
||
apply-receiver-mock: | ||
kubectl apply -f ${k8s_path}/receiver-mock.yaml | ||
|
||
helm-dependencies: | ||
helm dependency update "${helm_path}" | ||
|
||
helm-upgrade: | ||
helm upgrade "${name}" "${helm_path}" \ | ||
--namespace "${namespace}" \ | ||
--install \ | ||
-f "${root_dir}vagrant/values.yaml" | ||
|
||
apply-service-monitors: | ||
kubectl apply -f ${k8s_path}/service-monitors.yaml | ||
|
||
apply-avalanche: | ||
kubectl apply -f ${k8s_path}/avalanche.yaml | ||
|
||
## Collector removing | ||
clean: | ||
${mkfile_path} \ | ||
remove-collector \ | ||
remove-service-monitors remove-receiver-mock remove-prometheus-crds remove-namespace | ||
|
||
remove-namespace: | ||
kubectl delete -f ${k8s_path}/sumologic.yaml --ignore-not-found=true | ||
|
||
remove-prometheus-crds: | ||
kubectl delete customresourcedefinitions.apiextensions.k8s.io --ignore-not-found=true \ | ||
{alertmanagers,podmonitors,prometheuses,prometheusrules,servicemonitors,thanosrulers}.monitoring.coreos.com | ||
|
||
remove-receiver-mock: | ||
kubectl delete -f ${k8s_path}/receiver-mock.yaml --ignore-not-found=true | ||
|
||
remove-collector: | ||
helm delete -n "${namespace}" "${name}" | ||
|
||
remove-service-monitors: | ||
kubectl delete -f ${k8s_path}/service-monitors.yaml --ignore-not-found=true | ||
|
||
## k8s commands | ||
expose-prometheus: | ||
kubectl port-forward -n "${namespace}" service/collection-prometheus-oper-prometheus --address=0.0.0.0 9090 | ||
|
||
expose-grafana: | ||
echo "Grafana credentials\n login: admin\n password: prom-operator" | ||
kubectl port-forward -n "${namespace}" service/collection-grafana --address=0.0.0.0 8080:80 | ||
|
||
# Load grafana dashboards as configmaps | ||
grafana-dashboards: | ||
kubectl delete configmap -n "${namespace}" sumologic-dashboards || true | ||
kubectl create configmap -n "${namespace}" sumologic-dashboards --from-file="${dashboards_path}" | ||
|
||
# Create secrets with microk8s certs | ||
create-secrets: | ||
kubectl delete secret -n "${namespace}" microk8s-certs || true | ||
kubectl create secret -n "${namespace}" generic microk8s-certs \ | ||
--from-file=/var/snap/microk8s/current/certs/server.key \ | ||
--from-file=/var/snap/microk8s/current/certs/server.crt \ | ||
--from-file=/var/snap/microk8s/current/certs/ca.crt | ||
|
||
# patch context to use sumologic namespace as default | ||
patch-context: | ||
kubectl config set-context --current --namespace "${namespace}" |
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,36 @@ | ||
# Vagrant | ||
|
||
Please install [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/). | ||
After that you can run the Vagrant environment with just one command: | ||
|
||
```bash | ||
vagrant up | ||
``` | ||
|
||
After successfull installation you can ssh to the virtual machine with: | ||
|
||
```bash | ||
vagrant ssh | ||
``` | ||
|
||
## Collector | ||
|
||
To install or upgrade collector please type: | ||
|
||
```bash | ||
/sumologic/vagrant/Makefile upgrade | ||
``` | ||
|
||
This command will prepare environment (namespaces, receiver-mock, etc.) | ||
and after that it will install/upgrade collector in the vagrant environment. | ||
|
||
To remove collector please use: | ||
|
||
```bash | ||
/sumologic/vagrant/Makefile clean | ||
``` | ||
|
||
List of other useful commands in the Makefile: | ||
- `expose-prometheus` - exposes prometheus on port 9090 of virtual machine | ||
- `expose-grafana` - exposes grafana on port 8080 of virtual machine | ||
- `apply-avalanche` - run one pod deployment of avalanche (metrics generator) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity why do we need this construct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted this Makefile to be executable, so need to get absolute path of the file and later abs path of the repository. I will add comments to clarify that