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

Create telemetry resource by default for applications #529

Merged
merged 14 commits into from
Sep 13, 2024

Conversation

omaen
Copy link
Contributor

@omaen omaen commented Sep 3, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new telemetry settings for Istio applications, allowing customization of tracing configurations, including random sampling percentages.
    • Enhanced application configuration to support Istio-specific settings, improving observability and management of telemetry resources.
    • Added support for the telemetryv1 API from Istio, enabling handling of telemetry resources in the application.
    • New configuration sections for istioSettings in job specifications, detailing telemetry settings for better control over tracing behavior.
    • Introduced new YAML files for defining telemetry configurations for applications and jobs.
  • Bug Fixes

    • Updated RBAC permissions to ensure proper management of telemetry resources.
  • Documentation

    • Added detailed configuration examples for telemetry settings in the README and new YAML files.
  • Chores

    • Refined dependency management by updating protobuf libraries.

@omaen omaen requested a review from a team as a code owner September 3, 2024 13:59
Copy link
Contributor

coderabbitai bot commented Sep 3, 2024

Walkthrough

The changes introduce new configuration options for Istio telemetry settings, including the addition of new fields in the ApplicationSpec and related structures to manage telemetry resources. The .gitignore file is updated to refine which Istio-related files are ignored. New YAML configurations for telemetry resources are created, and modifications are made to the schema registration to support the new telemetry API. Additionally, several methods are added to various structs to facilitate unique identification and integration of Istio settings.

Changes

