-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add APP_INSIGHTS_ID to image build (#1266)
# Description * Add APP_INSIGHTS_ID to image build to allow monitoring through heartbeat during test execution. * Add test to configuration packages (for both operator and daemonset) * Make heartbeat interval configurable * New keys in `deploy/standard/manifests/controller/helm/retina/values.yaml` ## Related Issue If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request. ## Checklist - [ ] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [ ] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [ ] I have correctly attributed the author(s) of the code. - [ ] I have tested the changes locally. - [ ] I have followed the project's style guidelines. - [ ] I have updated the documentation, if necessary. - [ ] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Manual test was also done to validate that the configuration was propagated from helm chart `values.yaml` file to both operator and agent. Value set was printed to log: ![image](https://github.com/user-attachments/assets/e2e80968-8874-4b31-a2d5-61eb2d3c39a7) ![image](https://github.com/user-attachments/assets/662b175a-072f-4806-a91b-864bd758b12d) ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. --------- Signed-off-by: Alex Castilio dos Santos <[email protected]>
- Loading branch information
1 parent
8543b7b
commit 1fbf3b3
Showing
16 changed files
with
160 additions
and
11 deletions.
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
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
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
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
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
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
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
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,43 @@ | ||
package config_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
"time" | ||
|
||
"github.com/microsoft/retina/operator/config" | ||
) | ||
|
||
func TestGetConfig(t *testing.T) { | ||
c, err := config.GetConfig("./testwith/config.yaml") | ||
if err != nil { | ||
t.Errorf("Expected no error, instead got %+v", err) | ||
} | ||
|
||
if !c.InstallCRDs || | ||
!c.EnableTelemetry || | ||
c.LogLevel != "info" || | ||
!c.EnableRetinaEndpoint || | ||
!c.RemoteContext || | ||
c.TelemetryInterval != 15*time.Minute { | ||
t.Errorf("Expeted config should be same as ./testwith/config.yaml; instead got %+v", c) | ||
} | ||
} | ||
|
||
func TestGetConfig_DefaultTelemetryInterval(t *testing.T) { | ||
c, err := config.GetConfig("./testwith/config-without-telemetry-interval.yaml") | ||
if err != nil { | ||
t.Errorf("Expected no error, instead got %+v", err) | ||
} | ||
|
||
if c.TelemetryInterval != config.DefaultTelemetryInterval { | ||
t.Errorf("Expected telemetry interval to be %v, instead got %v", config.DefaultTelemetryInterval, c.TelemetryInterval) | ||
} | ||
} | ||
|
||
func TestGetConfig_SmallTelemetryInterval(t *testing.T) { | ||
_, err := config.GetConfig("./testwith/config-small-telemetry-interval.yaml") | ||
if !errors.Is(err, config.ErrorTelemetryIntervalTooSmall) { | ||
t.Errorf("Expected error %s, instead got %s", config.ErrorTelemetryIntervalTooSmall, err) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
operator/config/testwith/config-small-telemetry-interval.yaml
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,9 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
installCRDs: true | ||
enableTelemetry: true | ||
logLevel: info | ||
enableRetinaEndpoint: true | ||
remoteContext: true | ||
telemetryInterval: "10s" |
8 changes: 8 additions & 0 deletions
8
operator/config/testwith/config-without-telemetry-interval.yaml
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,8 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
installCRDs: true | ||
enableTelemetry: true | ||
logLevel: info | ||
enableRetinaEndpoint: true | ||
remoteContext: true |
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,9 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
installCRDs: true | ||
enableTelemetry: true | ||
logLevel: info | ||
enableRetinaEndpoint: true | ||
remoteContext: true | ||
telemetryInterval: "15m" |
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
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
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,12 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
# Supported - debug, info, error, warn, panic, fatal. | ||
logLevel: info | ||
enabledPlugin: ["dropreason", "packetforward", "linuxutil"] | ||
# Interval, in seconds, to scrape/publish metrics. | ||
metricsIntervalDuration: "10s" | ||
# used to export telemetry to AppInsights | ||
telemetryEnabled: true | ||
dataAggregationLevel: "low" | ||
telemetryInterval: "10s" |
11 changes: 11 additions & 0 deletions
11
pkg/config/testwith/config-without-telemetry-interval.yaml
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,11 @@ | ||
apiServer: | ||
host: "0.0.0.0" | ||
port: 10093 | ||
# Supported - debug, info, error, warn, panic, fatal. | ||
logLevel: info | ||
enabledPlugin: ["dropreason", "packetforward", "linuxutil"] | ||
# Interval, in seconds, to scrape/publish metrics. | ||
metricsIntervalDuration: "10s" | ||
# used to export telemetry to AppInsights | ||
telemetryEnabled: true | ||
dataAggregationLevel: "low" |
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