Skip to content

Commit

Permalink
remove
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghestrimtu committed Oct 6, 2021
1 parent 54070aa commit 90a8367
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 217 deletions.
31 changes: 19 additions & 12 deletions environment/environment_templates.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package environment

import (
"bufio"
"context"
"fmt"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"helm.sh/helm/v3/pkg/chartutil"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -214,21 +215,27 @@ func NewMockserverHelmChart() *HelmChart {
}

// NewPrometheusManifest creates new k8s manifest for prometheus
func NewPrometheusManifest() *K8sManifest {
rulesFilePath := filepath.Join(tools.ProjectRoot, "/environment/templates/prometheus/rules/ocr.rules.yml")
content, err := ioutil.ReadFile(rulesFilePath)
if err != nil {
return nil
func NewPrometheusManifest(rules map[string]*os.File) *K8sManifest {
vals := map[string]interface{}{}
for val, file := range rules {
scanner := bufio.NewScanner(file)
var txtlines []string
for scanner.Scan() {
txtlines = append(txtlines, scanner.Text())
}
for index, line := range txtlines {
txtlines[index] = fmt.Sprintf(" %s", line)
}
vals[val] = strings.Join(txtlines, "\n")
}

return &K8sManifest{
id: "prometheus",
DeploymentFile: filepath.Join(tools.ProjectRoot, "/environment/templates/prometheus/prometheus-deployment.yml"),
ServiceFile: filepath.Join(tools.ProjectRoot, "/environment/templates/prometheus/prometheus-service.yml"),
ConfigMapFile: filepath.Join(tools.ProjectRoot, "/environment/templates/prometheus/prometheus-config-map.yml"),

values: map[string]interface{}{
"ocrRulesYml": string(content),
},
values: vals,
}
}

Expand Down Expand Up @@ -546,14 +553,14 @@ func OtpeGroup() K8sEnvSpecInit {
}

// PrometheusGroup contains manifests for prometheus
func PrometheusGroup() K8sEnvSpecInit {
func PrometheusGroup(rules map[string]*os.File) K8sEnvSpecInit {
return func(config *config.NetworkConfig) (string, K8sEnvSpecs) {
var specs K8sEnvSpecs
prometheusDependencyGroup := &K8sManifestGroup{
id: "PrometheusDependencyGroup",
manifests: []K8sEnvResource{NewPrometheusManifest()},
manifests: []K8sEnvResource{NewPrometheusManifest(rules)},
}
specs = append(specs, prometheusDependencyGroup)
return "", specs
}
}
}
Loading

1 comment on commit 90a8367

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage for this commit

14.67%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
client
   basic_http_client.go10.61%100%100%10.61%100–110, 42–47, 55–67, 69–74, 76–96, 98–99
   chainlink_models.go0%100%100%0%240, 243–251, 260–262, 265–271, 279–281, 284–303, 312–314, 317–335, 346, 349–360, 378, 381–402, 412, 415–422, 439, 442–462, 489, 492–503, 505–559, 573, 576–589, 597, 600–607, 610–615, 618–623
   gas_stats.go0%100%100%0%34–40, 43–46, 49–53, 55–62, 65–70, 74–88
   chainlink.go66.19%100%100%66.19%100–104, 108–113, 148–153, 250–255, 258–263, 290–292, 299–300, 307–308, 311–317, 319–325, 327–328, 338–339, 349–351, 367–368, 379–380, 384–390, 392, 394, 396–402, 409–415, 428–429, 79–81, 94–99
   prometheus.go0%100%100%0%102–107, 111–116, 32–41, 44–47, 50–55, 59–70, 74–85, 89–98
   blockchain.go37.90%100%100%37.90%103–107, 113–117, 120–126, 131–133, 136–138, 141–143, 146–148, 151–153, 156–158, 161–163, 176–180, 199–201, 209–214, 220–221, 242–243, 251–253, 256–258, 265–266, 271–272, 284–285, 52–57, 59, 97–98
   ethereum.go0%100%100%0%100, 105–108, 112–116, 118, 122–125, 129–132, 136–142, 144, 164–166, 169–171, 174–176, 179–184, 188–190, 193–198, 202–207, 211–216, 228–232, 234–248, 252–261, 263–264, 268–272, 275–280, 284–286, 289–299, 301–302, 304–308, 313–315, 318–330, 334–336, 341–343, 350–364, 368–389, 391, 40, 401–409, 41, 410–414, 416–419, 42, 420–430, 434–440, 442–448, 45, 450, 458–459, 46, 460–469, 47, 470–476, 485–498, 50, 507–509, 51, 510–519, 52, 520–529, 53, 530–531, 535–539, 54, 540–545, 547, 55, 551–559, 563–567, 570–574, 576–583, 585, 587, 59, 590–599, 60, 600–607, 61, 612–619, 62, 620–624, 626–629, 63, 630–631, 633–635, 638–639, 64, 640–662, 665, 673–679, 68, 680–689, 69, 690–694, 70, 710–722, 726–729, 73, 730–739, 74, 740–748, 75, 752–759, 768–770, 773–775, 78–80, 83–85, 88–90, 93–95, 98–99
   mockserver.go0%100%100%0%20–25, 28–31, 34–37
   explorer.go0%100%100%0%15–20, 24–35
config
   config.go92.86%100%100%92.86%210–211
environment
   k8s_environment.go0%100%100%0%100, 1000–1001, 1003, 1007–1009, 101, 1010–1019, 102, 1020, 1023–1027, 103, 1031–1032, 1038–1039, 104, 1040–1049, 105, 1050–1054, 1057–1059, 106, 1060–1063, 1066, 1069, 107, 1070–1076, 108, 1080–1087, 1089, 109, 1099, 110, 1100–1104, 1106–1109, 111, 1110–1113, 1115, 1119, 112, 1120–1123, 1125, 1128–1129, 113, 1130–1132, 1135–1139, 114, 1141–1149, 115, 1150–1153, 1156–1158, 116, 1161–1169, 117, 1170–1178, 118, 1183, 119–122, 124–139, 143–164, 166–167, 171, 175–179, 183–192, 194–197, 199–202, 206–211, 216–222, 225–231, 233–240, 245–250, 254–258, 262–266, 271–275, 278–280, 284–290, 293–300, 302–304, 307, 311–338, 342–347, 351–356, 358–362, 364–372, 374–379, 381, 384–400, 402, 405–421, 465–468, 472–474, 477–479, 482–484, 487–500, 505–525, 529–531, 533–535, 537–548, 551–554, 558–572, 574, 578–586, 588–593, 596–599, 601–618, 620–629, 633–635, 638–642, 645–650, 652–664, 666, 671–684, 686–698, 700, 703–708, 710–722, 724, 727–740, 742, 749–754, 756, 763–772, 774, 781–790, 792, 799–808, 810, 817–824, 826–838, 840–844, 848–855, 867–874, 877–884, 887–890, 892–896, 898–912, 915–919, 921–934, 936–938, 940–949, 95, 952–959, 96, 960, 963–965, 97–98, 983–985, 988–989, 99, 992–994, 997–999
   environment.go5.93%100%100%5.93%101, 120–122, 125–127, 130–139, 142–155, 160–168, 174–184, 186, 191–213, 221–226, 43–49, 52–57, 61–66, 70–78, 82–99
   k8s_helm_resource.go0%100%100%0%100–111, 113, 117–128, 130, 133–135, 138–153, 156, 160–165, 167–170, 172–186, 188–203, 55–64, 68–70, 73–75, 78–80, 83–85, 88–91, 93–99
   environment_templates.go33.49%100%100%33.49%100, 105–124, 130–145, 147–154, 156–167, 169–170, 176–188, 209–212, 218–229, 232–239, 243–262, 267–285, 319–338, 340–350, 367–371, 381–382, 404–418, 420–421, 427–432, 434–442, 445–447, 449, 46, 462–463, 47, 478–479, 48, 480–483, 486–488, 49, 498–499, 50, 500–509, 51, 510–517, 519, 52, 520–521, 523–527, 53–54, 541–549, 55, 550–552, 556–559, 56, 560–565, 93–99

Please sign in to comment.