Files Change Summary
.gitignore Updated patterns for ignoring Istio-related files.
README.md Added new sections for podSettings and istioSettings to detail configuration options for Pods and telemetry.
api/v1alpha1/application_types.go Introduced IstioSettings field in ApplicationSpec struct for managing Istio configurations.
api/v1alpha1/istiotypes/istio_settings.go Defined data structures for telemetry settings, including Tracing, Telemetry, and IstioSettings.
api/v1alpha1/routing_types.go Added GetUniqueIdentifier method to Routing struct for unique identification.
api/v1alpha1/skipjob_types.go Updated SKIPJobSpec struct to include IstioSettings for integrating Istio configurations.
api/v1alpha1/skipns_types.go Minor formatting adjustment in import statements.
api/v1alpha1/skipobj_interfaces.go Updated CommonSpec to include IstioSettings and added GetUniqueIdentifier method.
config/crd/skiperator.kartverket.no_applications.yaml Introduced istioSettings section for configuring telemetry settings in the CRD.
config/crd/skiperator.kartverket.no_skipjobs.yaml Added istioSettings section for configuring telemetry settings in the job CRD.
pkg/resourcegenerator/istio/telemetry/telemetry.go Implemented functionality for generating Istio telemetry resources based on reconciliation objects.
pkg/resourceschemas/schemas.go Added support for telemetryv1 API, integrating it into schema registration and retrieval functions.
tests/application/telemetry/*.yaml Created various YAML files for testing telemetry configurations, including assertions for expected telemetry settings.
tests/skipjob/telemetry/*.yaml Created various YAML files for testing telemetry configurations related to SKIPJob, including assertions for expected telemetry settings.

Poem

🐇
In the meadow where I hop and play,
New settings come to brighten the day!
With traces and metrics, oh what a sight,
Istio's magic makes everything right.
So let’s celebrate with a joyful cheer,
For telemetry's here, bringing us near!
🌼✨

Tip

OpenAI O1 model for chat
  • We have deployed OpenAI's latest O1 model for chat.
  • OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
  • Please share any feedback with us in the discussions post.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 20d5821 and ba87f17.

Files selected for processing (5)
  • api/v1alpha1/application_types.go (3 hunks)
  • api/v1alpha1/skipjob_types.go (3 hunks)
  • api/v1alpha1/skipns_types.go (1 hunks)
  • api/v1alpha1/skipobj_interfaces.go (2 hunks)
  • pkg/resourcegenerator/istio/telemetry/telemetry.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • api/v1alpha1/skipns_types.go
Files skipped from review as they are similar to previous changes (3)
  • api/v1alpha1/application_types.go
  • api/v1alpha1/skipobj_interfaces.go
  • pkg/resourcegenerator/istio/telemetry/telemetry.go
Additional comments not posted (3)
api/v1alpha1/skipjob_types.go (3)

6-6: LGTM!

The import statement is necessary to use the IstioSettings type in the SKIPJobSpec struct.


85-91: LGTM!

The IstioSettings field is correctly defined and documented in the SKIPJobSpec struct. The default value is reasonable for enabling tracing by default, and the field is correctly marked as optional, allowing users to override the default settings if needed.


291-293: LGTM!

The GetCommonSpec method is correctly updated to include the IstioSettings field in the returned CommonSpec object. This change ensures that the common specification reflects the new configuration option.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 88f77b2 and 96528cc.

Files selected for processing (19)
  • .gitignore (1 hunks)
  • README.md (1 hunks)
  • api/v1alpha1/application_types.go (3 hunks)
  • api/v1alpha1/istiotypes/istio_settings.go (1 hunks)
  • api/v1alpha1/istiotypes/zz_generated.deepcopy.go (1 hunks)
  • api/v1alpha1/skipobj_interfaces.go (2 hunks)
  • api/v1alpha1/zz_generated.deepcopy.go (2 hunks)
  • config/crd/skiperator.kartverket.no_applications.yaml (1 hunks)
  • config/rbac/role.yaml (1 hunks)
  • go.mod (4 hunks)
  • internal/controllers/application.go (5 hunks)
  • pkg/resourcegenerator/istio/telemetry/telemetry.go (1 hunks)
  • pkg/resourceschemas/schemas.go (3 hunks)
  • pkg/util/constants.go (1 hunks)
  • tests/application/telemetry/application-assert.yaml (1 hunks)
  • tests/application/telemetry/application-custom-tracing-assert.yaml (1 hunks)
  • tests/application/telemetry/application-custom-tracing.yaml (1 hunks)
  • tests/application/telemetry/application.yaml (1 hunks)
  • tests/application/telemetry/chainsaw-test.yaml (1 hunks)
Files skipped from review due to trivial changes (3)
  • api/v1alpha1/istiotypes/zz_generated.deepcopy.go
  • tests/application/telemetry/application-custom-tracing-assert.yaml
  • tests/application/telemetry/application.yaml
Additional comments not posted (31)
.gitignore (1)

10-11: LGTM!

The changes to the .gitignore file look good:

  • The new pattern istio-* aligns with the common naming convention for Istio-related files and directories.
  • The negation pattern !**/istio/ ensures that the istio directory itself is not ignored.
tests/application/telemetry/application-assert.yaml (1)

1-9: LGTM!

The Telemetry resource definition looks good:

  • It uses the correct API version and kind.
  • The tracing configuration is valid, with a provider name and sampling percentage specified.
  • The file aligns with the PR objective of creating telemetry resources by default for applications.

The code changes are approved.

tests/application/telemetry/application-custom-tracing.yaml (1)

10-11: LGTM!

The custom tracing settings are correctly configured.

tests/application/telemetry/chainsaw-test.yaml (1)

1-19: LGTM!

The test case is well-structured and follows the Chainsaw testing framework conventions. It tests the creation and application of resources related to the application and custom tracing, which is relevant to the changes introduced in this PR.

The test case is not skipped and is set to run concurrently, which is good for testing the changes in a realistic environment. The test case is also not set to skip the deletion of resources after the test run, which ensures that the resources are cleaned up after the test run.

The test case is using YAML files for resource creation and assertion, which is a common practice in Kubernetes-based testing. This makes the test case readable and maintainable.

