Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nobl9/nobl9-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.83.0-rc3
Choose a base ref
...
head repository: nobl9/nobl9-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.83.0-rc4
Choose a head ref
  • 7 commits
  • 176 files changed
  • 3 contributors

Commits on Jul 8, 2024

  1. feat: Define manifest objects examples in code (#477)

    ## Motivation
    
    We're currently lacking in examples for our `v1alpha` objects.
    This PR covers that hole by adding utilities for generating these
    examples and verifying them.
    
    ## Release Notes
    
    Added extended examples to the `v1alpha` objects with different
    configuration variants.
    nieomylnieja authored Jul 8, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9732f54 View commit details
  2. chore: Add Alert Method e2e tests (#481)

    Extends end-to-end tests with `v1alpha.AlertMethod` coverage.
    
    It utilizes generated examples to easily test application of different
    Alert Method variants.
    nieomylnieja authored Jul 8, 2024
    Copy the full SHA
    75d8472 View commit details
  3. chore: Update module github.com/aws/aws-sdk-go to v1.54.16 (#487)

    [![Mend
    Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
    
    This PR contains the following updates:
    
    | Package | Change | Age | Adoption | Passing | Confidence |
    |---|---|---|---|---|---|
    | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) |
    `v1.54.15` -> `v1.54.16` |
    [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.16?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.16?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.15/v1.54.16?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.15/v1.54.16?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>aws/aws-sdk-go (github.com/aws/aws-sdk-go)</summary>
    
    ###
    [`v1.54.16`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v15416-2024-07-08)
    
    [Compare
    Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.15...v1.54.16)
    
    \===
    
    ##### Service Client Updates
    
    -   `service/codedeploy`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/devicefarm`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/dms`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/elasticbeanstalk`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/email`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/es`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/firehose`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    -   `service/gamelift`: Updates service API
        -   Add v2 smoke tests and smithy smokeTests trait for SDK testing.
    - `service/qapps`: Updates service API, documentation, waiters,
    paginators, and examples
    -   `service/route53resolver`: Updates service API
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am
    every weekday,every weekend" (UTC), Automerge - At any time (no schedule
    defined).
    
    🚦 **Automerge**: Enabled.
    
    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
    rebase/retry checkbox.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about this update
    again.
    
    ---
    
    - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
    this box
    
    ---
    
    This PR has been generated by [Mend
    Renovate](https://www.mend.io/free-developer-tools/renovate/). View
    repository job log
    [here](https://developer.mend.io/github/nobl9/nobl9-go).
    
    <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJnb2xhbmciLCJyZW5vdmF0ZSJdfQ==-->
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jul 8, 2024
    Copy the full SHA
    1a0e281 View commit details

Commits on Jul 9, 2024

  1. chore: Add v1alpha RoleBinding e2e tests (#486)

    ## Motivation
    
    Extends e2e tests coverage for `v1alpha` `RoleBinding`.
    nieomylnieja authored Jul 9, 2024
    Copy the full SHA
    8338531 View commit details
  2. chore: Add Alert Method e2e tests (#488)

    Adds v1alpha `AlertMethod` e2e test cases.
    nieomylnieja authored Jul 9, 2024
    Copy the full SHA
    8794a87 View commit details
  3. chore: Update module github.com/aws/aws-sdk-go to v1.54.17 (#489)

    [![Mend
    Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
    
    This PR contains the following updates:
    
    | Package | Change | Age | Adoption | Passing | Confidence |
    |---|---|---|---|---|---|
    | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) |
    `v1.54.16` -> `v1.54.17` |
    [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.17?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.17?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.16/v1.54.17?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.16/v1.54.17?slim=true)](https://docs.renovatebot.com/merge-confidence/)
    |
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>aws/aws-sdk-go (github.com/aws/aws-sdk-go)</summary>
    
    ###
    [`v1.54.17`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v15417-2024-07-09)
    
    [Compare
    Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.16...v1.54.17)
    
    \===
    
    ##### Service Client Updates
    
    -   `service/datazone`: Updates service API
    -   `service/fsx`: Updates service API and documentation
    -   `service/opensearch`: Updates service API and documentation
    - `service/sagemaker`: Updates service API, documentation, and
    paginators
    - This release 1/ enables optimization jobs that allows customers to
    perform Ahead-of-time compilation and quantization. 2/ allows customers
    to control access to Amazon Q integration in SageMaker Studio. 3/
    enables AdditionalModelDataSources for CreateModel action.
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am
    every weekday,every weekend" (UTC), Automerge - At any time (no schedule
    defined).
    
    🚦 **Automerge**: Enabled.
    
    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
    rebase/retry checkbox.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about this update
    again.
    
    ---
    
    - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
    this box
    
    ---
    
    This PR has been generated by [Mend
    Renovate](https://www.mend.io/free-developer-tools/renovate/). View
    repository job log
    [here](https://developer.mend.io/github/nobl9/nobl9-go).
    
    <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJnb2xhbmciLCJyZW5vdmF0ZSJdfQ==-->
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jul 9, 2024
    Copy the full SHA
    1a7c326 View commit details

Commits on Jul 11, 2024

  1. feat: PC-13045 Good total single query experimental support (#458)

    ## Motivation
    
    Enabling support for gathering godd and total points using single query.
    Currently for Splunk only.
    
    Sample YAML:
    ```
    ---
    apiVersion: n9/v1alpha
    kind: SLO
    metadata:
      name: splunk-counts-calendar
      project: splunk
    spec:
      service: splunk-service
      indicator:
        metricSource:
          kind: Agent
          name: splunk
          project: splunk
      timeWindows:
        - unit: Day
          count: 1
          calendar:
            startTime: 2021-04-09 00:00:00
            timeZone: Europe/Warsaw
      budgetingMethod: Occurrences
      objectives:
        - displayName: So so
          target: 0.80
          name: objective-1
          countMetrics:
            incremental: false
            goodTotal:
              splunk:
                query:  |-
                  | mstats avg("spl.intr.resource_usage.IOWait.data.avg_cpu_pct") as n9good WHERE index="_metrics" span=15s 
                  | join type=left _time [
                  | mstats avg("spl.intr.resource_usage.IOWait.data.max_cpus_pct") as n9total WHERE index="_metrics" span=15s
                  ]
                  | rename _time as n9time
                  | fields n9time n9good n9total
    ```
    
    ## Summary
    
    Added new `goodTotal` field to count metrics spec
    Added validation for splunk query with new field names `n9time`,
    `n9good`, `n9total`
    
    ## Testing
    
    - Unit tests
    - Manual planned tests after sloctl and platform changes
    
    No release notes, as this is in experimental stage.
    marcinlawnik authored Jul 11, 2024
    Copy the full SHA
    77ff3d4 View commit details
Showing with 29,668 additions and 318 deletions.
  1. +7 −2 Makefile
  2. +11 −0 cspell.yaml
  3. +2 −1 go.mod
  4. +4 −2 go.sum
  5. +2 −2 internal/cmd/docgen/go_doc.go
  6. +2 −2 internal/cmd/docgen/object_doc.go
  7. +152 −0 internal/cmd/examplegen/main.go
  8. +2 −2 internal/manifest/objects_test.go
  9. +169 −0 internal/manifest/v1alpha/examples/agent.go
  10. +19 −0 internal/manifest/v1alpha/examples/agent_test.go
  11. +197 −0 internal/manifest/v1alpha/examples/alert_method.go
  12. +19 −0 internal/manifest/v1alpha/examples/alert_method_test.go
  13. +312 −0 internal/manifest/v1alpha/examples/alert_policy.go
  14. +94 −0 internal/manifest/v1alpha/examples/alert_silence.go
  15. +41 −0 internal/manifest/v1alpha/examples/annotation.go
  16. +42 −0 internal/manifest/v1alpha/examples/budget_adjustment.go
  17. +45 −0 internal/manifest/v1alpha/examples/data_export.go
  18. +190 −0 internal/manifest/v1alpha/examples/direct.go
  19. +23 −0 internal/manifest/v1alpha/examples/direct_test.go
  20. +41 −0 internal/manifest/v1alpha/examples/example.go
  21. +18 −0 internal/manifest/v1alpha/examples/labels.go
  22. +18 −0 internal/manifest/v1alpha/examples/metadata_annotations.go
  23. +20 −0 internal/manifest/v1alpha/examples/project.go
  24. +7 −0 internal/manifest/v1alpha/examples/queries/cloudwatch_count_bad.json
  25. +7 −0 internal/manifest/v1alpha/examples/queries/cloudwatch_count_good.json
  26. +7 −0 internal/manifest/v1alpha/examples/queries/cloudwatch_count_total.json
  27. +43 −0 internal/manifest/v1alpha/examples/queries/cloudwatch_threshold.json
  28. +50 −0 internal/manifest/v1alpha/examples/queries/elasticsearch_count_good.json
  29. +44 −0 internal/manifest/v1alpha/examples/queries/elasticsearch_count_total.json
  30. +49 −0 internal/manifest/v1alpha/examples/queries/elasticsearch_threshold.json
  31. +34 −0 internal/manifest/v1alpha/examples/queries/instana_application_query.json
  32. +62 −0 internal/manifest/v1alpha/examples/role_binding.go
  33. +21 −0 internal/manifest/v1alpha/examples/service.go
  34. +197 −0 internal/manifest/v1alpha/examples/slo.go
  35. +19 −0 internal/manifest/v1alpha/examples/slo_test.go
  36. +1,112 −0 internal/manifest/v1alpha/examples/slo_variants.go
  37. +52 −0 internal/manifest/v1alpha/examples/utils.go
  38. +135 −0 internal/manifest/v1alpha/examples/validation_test.go
  39. +2 −1 internal/manifest/v1alphatest/labels_validation.go
  40. +2 −1 internal/manifest/v1alphatest/metadata_annotations_validation.go
  41. +1 −1 internal/{testutils/path.go → pathutils/root_path.go}
  42. +1 −2 manifest/object.go
  43. +0 −10 manifest/v1alpha/agent/example.yaml
  44. +23 −0 manifest/v1alpha/agent/examples/amazon-prometheus.yaml
  45. +22 −0 manifest/v1alpha/agent/examples/app-dynamics.yaml
  46. +22 −0 manifest/v1alpha/agent/examples/azure-monitor.yaml
  47. +23 −0 manifest/v1alpha/agent/examples/azure-prometheus.yaml
  48. +14 −0 manifest/v1alpha/agent/examples/big-query.yaml
  49. +21 −0 manifest/v1alpha/agent/examples/cloud-watch.yaml
  50. +22 −0 manifest/v1alpha/agent/examples/datadog.yaml
  51. +22 −0 manifest/v1alpha/agent/examples/dynatrace.yaml
  52. +15 −0 manifest/v1alpha/agent/examples/elasticsearch.yaml
  53. +14 −0 manifest/v1alpha/agent/examples/generic.yaml
  54. +21 −0 manifest/v1alpha/agent/examples/google-cloud-monitoring.yaml
  55. +15 −0 manifest/v1alpha/agent/examples/grafana-loki.yaml
  56. +22 −0 manifest/v1alpha/agent/examples/graphite.yaml
  57. +21 −0 manifest/v1alpha/agent/examples/honeycomb.yaml
  58. +15 −0 manifest/v1alpha/agent/examples/influx-d-b.yaml
  59. +15 −0 manifest/v1alpha/agent/examples/instana.yaml
  60. +24 −0 manifest/v1alpha/agent/examples/lightstep.yaml
  61. +15 −0 manifest/v1alpha/agent/examples/logic-monitor.yaml
  62. +22 −0 manifest/v1alpha/agent/examples/new-relic.yaml
  63. +15 −0 manifest/v1alpha/agent/examples/open-t-s-d-b.yaml
  64. +14 −0 manifest/v1alpha/agent/examples/pingdom.yaml
  65. +22 −0 manifest/v1alpha/agent/examples/prometheus.yaml
  66. +14 −0 manifest/v1alpha/agent/examples/redshift.yaml
  67. +15 −0 manifest/v1alpha/agent/examples/splunk-observability.yaml
  68. +22 −0 manifest/v1alpha/agent/examples/splunk.yaml
  69. +15 −0 manifest/v1alpha/agent/examples/sumo-logic.yaml
  70. +14 −0 manifest/v1alpha/agent/examples/thousand-eyes.yaml
  71. 0 manifest/v1alpha/alert/{example.yaml → examples.yaml}
  72. +0 −10 manifest/v1alpha/alertmethod/example.yaml
  73. +10 −0 manifest/v1alpha/alertmethod/examples/discord.yaml
  74. +17 −0 manifest/v1alpha/alertmethod/examples/email.yaml
  75. +13 −0 manifest/v1alpha/alertmethod/examples/jira.yaml
  76. +11 −0 manifest/v1alpha/alertmethod/examples/opsgenie.yaml
  77. +12 −0 manifest/v1alpha/alertmethod/examples/pagerduty.yaml
  78. +12 −0 manifest/v1alpha/alertmethod/examples/servicenow.yaml
  79. +10 −0 manifest/v1alpha/alertmethod/examples/slack.yaml
  80. +10 −0 manifest/v1alpha/alertmethod/examples/teams.yaml
  81. +65 −0 manifest/v1alpha/alertmethod/examples/webhook.yaml
  82. +0 −20 manifest/v1alpha/alertpolicy/example.yaml
  83. +36 −0 manifest/v1alpha/alertpolicy/examples/budget-almost-exhausted.yaml
  84. +76 −0 manifest/v1alpha/alertpolicy/examples/budget-drop.yaml
  85. +37 −0 manifest/v1alpha/alertpolicy/examples/fast-burn.yaml
  86. +84 −0 manifest/v1alpha/alertpolicy/examples/fast-exhaustion.yaml
  87. +84 −0 manifest/v1alpha/alertpolicy/examples/slow-burn.yaml
  88. +92 −0 manifest/v1alpha/alertpolicy/examples/slow-exhaustion.yaml
  89. +0 −12 manifest/v1alpha/alertsilence/example.yaml
  90. +58 −0 manifest/v1alpha/alertsilence/examples.yaml
  91. +0 −11 manifest/v1alpha/annotation/example.yaml
  92. +21 −0 manifest/v1alpha/annotation/examples.yaml
  93. +3 −5 manifest/v1alpha/annotation/validation.go
  94. +0 −14 manifest/v1alpha/budgetadjustment/example.yaml
  95. +18 −0 manifest/v1alpha/budgetadjustment/examples.yaml
  96. +3 −3 manifest/v1alpha/data_sources.go
  97. +0 −11 manifest/v1alpha/dataexport/example.yaml
  98. +25 −0 manifest/v1alpha/dataexport/examples.yaml
  99. +0 −12 manifest/v1alpha/direct/example.yaml
  100. +26 −0 manifest/v1alpha/direct/examples/app-dynamics.yaml
  101. +24 −0 manifest/v1alpha/direct/examples/azure-monitor.yaml
  102. +15 −0 manifest/v1alpha/direct/examples/big-query.yaml
  103. +22 −0 manifest/v1alpha/direct/examples/cloud-watch.yaml
  104. +24 −0 manifest/v1alpha/direct/examples/datadog.yaml
  105. +23 −0 manifest/v1alpha/direct/examples/dynatrace.yaml
  106. +22 −0 manifest/v1alpha/direct/examples/google-cloud-monitoring.yaml
  107. +22 −0 manifest/v1alpha/direct/examples/honeycomb.yaml
  108. +17 −0 manifest/v1alpha/direct/examples/influx-d-b.yaml
  109. +16 −0 manifest/v1alpha/direct/examples/instana.yaml
  110. +25 −0 manifest/v1alpha/direct/examples/lightstep.yaml
  111. +17 −0 manifest/v1alpha/direct/examples/logic-monitor.yaml
  112. +23 −0 manifest/v1alpha/direct/examples/new-relic.yaml
  113. +15 −0 manifest/v1alpha/direct/examples/pingdom.yaml
  114. +18 −0 manifest/v1alpha/direct/examples/redshift.yaml
  115. +16 −0 manifest/v1alpha/direct/examples/splunk-observability.yaml
  116. +23 −0 manifest/v1alpha/direct/examples/splunk.yaml
  117. +17 −0 manifest/v1alpha/direct/examples/sumo-logic.yaml
  118. +15 −0 manifest/v1alpha/direct/examples/thousand-eyes.yaml
  119. +17 −17 manifest/v1alpha/direct/validation.go
  120. +2 −2 manifest/v1alpha/labels.go
  121. +10 −10 manifest/v1alpha/labels_examples.yaml
  122. +2 −2 manifest/v1alpha/metadata_annotations.go
  123. +2 −2 manifest/v1alpha/metadata_annotations_examples.yaml
  124. +0 −10 manifest/v1alpha/project/example.yaml
  125. +24 −0 manifest/v1alpha/project/examples.yaml
  126. +0 −8 manifest/v1alpha/rolebinding/example.yaml
  127. +34 −0 manifest/v1alpha/rolebinding/examples.yaml
  128. +0 −11 manifest/v1alpha/service/example.yaml
  129. +25 −0 manifest/v1alpha/service/examples.yaml
  130. +0 −39 manifest/v1alpha/slo/example.yaml
  131. +516 −0 manifest/v1alpha/slo/examples/amazon-prometheus.yaml
  132. +800 −0 manifest/v1alpha/slo/examples/app-dynamics.yaml
  133. +1,836 −0 manifest/v1alpha/slo/examples/azure-monitor.yaml
  134. +792 −0 manifest/v1alpha/slo/examples/azure-prometheus.yaml
  135. +540 −0 manifest/v1alpha/slo/examples/big-query.yaml
  136. +2,840 −0 manifest/v1alpha/slo/examples/cloud-watch.yaml
  137. +516 −0 manifest/v1alpha/slo/examples/datadog.yaml
  138. +516 −0 manifest/v1alpha/slo/examples/dynatrace.yaml
  139. +1,100 −0 manifest/v1alpha/slo/examples/elasticsearch.yaml
  140. +516 −0 manifest/v1alpha/slo/examples/generic.yaml
  141. +624 −0 manifest/v1alpha/slo/examples/google-cloud-monitoring.yaml
  142. +516 −0 manifest/v1alpha/slo/examples/grafana-loki.yaml
  143. +516 −0 manifest/v1alpha/slo/examples/graphite.yaml
  144. +800 −0 manifest/v1alpha/slo/examples/honeycomb.yaml
  145. +576 −0 manifest/v1alpha/slo/examples/influx-d-b.yaml
  146. +1,588 −0 manifest/v1alpha/slo/examples/instana.yaml
  147. +1,336 −0 manifest/v1alpha/slo/examples/lightstep.yaml
  148. +840 −0 manifest/v1alpha/slo/examples/logic-monitor.yaml
  149. +516 −0 manifest/v1alpha/slo/examples/new-relic.yaml
  150. +516 −0 manifest/v1alpha/slo/examples/open-t-s-d-b.yaml
  151. +824 −0 manifest/v1alpha/slo/examples/pingdom.yaml
  152. +516 −0 manifest/v1alpha/slo/examples/prometheus.yaml
  153. +552 −0 manifest/v1alpha/slo/examples/redshift.yaml
  154. +516 −0 manifest/v1alpha/slo/examples/splunk-observability.yaml
  155. +516 −0 manifest/v1alpha/slo/examples/splunk.yaml
  156. +1,172 −0 manifest/v1alpha/slo/examples/sumo-logic.yaml
  157. +1,820 −0 manifest/v1alpha/slo/examples/thousand-eyes.yaml
  158. +10 −1 manifest/v1alpha/slo/metrics.go
  159. +12 −0 manifest/v1alpha/slo/metrics_bigquery_test.go
  160. +33 −0 manifest/v1alpha/slo/metrics_splunk.go
  161. +113 −0 manifest/v1alpha/slo/metrics_splunk_test.go
  162. +28 −0 manifest/v1alpha/slo/metrics_test.go
  163. +38 −7 manifest/v1alpha/slo/metrics_validation.go
  164. +76 −0 manifest/v1alpha/slo/metrics_validation_test.go
  165. +9 −4 manifest/v1alpha/slo/slo.go
  166. +21 −21 manifest/v1alpha/slo/validation.go
  167. +56 −0 manifest/v1alpha/slo/validation_test.go
  168. 0 manifest/v1alpha/usergroup/{example.yaml → examples.yaml}
  169. +8 −0 manifest/version.go
  170. +76 −0 tests/examples_test.go
  171. +27 −16 tests/helpers_test.go
  172. +130 −0 tests/v1alpha_alertmethod_test.go
  173. +150 −0 tests/v1alpha_alertpolicy_test.go
  174. +27 −20 tests/v1alpha_project_test.go
  175. +134 −0 tests/v1alpha_rolebinding_test.go
  176. +37 −24 tests/v1alpha_service_test.go
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -107,9 +107,9 @@ check/format:
$(call _print_check_step,Checking if files are formatted)
./scripts/check-formatting.sh

.PHONY: generate generate/code generate/diagrams
.PHONY: generate generate/code generate/examples generate/plantuml
## Auto generate files.
generate: generate/code generate/plantuml
generate: generate/code generate/examples generate/plantuml

## Generate Golang code.
generate/code:
@@ -119,6 +119,11 @@ generate/code:
go generate ./... ./docs/mock_example
${MAKE} format/go

## Generate examples from code.
generate/examples:
echo "Generating examples..."
go run internal/cmd/examplegen/main.go

PLANTUML_JAR_URL := https://sourceforge.net/projects/plantuml/files/plantuml.jar/download
PLANTUML_JAR := $(BIN_DIR)/plantuml.jar
DIAGRAMS_PATH ?= .
11 changes: 11 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ ignoreRegExpList:
- /nolint.*/g
- /nosec.*/g
- /(errors|fmt|assert|require)\.[^\(]+/g
- /access(key)?id.*/ig
ignorePaths:
- sdk/test_data
- .golangci.yml
@@ -30,7 +31,13 @@ ignorePaths:
- "**/test_data/**"
- "docs/mock_example/mocks/*"
words:
- 00u2y4e4atkzaYkXP4x8
- CONNECTIONFAILURES
- CONNECTIONSESTABLISHED
- CONNECTIONSUCCESSES
- DzpxcSRh
- MAXRTT
- TIMEMAX
- aggs
- alertmethod
- alertpolicy
@@ -61,6 +68,7 @@ words:
- dynatrace
- endef
- enduml
- examplegen
- fatalf
- gobin
- gofile
@@ -72,6 +80,7 @@ words:
- goreleaser
- gosec
- govulncheck
- group-Q72HorLyjjCc
- groupmy
- hrdu
- httpurls
@@ -91,6 +100,7 @@ words:
- mockgen
- mprofile
- msgf
- mstats
- msteams
- ningxia
- nobl
@@ -103,6 +113,7 @@ words:
- opentsdb
- opsgenie
- pagerduty
- pathutils
- plantuml
- preconfigured
- promql
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -6,8 +6,9 @@ require (
github.com/BurntSushi/toml v1.4.0
github.com/MicahParks/jwkset v0.5.18
github.com/MicahParks/keyfunc/v3 v3.3.3
github.com/aws/aws-sdk-go v1.54.15
github.com/aws/aws-sdk-go v1.54.17
github.com/bmatcuk/doublestar/v4 v4.6.1
github.com/goccy/go-yaml v1.11.3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/nobl9/go-yaml v1.0.1
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ github.com/MicahParks/jwkset v0.5.18 h1:WLdyMngF7rCrnstQxA7mpRoxeaWqGzPM/0z40PJU
github.com/MicahParks/jwkset v0.5.18/go.mod h1:q8ptTGn/Z9c4MwbcfeCDssADeVQb3Pk7PnVxrvi+2QY=
github.com/MicahParks/keyfunc/v3 v3.3.3 h1:c6j9oSu1YUo0k//KwF1miIQlEMtqNlj7XBFLB8jtEmY=
github.com/MicahParks/keyfunc/v3 v3.3.3/go.mod h1:f/UMyXdKfkZzmBeBFUeYk+zu066J1Fcl48f7Wnl5Z48=
github.com/aws/aws-sdk-go v1.54.15 h1:ErgCEVbzuSfuZl9nR+g8FFnzjgeJ/AqAGOEWn6tgAHo=
github.com/aws/aws-sdk-go v1.54.15/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go v1.54.17 h1:ZV/qwcCIhMHgsJ6iXXPVYI0s1MdLT+5LW28ClzCUPeI=
github.com/aws/aws-sdk-go v1.54.17/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -19,6 +19,8 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/goccy/go-yaml v1.11.3 h1:B3W9IdWbvrUu2OYQGwvU1nZtvMQJPBKgBUuweJjLj6I=
github.com/goccy/go-yaml v1.11.3/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
4 changes: 2 additions & 2 deletions internal/cmd/docgen/go_doc.go
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ import (

"golang.org/x/exp/maps"

"github.com/nobl9/nobl9-go/internal/testutils"
"github.com/nobl9/nobl9-go/internal/pathutils"
)

const moduleRootPath = "github.com/nobl9/nobl9-go"
@@ -32,7 +32,7 @@ func (t goTypeDoc) PkgPath() string {
}

func parseGoDocs() map[string]goTypeDoc {
root := testutils.FindModuleRoot()
root := pathutils.FindModuleRoot()
objectsDirectory := filepath.Join(root, "manifest")
directories, err := listDirectories(objectsDirectory)
if err != nil {
4 changes: 2 additions & 2 deletions internal/cmd/docgen/object_doc.go
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import (
"reflect"
"strings"

"github.com/nobl9/nobl9-go/internal/testutils"
"github.com/nobl9/nobl9-go/internal/pathutils"
"github.com/nobl9/nobl9-go/manifest"
)

@@ -27,7 +27,7 @@ func generateObjectDocs(objectNames []string) []*ObjectDoc {
}
}

rootPath := testutils.FindModuleRoot()
rootPath := pathutils.FindModuleRoot()
// Generate object properties based on reflection.
for _, object := range objects {
mapper := newObjectMapper()
152 changes: 152 additions & 0 deletions internal/cmd/examplegen/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package main

import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"

"github.com/goccy/go-yaml"

v1alphaExamples "github.com/nobl9/nobl9-go/internal/manifest/v1alpha/examples"
"github.com/nobl9/nobl9-go/internal/pathutils"
"github.com/nobl9/nobl9-go/manifest"
"github.com/nobl9/nobl9-go/sdk"
)

type examplesGeneratorConfig struct {
Examples []v1alphaExamples.Example
Path string
Comments yaml.CommentMap
}

const manifestPath = "manifest"

func main() {
rootPath := pathutils.FindModuleRoot()
configs := getV1alphaExamplesConfigs()
for _, config := range configs {
examples := make([]any, 0, len(config.Examples))
for _, variant := range config.Examples {
examples = append(examples, variant.GetObject())
}
config.Path = filepath.Join(rootPath, config.Path)
var input any
if len(examples) == 1 {
input = examples[0]
} else {
input = examples
}
if err := writeExamples(input, config.Path, config.Comments); err != nil {
panic(err.Error())
}
}
}

func getV1alphaExamplesConfigs() []examplesGeneratorConfig {
basePath := filepath.Join(manifestPath, "v1alpha")
// Non-standard examples.
configs := []examplesGeneratorConfig{
{
Examples: v1alphaExamples.Labels(),
Path: filepath.Join(basePath, "labels_examples.yaml"),
},
{
Examples: v1alphaExamples.MetadataAnnotations(),
Path: filepath.Join(basePath, "metadata_annotations_examples.yaml"),
},
}
// Standard examples.
allExamples := [][]v1alphaExamples.Example{
v1alphaExamples.Project(),
v1alphaExamples.Service(),
v1alphaExamples.AlertMethod(),
v1alphaExamples.SLO(),
v1alphaExamples.Agent(),
v1alphaExamples.Direct(),
v1alphaExamples.AlertPolicy(),
v1alphaExamples.AlertSilence(),
v1alphaExamples.Annotation(),
v1alphaExamples.BudgetAdjustment(),
v1alphaExamples.DataExport(),
v1alphaExamples.RoleBinding(),
}
for _, examples := range allExamples {
object := examples[0].GetObject().(manifest.Object)
basePath := filepath.Join(
manifestPath,
object.GetVersion().VersionString(),
object.GetKind().ToLower(),
)
grouped := groupBy(examples, func(e v1alphaExamples.Example) string { return e.GetVariant() })
for variant, examples := range grouped {
var path string
if len(grouped) == 1 {
// If we don't have any variants, we can write all examples into examples.yaml file.
path = filepath.Join(basePath, "examples.yaml")
} else {
path = filepath.Join(basePath, "examples", strings.ReplaceAll(strings.ToLower(variant), " ", "-")+".yaml")
}
config := examplesGeneratorConfig{
Examples: examples,
Path: path,
Comments: make(yaml.CommentMap),
}
if len(examples) == 1 {
configs = append(configs, config)
continue
}
if examples[0].GetSubVariant() != "" {
sort.Slice(examples, func(i, j int) bool {
return examples[i].GetSubVariant() < examples[j].GetSubVariant()
})
}
for i, example := range examples {
comments := example.GetYAMLComments()
if len(comments) == 0 {
continue
}
for i := range comments {
comments[i] = " " + comments[i]
}
config.Comments[fmt.Sprintf("$[%d]", i)] = []*yaml.Comment{yaml.HeadComment(comments...)}
}
configs = append(configs, config)
}
}
return configs
}

func writeExamples(v any, path string, comments yaml.CommentMap) error {
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
return err
}
// #nosec G304
file, err := os.Create(path)
if err != nil {
return err
}
defer func() { _ = file.Close() }()
if object, ok := v.(manifest.Object); ok {
return sdk.EncodeObject(object, file, manifest.ObjectFormatYAML)
}
opts := []yaml.EncodeOption{
yaml.Indent(2),
yaml.UseLiteralStyleIfMultiline(true),
}
if len(comments) > 0 {
opts = append(opts, yaml.WithComment(comments))
}
enc := yaml.NewEncoder(file, opts...)
return enc.Encode(v)
}

func groupBy[K comparable, V any](s []V, key func(V) K) map[K][]V {
m := make(map[K][]V)
for _, v := range s {
k := key(v)
m[k] = append(m[k], v)
}
return m
}
4 changes: 2 additions & 2 deletions internal/manifest/objects_test.go
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/nobl9/nobl9-go/internal/testutils"
"github.com/nobl9/nobl9-go/internal/pathutils"
"github.com/nobl9/nobl9-go/manifest"
v1alphaParser "github.com/nobl9/nobl9-go/manifest/v1alpha/parser"
"github.com/nobl9/nobl9-go/sdk"
@@ -20,7 +20,7 @@ func TestMain(m *testing.M) {
}

func TestObjectExamples(t *testing.T) {
moduleRoot := testutils.FindModuleRoot()
moduleRoot := pathutils.FindModuleRoot()
objects, err := sdk.ReadObjects(context.Background(), filepath.Join(moduleRoot, "manifest/**/example*.yaml"))
require.NoError(t, err)
assert.Greater(t, len(objects), 0, "no object examples found")
Loading