Overall, the test case is a good addition to the test suite and helps ensure the correctness of the changes introduced in this PR.

api/v1alpha1/skipobj_interfaces.go (4)

5-5: LGTM!

The code changes are approved.


22-22: LGTM!

The code changes are approved.


23-23: LGTM!

The code changes are approved.


24-24: LGTM!

The code changes are approved.

pkg/util/constants.go (1)

14-15: LGTM! Please verify the usage of the new constant.

The new constant IstioTraceProvider is correctly defined and the comment provides a clear description of its purpose.

However, without additional context on how this constant is used, it's difficult to provide more specific feedback. Please ensure that the constant is being used correctly and consistently throughout the codebase.

To verify the constant usage, run the following script:

Verification successful

Constant IstioTraceProvider is used correctly and consistently.

The constant IstioTraceProvider is defined in pkg/util/constants.go and is used in pkg/resourcegenerator/istio/telemetry/telemetry.go in a manner consistent with its intended purpose as a trace provider name. No issues were found with its usage.

  • pkg/resourcegenerator/istio/telemetry/telemetry.go: Used in telemetry configuration.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the constant `IstioTraceProvider`.

# Test: Search for the constant usage. Expect: Consistent usage throughout the codebase.
rg --type go -A 5 $'IstioTraceProvider'

Length of output: 1343

api/v1alpha1/istiotypes/istio_settings.go (4)

1-11: LGTM!

The package declaration and comments are approved.


12-17: LGTM!

The Tracing struct is well-defined with appropriate field type and annotations.


22-25: LGTM!

The Telemetry struct is well-defined with appropriate field type and annotation.


30-33: LGTM!

The IstioSettings struct is well-defined with appropriate field type and annotation.

pkg/resourcegenerator/istio/telemetry/telemetry.go (1)

13-55: LGTM!

The code changes are approved.

config/rbac/role.yaml (1)

194-205: LGTM!

The new RBAC rules for managing telemetries resources in the telemetry.istio.io API group look good. The permissions are appropriate and follow the principle of least privilege by only allowing the necessary verbs. This is consistent with the PR objective of creating telemetry resources by default for applications.

pkg/resourceschemas/schemas.go (3)

15-15: LGTM!

The new import statement is necessary to include telemetry schemas into the existing runtime scheme.


36-36: LGTM!

The change ensures that telemetry schemas are registered with the provided runtime scheme.


66-66: LGTM!

The change integrates telemetry resources into the application's schema retrieval process.

README.md (2)

166-171: LGTM!

The new podSettings section allows customizing the Pod Template used by Skiperator to create Deployments. The settings are optional, well-documented, and have sensible defaults.


172-177: LGTM!

The new istioSettings section allows configuring Istio-specific resources, currently only adjusting the sampling interval for tracing. The settings are optional, well-documented, and have sensible defaults.

go.mod (2)

10-10: LGTM!

The changes to the github.com/golang/protobuf dependency are approved. The shift from an indirect to a direct dependency on the same version indicates a more explicit usage of the package in the codebase.


21-21: LGTM!

The changes to the google.golang.org/protobuf dependency are approved. The shift from an indirect to a direct dependency on the same version indicates a more explicit usage of the package in the codebase.

api/v1alpha1/application_types.go (3)

7-7: LGTM!

The import statement is necessary to use the istiotypes.IstioSettings type.


247-251: LGTM!

The IstioSettings field is correctly defined in the ApplicationSpec struct.


437-439: LGTM!

The GetCommonSpec method is correctly updated to include the IstioSettings field.

internal/controllers/application.go (4)

20-20: LGTM!

The import statement for the telemetry package is necessary to utilize telemetry-related resources in the application reconciler.


62-62: LGTM!

The RBAC annotation is necessary to allow the reconciler to perform operations such as get, list, watch, create, update, and delete on the telemetries resource group.


90-90: LGTM!

The Owns statement is necessary to indicate that the reconciler will manage instances of the Telemetry resource type.


202-202: LGTM!

The telemetry.Generate function call is necessary to ensure that telemetry resources are processed during the reconciliation loop.

api/v1alpha1/zz_generated.deepcopy.go (1)

207-211: LGTM!

The code changes for deep copying the IstioSettings field are implemented correctly.

config/crd/skiperator.kartverket.no_applications.yaml (1)

652-679: LGTM!

The new istioSettings property provides a structured way to configure Istio telemetry settings, particularly for tracing. The randomSamplingPercentage property allows adjusting the sampling interval for tracing.

pkg/resourcegenerator/istio/telemetry/telemetry.go Outdated Show resolved Hide resolved
@berg-thom
Copy link
Contributor

LGTM


istioSettings := object.GetCommonSpec().IstioSettings

// TODO: Should we add KindPostFixedName() for the SKIPObject interface and use that for the telemetry name to avoid conflicts?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need input on this

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can override GetName? I don't want to add a function in the interface for only one object

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't a hash of namespace + name be sufficient as far as uniqueness goes? See the util package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would in that case be a hash of namespace + name + kind as the problem I want to avoid is creating an application and skipjob with the same name.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
tests/skipjob/telemetry/skipjob.yaml (1)

12-12: Add a newline at the end of the file.

The yamllint tool indicates that there is no newline character at the end of the file.

While not a critical issue, adding a newline at the end of the file is considered a best practice and improves consistency.

Add a newline at the end of the file:

 print bpi(2000)"
+
Tools
yamllint

[error] 12-12: no new line character at the end of file

(new-line-at-end-of-file)

tests/application/telemetry/application-assert.yaml (1)

1-16: LGTM! The YAML configuration for the Telemetry resource looks good.

The configuration follows the expected structure and conventions for defining a Telemetry resource in Istio. The tracing settings and label selectors are properly specified.

Consider adding a comment to clarify the purpose of the ($namespace) placeholder in the label selector. For example:

      application.skiperator.no/app-namespace: ($namespace) # Placeholder for dynamic namespace value

This will help improve the readability and maintainability of the configuration.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 96528cc and 6832d2c.

Files selected for processing (19)
  • api/v1alpha1/application_types.go (3 hunks)
  • api/v1alpha1/istiotypes/istio_settings.go (1 hunks)
  • api/v1alpha1/istiotypes/zz_generated.deepcopy.go (1 hunks)
  • api/v1alpha1/skipjob_types.go (3 hunks)
  • api/v1alpha1/zz_generated.deepcopy.go (3 hunks)
  • config/crd/skiperator.kartverket.no_applications.yaml (1 hunks)
  • config/crd/skiperator.kartverket.no_skipjobs.yaml (2 hunks)
  • config/rbac/role.yaml (1 hunks)
  • go.mod (4 hunks)
  • internal/controllers/skipjob.go (4 hunks)
  • pkg/resourcegenerator/istio/telemetry/telemetry.go (1 hunks)
  • tests/application/telemetry/application-assert.yaml (1 hunks)
  • tests/application/telemetry/application-custom-tracing-assert.yaml (1 hunks)
  • tests/application/telemetry/chainsaw-test.yaml (1 hunks)
  • tests/skipjob/telemetry/chainsaw-test.yaml (1 hunks)
  • tests/skipjob/telemetry/skipjob-assert.yaml (1 hunks)
  • tests/skipjob/telemetry/skipjob-custom-tracing-assert.yaml (1 hunks)
  • tests/skipjob/telemetry/skipjob-custom-tracing.yaml (1 hunks)
  • tests/skipjob/telemetry/skipjob.yaml (1 hunks)
Files skipped from review due to trivial changes (4)
  • api/v1alpha1/istiotypes/zz_generated.deepcopy.go
  • tests/skipjob/telemetry/skipjob-assert.yaml
  • tests/skipjob/telemetry/skipjob-custom-tracing-assert.yaml
  • tests/skipjob/telemetry/skipjob-custom-tracing.yaml
Additional context used
yamllint
tests/skipjob/telemetry/skipjob.yaml

[error] 12-12: no new line character at the end of file

(new-line-at-end-of-file)

Additional comments not posted (27)
tests/skipjob/telemetry/skipjob.yaml (1)

1-12: LGTM!

The SKIPJob resource definition looks good:

  • It follows the correct structure for a SKIPJob.
  • The container image and command are valid.
  • The resource definition is minimal and focused on a specific task.

The code changes are approved.

Tools
yamllint

[error] 12-12: no new line character at the end of file

(new-line-at-end-of-file)

tests/skipjob/telemetry/chainsaw-test.yaml (2)

1-19: LGTM!

The YAML configuration for the Chainsaw test looks good. The test is well-structured and follows the expected format.


12-12: Verify the referenced files.

The test references the following files:

  • skipjob.yaml
  • skipjob-assert.yaml
  • skipjob-custom-tracing.yaml
  • skipjob-custom-tracing-assert.yaml

Please ensure that these files exist and contain the expected content for testing the telemetry functionality.

Also applies to: 14-14, 17-17, 19-19

tests/application/telemetry/chainsaw-test.yaml (1)

1-20: LGTM!

The test case configuration looks good:

  • The YAML structure and syntax are valid.
  • The apiVersion and kind fields correctly identify the resource type.
  • The metadata.name field provides a descriptive name for the test case.
  • The spec.skip, spec.concurrent, and spec.skipDelete fields are appropriately set based on the desired test behavior.
  • The test steps are well-organized, with each step containing a try block with create/apply and assert actions.
  • The referenced files for create/apply and assert actions provide the necessary resources and assertions for the test case.

The test case is ready to be added to the test suite.

tests/application/telemetry/application-custom-tracing-assert.yaml (1)

1-16: LGTM!

The Telemetry resource configuration looks good:

  • Correctly uses the telemetry.istio.io/v1 API version.
  • Properly structures the metadata and spec fields.
  • Includes a valid tracing setup with a custom provider and sampling percentage.
  • Uses appropriate labels in the selector to target the intended application.

No issues or improvements identified.

api/v1alpha1/istiotypes/istio_settings.go (4)

16-16: The existing comments have already discussed the field name and type. The current implementation using an integer percentage field seems sufficient based on the developer's response.


12-17: LGTM!

The Tracing struct and its RandomSamplingPercentage field are properly defined with appropriate validation and default value.


22-26: The existing comments have already discussed the field type. Using a slice of pointers []*Tracing is the correct type based on the developer's response.


31-35: LGTM!

The IstioSettings struct and its Telemetry field are properly defined with appropriate validation and default value.

pkg/resourcegenerator/istio/telemetry/telemetry.go (1)

14-54: LGTM!

The code changes are approved.

config/rbac/role.yaml (1)

194-205: LGTM!

The changes expand the skiperator ClusterRole's permissions to manage telemetry resources in the telemetry.istio.io API group. The added permissions allow create, delete, get, list, patch, update, and watch operations on the telemetries resource, which seem appropriate for the skiperator controller.

The changes are consistent with the AI-generated summary and align with the PR objective of creating telemetry resources by default for applications.

api/v1alpha1/skipjob_types.go (3)

6-6: LGTM!

The import statement is necessary to use the IstioSettings type.


90-90: LGTM!

The IstioSettings field is correctly defined in the SKIPJobSpec struct.

  • It is marked as optional with a default value, which is a good practice.
  • The default value for the telemetry tracing sampling percentage is set to a reasonable value of 10.

290-292: LGTM!

The changes to the GetCommonSpec method are correct.

  • The IstioSettings field is included in the returned CommonSpec object, ensuring that the common specification reflects the new configuration option.
  • The field is correctly accessed from the skipJob.Spec struct.
go.mod (2)

10-10: Approve addition of direct dependency on github.com/golang/protobuf.

The addition of a direct dependency on github.com/golang/protobuf at version v1.5.4 is approved.

However, please verify that changing this from an indirect to a direct dependency is intentional and consider any potential implications of this shift.


20-20: Approve addition of direct dependency on google.golang.org/protobuf.

The addition of a direct dependency on google.golang.org/protobuf at version v1.34.2 is approved.

However, please verify that changing this from an indirect to a direct dependency is intentional and consider any potential implications of this shift.

internal/controllers/skipjob.go (5)

12-12: LGTM!

The import statement for the telemetry package is necessary for integrating telemetry functionalities.


42-42: LGTM!

The RBAC annotation for telemetry resources is necessary for the controller to manage telemetry objects.


80-80: LGTM!

The ownership of the Telemetry resource is necessary for the controller to monitor and manage telemetry objects.


153-153: LGTM!

The call to telemetry.Generate is necessary for generating telemetry resources as part of the reconciliation process.


Line range hint 1-345: Skipped

The remaining code changes are not directly related to the telemetry integration and do not require additional review comments.

api/v1alpha1/application_types.go (2)

247-252: LGTM!

The addition of the IstioSettings field to the ApplicationSpec struct is approved. It allows for the configuration of Istio-specific resources and enhances the application's capabilities in managing telemetry settings. The field is correctly marked as optional and a sensible default value is provided.


438-440: LGTM!

The changes to the GetCommonSpec method are approved. The inclusion of the IstioSettings field when returning a CommonSpec instance ensures that the new configuration is accessible through this method. The changes are consistent with the addition of the IstioSettings field to the ApplicationSpec struct.

api/v1alpha1/zz_generated.deepcopy.go (2)

207-211: LGTM!

The changes to the DeepCopyInto method for the ApplicationSpec struct look good. The IstioSettings field is correctly handled by checking if it's not nil, creating a new instance of istiotypes.IstioSettings, and deep copying the existing IstioSettings into the new instance.


611-615: LGTM!

The changes to the DeepCopyInto method for the SKIPJobSpec struct look good. Similar to the changes made in the DeepCopyInto method for the ApplicationSpec struct, the IstioSettings field is correctly handled by checking if it's not nil, creating a new instance of istiotypes.IstioSettings, and deep copying the existing IstioSettings into the new instance.

config/crd/skiperator.kartverket.no_skipjobs.yaml (1)

786-820: LGTM!

The new istioSettings field in the SKIPJob CRD spec looks good:

  • It allows configuring Istio-specific telemetry settings, particularly the sampling interval for tracing.
  • The field and its nested properties are well-documented.
  • It has a valid default configuration for telemetry tracing.
  • Using a simple integer type for randomSamplingPercentage is justified due to compatibility with the code generator.
  • It is appropriately marked as a required field.

The changes are approved.

config/crd/skiperator.kartverket.no_applications.yaml (1)

652-686: LGTM!

The new istioSettings configuration section and its properties are well-structured and provide useful options for configuring Istio telemetry settings. The design decision to use a simple integer for randomSamplingPercentage is justified and the value constraints are appropriate.

The code changes are approved.

Copy link
Contributor

@martinhny martinhny left a comment

Choose a reason for hiding this comment

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

lgtm, just had a couple more comments.

api/v1alpha1/istiotypes/istio_settings.go Show resolved Hide resolved

istioSettings := object.GetCommonSpec().IstioSettings

// TODO: Should we add KindPostFixedName() for the SKIPObject interface and use that for the telemetry name to avoid conflicts?
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't a hash of namespace + name be sufficient as far as uniqueness goes? See the util package.

@omaen omaen merged commit f6c6af6 into main Sep 13, 2024
9 checks passed
@omaen omaen deleted the add-telemetry-resource branch September 13, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants