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

Rename api key to agent api key #2814

Merged
merged 2 commits into from
Oct 20, 2023
Merged

Rename api key to agent api key #2814

merged 2 commits into from
Oct 20, 2023

Conversation

IridiumOxide
Copy link
Contributor

@IridiumOxide IridiumOxide commented Oct 17, 2023

Description of change

Checklist
  • Tested in playground or other setup
  • Screenshot (Grafana) from playground added to PR for 15+ minute run
  • Documentation is changed or added
  • Tests and/or benchmarks are included
  • Breaking changes

Summary by CodeRabbit

  • Refactor: The term APIKey has been renamed to AgentAPIKey across the codebase to improve clarity and consistency. This change affects the schema definitions, configuration files, and environment variables.
  • Documentation: Updated all relevant documentation to reflect the change from APIKey to AgentAPIKey. This includes installation instructions and configuration references.
  • Backward Compatibility: The system will continue to support the old APIKey to ensure backward compatibility. However, users are encouraged to start using AgentAPIKey for future configurations.

These changes aim to make the software more intuitive and user-friendly by using more descriptive terminology.

@IridiumOxide IridiumOxide requested review from a team as code owners October 17, 2023 06:15
@IridiumOxide IridiumOxide marked this pull request as draft October 17, 2023 06:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 17, 2023

Walkthrough

The changes primarily revolve around renaming the APIKey field to AgentAPIKey across various files. This includes updates in schema definitions, configuration files, and code that references the APIKey field. The changes aim to improve clarity and consistency in the codebase, and also ensure backward compatibility by supporting both AgentAPIKey and APIKey.

Changes

Files Summary
docs/agent.md, docs/controller.md Schema definition updated: APIKey field renamed to AgentAPIKey.
docs/content/get-started/..., operator/controllers/agent/config_test.tpl, operator/controllers/controller/config_test.tpl Configuration files updated: api_key field renamed to agent_api_key.
extensions/fluxninja/extconfig/extconfig.go, extensions/fluxninja/heartbeats/heartbeats.go, extensions/fluxninja/otel/otel_test.go, extensions/fluxninja/otel/provide.go Code updated to reference AgentAPIKey instead of APIKey, with backward compatibility.
operator/controllers/utils.go, operator/controllers/utils_test.go Environment variable name updated from "APERTURE_AGENT_FLUXNINJA_API_KEY" to "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY".

"In the land of code, where logic is king, 🐇
A small change can be a big thing. 🎉
From APIKey to AgentAPIKey we hop, 🔄
Ensuring the clarity, we never stop. 🚀
With backward compatibility in our bag, 🎒
We continue the journey, without any lag!" 🏃‍♂️


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

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.

Review Status

Actionable comments generated: 3

Commits Files that changed from the base of the PR and between edab448 and ee317c0.
Files ignored due to filter (6)
  • docs/gen/config/extensions/fluxninja/extension-swagger.yaml
  • manifests/charts/aperture-agent/crds/fluxninja.com_agents.yaml
  • manifests/charts/aperture-agent/templates/agent-deployment.yaml
  • manifests/charts/aperture-controller/crds/fluxninja.com_controllers.yaml
  • operator/config/crd/bases/fluxninja.com_agents.yaml
  • operator/config/crd/bases/fluxninja.com_controllers.yaml
Files selected for processing (17)
  • docs/agent.md (1 hunks)
  • docs/content/get-started/installation/agent/docker.md (1 hunks)
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md (1 hunks)
  • docs/content/get-started/self-hosting/agent.md (1 hunks)
  • docs/content/reference/configuration/agent.md (1 hunks)
  • docs/content/reference/configuration/controller.md (1 hunks)
  • docs/content/reference/fluxninja.md (1 hunks)
  • docs/controller.md (1 hunks)
  • extensions/fluxninja/extconfig/extconfig.go (2 hunks)
  • extensions/fluxninja/heartbeats/heartbeats.go (4 hunks)
  • extensions/fluxninja/heartbeats/peers-watcher.go (1 hunks)
  • extensions/fluxninja/heartbeats/provide.go (1 hunks)
  • extensions/fluxninja/otel/otel_test.go (1 hunks)
  • extensions/fluxninja/otel/provide.go (2 hunks)
  • operator/controllers/agent/config_test.tpl (1 hunks)
  • operator/controllers/utils.go (1 hunks)
  • operator/controllers/utils_test.go (1 hunks)
Files skipped from review due to trivial changes (7)
  • docs/content/get-started/installation/agent/docker.md
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md
  • docs/content/reference/fluxninja.md
  • docs/controller.md
  • extensions/fluxninja/heartbeats/provide.go
  • operator/controllers/agent/config_test.tpl
  • operator/controllers/utils.go
Additional comments (Suppressed): 14
docs/content/get-started/self-hosting/agent.md (1)
  • 68-71: The api_key field has been renamed to agent_api_key. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the documentation and instructions have been updated to instruct users to use agent_api_key instead of api_key.
extensions/fluxninja/otel/otel_test.go (1)
  • 27-34: The key "api_key" has been renamed to "agent_api_key" in the configuration map. Ensure that all instances where this configuration is used have been updated to reflect this change.
extensions/fluxninja/heartbeats/peers-watcher.go (1)
  • 34-43: The logic for checking the API key has been updated to first check for AgentAPIKey and then fall back to APIKey if AgentAPIKey is not available. This is a good approach for maintaining backward compatibility. However, ensure that all instances where APIKey is used have been updated to this new logic.
docs/agent.md (1)
  • 782-788: The renaming of APIKey to AgentAPIKey is reflected correctly in the documentation. Ensure that all references to APIKey in the documentation and code comments have been updated to AgentAPIKey to maintain consistency.
extensions/fluxninja/extconfig/extconfig.go (2)
  • 26-35: The APIKey field has been deprecated and replaced with AgentAPIKey. Ensure that all references to APIKey in the codebase have been updated to AgentAPIKey where necessary. Also, make sure that the new field AgentAPIKey is properly documented and the deprecation of APIKey is communicated to the users.

  • 80-95: The logic for retrieving the API key has been updated to check for AgentAPIKey first and fall back to APIKey if not available. This is a good approach to maintain backward compatibility. However, ensure that this fallback logic is consistently applied throughout the codebase.

extensions/fluxninja/heartbeats/heartbeats.go (4)
  • 66-66: The APIKey field has been renamed to apiKey. Ensure that all references to this field in the codebase have been updated to match the new name.

  • 84-87: The logic for retrieving the API key has been updated to check for AgentAPIKey first and fall back to APIKey if not available. This is a good approach to maintain backward compatibility.

  • 263-263: The apiKey is being added to the metadata of the outgoing context. Ensure that the receiving end of this context is expecting the key to be apiKey and not APIKey.

  • 287-287: The apiKey is being added to the request header. Ensure that the server is expecting the key to be apiKey and not APIKey.

docs/content/reference/configuration/agent.md (1)
  • 1433-1435: The deprecation of the old APIKey field is clearly mentioned. Ensure that all references to the old APIKey field in the codebase have been updated to AgentAPIKey. Also, verify that the fallback logic to APIKey is correctly implemented wherever necessary.
extensions/fluxninja/otel/provide.go (2)
  • 64-69: The function now checks for both AgentAPIKey and APIKey before returning. This is a good practice as it ensures that at least one of the keys is present before proceeding. However, ensure that the rest of the codebase is updated to handle the new AgentAPIKey field and that it falls back to APIKey when AgentAPIKey is not available.

  • 226-237: The apiKey is now set to AgentAPIKey if it's available, otherwise it falls back to APIKey. This is a good practice as it provides backward compatibility for systems that still use APIKey. However, ensure that the authorization header is correctly set in all requests that use this configuration.

operator/controllers/utils_test.go (1)
  • 637-638: The environment variable "APERTURE_AGENT_FLUXNINJA_API_KEY" has been renamed to "APERTURE_AGENT_FLUXNINJA_AGENT_KEY". Ensure that this change is reflected in all places where this environment variable is used, including documentation, scripts, and configuration files.

docs/content/reference/configuration/agent.md Outdated Show resolved Hide resolved
docs/content/reference/configuration/controller.md Outdated Show resolved Hide resolved
docs/content/reference/configuration/controller.md Outdated Show resolved Hide resolved
extensions/fluxninja/extconfig/extconfig.go Outdated Show resolved Hide resolved
extensions/fluxninja/extconfig/extconfig.go Outdated Show resolved Hide resolved
@tanveergill
Copy link
Contributor

@IridiumOxide,

Please make sure that this change does not break backward compatibility for users upgrading their Aperture installations

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.

Review Status

Actionable comments generated: 2

Commits Files that changed from the base of the PR and between f980d10 and 681f7cd.
Files ignored due to filter (6)
  • docs/gen/config/extensions/fluxninja/extension-swagger.yaml
  • manifests/charts/aperture-agent/crds/fluxninja.com_agents.yaml
  • manifests/charts/aperture-agent/templates/agent-deployment.yaml
  • manifests/charts/aperture-controller/crds/fluxninja.com_controllers.yaml
  • operator/config/crd/bases/fluxninja.com_agents.yaml
  • operator/config/crd/bases/fluxninja.com_controllers.yaml
Files selected for processing (17)
  • docs/agent.md (1 hunks)
  • docs/content/get-started/installation/agent/docker.md (1 hunks)
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md (1 hunks)
  • docs/content/get-started/self-hosting/agent.md (1 hunks)
  • docs/content/reference/configuration/agent.md (1 hunks)
  • docs/content/reference/configuration/controller.md (1 hunks)
  • docs/content/reference/fluxninja.md (1 hunks)
  • docs/controller.md (1 hunks)
  • extensions/fluxninja/extconfig/extconfig.go (2 hunks)
  • extensions/fluxninja/heartbeats/heartbeats.go (4 hunks)
  • extensions/fluxninja/heartbeats/peers-watcher.go (1 hunks)
  • extensions/fluxninja/heartbeats/provide.go (1 hunks)
  • extensions/fluxninja/otel/otel_test.go (1 hunks)
  • extensions/fluxninja/otel/provide.go (2 hunks)
  • operator/controllers/agent/config_test.tpl (1 hunks)
  • operator/controllers/utils.go (1 hunks)
  • operator/controllers/utils_test.go (1 hunks)
Files skipped from review due to trivial changes (8)
  • docs/content/get-started/installation/agent/docker.md
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md
  • docs/content/reference/configuration/agent.md
  • docs/content/reference/configuration/controller.md
  • docs/content/reference/fluxninja.md
  • extensions/fluxninja/otel/otel_test.go
  • operator/controllers/agent/config_test.tpl
  • operator/controllers/utils.go
Additional comments (Suppressed): 12
docs/controller.md (1)
  • 513-513: The AgentAPIKey field has been introduced to replace the APIKey field. Ensure that all references to APIKey in the codebase have been updated to AgentAPIKey. Also, verify that the logic for retrieving the API key checks AgentAPIKey first and falls back to APIKey for backward compatibility.
operator/controllers/utils_test.go (1)
  • 637-637: The environment variable APERTURE_AGENT_FLUXNINJA_API_KEY has been renamed to APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY. Ensure that this change is reflected in all parts of the codebase where this environment variable is used. Also, verify that the new environment variable is set correctly in the deployment environment.
extensions/fluxninja/heartbeats/heartbeats.go (4)
  • 66-66: The apiKey field has been renamed from APIKey. Ensure that all references to this field in the codebase have been updated to use the new name. This change is consistent with the PR summary, which mentions renaming APIKey to AgentAPIKey across the codebase.

  • 84-88: The logic for retrieving the API key has been updated to check AgentAPIKey first and fall back to APIKey for backward compatibility. This is a good practice as it ensures that existing functionality will not break while allowing the use of the new AgentAPIKey. However, it's important to ensure that the deprecation of APIKey is clearly communicated to users and developers.

  • 264-265: The API key is added to the metadata of the outgoing context using the new apiKey field. Ensure that the server-side logic has been updated to retrieve the API key from the new field.

  • 288-288: The API key is added to the request header using the new apiKey field. Ensure that the server-side logic has been updated to retrieve the API key from the new field.

docs/content/get-started/self-hosting/agent.md (1)
  • 68-71: The api_key field has been replaced with agent_api_key. Ensure that all references to this field in the codebase have been updated accordingly. Also, verify that the documentation and instructions have been updated to reflect this change.
extensions/fluxninja/heartbeats/provide.go (1)
  • 68-73: The function now checks for both AgentAPIKey and APIKey for backward compatibility. Ensure that all calls to this function throughout the codebase have been updated to match the new logic. Also, verify that the fallback mechanism to APIKey when AgentAPIKey is not available is working as expected.
extensions/fluxninja/otel/provide.go (2)
  • 64-70: The new hunk introduces a check for both AgentAPIKey and APIKey to ensure backward compatibility. This is a good practice as it allows the system to continue functioning with the old APIKey if the new AgentAPIKey is not available. However, it's important to ensure that the deprecation of APIKey is communicated clearly to users and that a timeline for its removal is provided. This will encourage users to transition to the new AgentAPIKey and prevent potential issues in the future when APIKey is removed.

  • 227-234: The new hunk introduces a fallback mechanism to use the old APIKey if the new AgentAPIKey is not available. This is a good practice for maintaining backward compatibility. However, it's important to ensure that the AgentAPIKey is prioritized over the APIKey when both are available. This will encourage the use of the new AgentAPIKey and ensure that the system transitions smoothly to the new key.

extensions/fluxninja/extconfig/extconfig.go (2)
  • 26-35: The renaming of APIKey to AgentAPIKey is clear and the deprecation of APIKey is well documented. However, ensure that all instances where this configuration is used have been updated to use AgentAPIKey instead of APIKey. Also, verify that the validation rules for AgentAPIKey are correctly set up.

  • 80-96: The logic for falling back to APIKey if AgentAPIKey is not set is correctly implemented. However, ensure that this fallback logic is consistently applied across all instances where the API key is used. Also, consider adding a warning log message when the deprecated APIKey is used to encourage users to switch to AgentAPIKey.

Suggested change:

 
 func provideEtcdConfigOverride(extensionConfig *FluxNinjaExtensionConfig) *etcdclient.ConfigOverride {
 	if extensionConfig.EnableCloudController {
		apiKey := extensionConfig.AgentAPIKey
		if apiKey == "" {
			//nolint:staticcheck // SA1019 read APIKey config for backward compatibility
			apiKey = extensionConfig.APIKey
+           log.Warn("APIKey is deprecated, please use AgentAPIKey instead.")
		}
 		return &etcdclient.ConfigOverride{
 			Namespace: "",
 			Endpoints: []string{extensionConfig.Endpoint},
 			PerRPCCredentials: perRPCHeaders{
 				headers: map[string]string{
					"apiKey": apiKey,
 				},
 			},
 			OverriderName: "fluxninja extension",

@IridiumOxide
Copy link
Contributor Author

@IridiumOxide,

Please make sure that this change does not break backward compatibility for users upgrading their Aperture installations

@tanveergill The extension config reads the old apiKey key and uses it if the new agentApiKey key is not defined, so it should be compatible; are there any other factors that need to be considered?

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.

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between ba447b1 and b55bb14.
Files ignored due to filter (6)
  • docs/gen/config/extensions/fluxninja/extension-swagger.yaml
  • manifests/charts/aperture-agent/crds/fluxninja.com_agents.yaml
  • manifests/charts/aperture-agent/templates/agent-deployment.yaml
  • manifests/charts/aperture-controller/crds/fluxninja.com_controllers.yaml
  • operator/config/crd/bases/fluxninja.com_agents.yaml
  • operator/config/crd/bases/fluxninja.com_controllers.yaml
Files selected for processing (18)
  • docs/agent.md (1 hunks)
  • docs/content/get-started/installation/agent/docker.md (1 hunks)
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md (1 hunks)
  • docs/content/get-started/self-hosting/agent.md (1 hunks)
  • docs/content/reference/configuration/agent.md (1 hunks)
  • docs/content/reference/configuration/controller.md (1 hunks)
  • docs/content/reference/fluxninja.md (1 hunks)
  • docs/controller.md (1 hunks)
  • extensions/fluxninja/extconfig/extconfig.go (2 hunks)
  • extensions/fluxninja/heartbeats/heartbeats.go (4 hunks)
  • extensions/fluxninja/heartbeats/peers-watcher.go (1 hunks)
  • extensions/fluxninja/heartbeats/provide.go (1 hunks)
  • extensions/fluxninja/otel/otel_test.go (1 hunks)
  • extensions/fluxninja/otel/provide.go (2 hunks)
  • operator/controllers/agent/config_test.tpl (1 hunks)
  • operator/controllers/controller/config_test.tpl (1 hunks)
  • operator/controllers/utils.go (1 hunks)
  • operator/controllers/utils_test.go (1 hunks)
Files skipped from review due to trivial changes (9)
  • docs/content/get-started/installation/agent/docker.md
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md
  • docs/content/reference/configuration/agent.md
  • docs/content/reference/configuration/controller.md
  • docs/content/reference/fluxninja.md
  • extensions/fluxninja/otel/otel_test.go
  • operator/controllers/agent/config_test.tpl
  • operator/controllers/controller/config_test.tpl
  • operator/controllers/utils.go
Additional comments (Suppressed): 13
docs/content/get-started/self-hosting/agent.md (1)
  • 68-71: The api_key field has been replaced with agent_api_key. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the users of the documentation are informed about this change to avoid confusion.
docs/controller.md (1)
  • 513-513: The APIKey field has been renamed to AgentAPIKey. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the new environment variable "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY" is being set correctly in the deployment environment.
docs/agent.md (1)
  • 782-788: The APIKey field has been renamed to AgentAPIKey in the documentation as well. Ensure that all references to APIKey in the documentation have been updated to AgentAPIKey to maintain consistency. Also, verify that the example usage and any code snippets in the documentation have been updated to reflect this change.
extensions/fluxninja/otel/provide.go (2)
  • 64-70: The new hunk checks for both AgentAPIKey and APIKey to ensure backward compatibility. This is a good practice as it allows the system to function correctly even if the AgentAPIKey is not provided. However, it's important to ensure that the deprecation of APIKey is communicated clearly to the users and a timeline for its complete removal is provided. This will encourage users to switch to AgentAPIKey and prevent potential issues in the future.

  • 227-234: The new hunk first checks if AgentAPIKey is available and uses it if it is. If AgentAPIKey is not available, it falls back to using APIKey. This is a good practice for maintaining backward compatibility. However, it's important to ensure that the system behaves correctly when both AgentAPIKey and APIKey are provided. It might be a good idea to add a check for this scenario and decide which key should be used in such cases.

extensions/fluxninja/heartbeats/peers-watcher.go (1)
  • 34-44: The new code checks for the presence of AgentAPIKey and uses it if available, otherwise it falls back to using the APIKey. This is a good approach for maintaining backward compatibility. However, it's important to ensure that the deprecation of APIKey is clearly communicated to users and that a plan is in place for eventually removing this fallback logic. Also, make sure that all parts of the code that use this function are updated to handle the new AgentAPIKey field.
-    apiKey := extensionConfig.AgentAPIKey
-    if apiKey == "" {
-        //nolint:staticcheck // SA1019 read APIKey config for backward compatibility
-        apiKey = extensionConfig.APIKey
-    }
+    apiKey, ok := extensionConfig.AgentAPIKey
+    if !ok {
+        //nolint:staticcheck // SA1019 read APIKey config for backward compatibility
+        apiKey, ok = extensionConfig.APIKey
+        if !ok {
+            return PeersOut{}, nil
+        }
+    }
operator/controllers/utils_test.go (1)
  • 637-637: The environment variable "APERTURE_AGENT_FLUXNINJA_API_KEY" has been renamed to "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY". Ensure that this change is reflected in all places where this environment variable is used, including any deployment scripts, configuration files, or documentation. Also, make sure that the new environment variable is set in the environment where the application is running.
extensions/fluxninja/extconfig/extconfig.go (2)
  • 26-35: The APIKey field has been deprecated and replaced with AgentAPIKey. Ensure that all references to APIKey in the codebase have been updated to AgentAPIKey. Also, verify that the new field AgentAPIKey is being properly validated and used in the rest of the codebase.

  • 80-96: The logic to check for the presence of AgentAPIKey and use it if available, otherwise fall back to using the APIKey field, ensures backward compatibility. However, it's important to note that the APIKey field is deprecated and should be removed in a future version.

		apiKey := extensionConfig.AgentAPIKey
		if apiKey == "" {
			//nolint:staticcheck // SA1019 read APIKey config for backward compatibility
			apiKey = extensionConfig.APIKey
		}

This code block can be refactored to a separate function that returns the API key. This would improve the modularity and maintainability of the code.

func getAPIKey(extensionConfig *FluxNinjaExtensionConfig) string {
    apiKey := extensionConfig.AgentAPIKey
    if apiKey == "" {
        //nolint:staticcheck // SA1019 read APIKey config for backward compatibility
        apiKey = extensionConfig.APIKey
    }
    return apiKey
}

And then use this function in the provideEtcdConfigOverride function:

		apiKey := getAPIKey(extensionConfig)
extensions/fluxninja/heartbeats/heartbeats.go (4)
  • 66-66: The field APIKey has been renamed to apiKey. Ensure that all references to this field in the codebase have been updated to match the new name. Also, note that the field name is now unexported (starts with a lowercase letter), which means it can't be accessed directly from other packages. If this field needs to be accessed from other packages, consider providing getter and setter methods.

  • 84-88: The code now checks for the presence of AgentAPIKey and uses it if available, otherwise falls back to using the APIKey field. This is a good approach for maintaining backward compatibility. However, it would be beneficial to log a deprecation warning when the APIKey field is used to encourage the transition to AgentAPIKey.

  apiKey := extensionConfig.AgentAPIKey
  if apiKey == "" {
      //nolint:staticcheck // SA1019 read APIKey config for backward compatibility
      apiKey = extensionConfig.APIKey
+     if apiKey != "" {
+         log.Warn().Msg("The use of APIKey is deprecated. Please use AgentAPIKey instead.")
+     }
  }
  • 264-264: The metadata key "apiKey" has been kept the same. Ensure that the server-side code that reads this metadata key is also updated to handle the case where the value could now be an "Agent Key" instead of an "API Key".

  • 288-288: The HTTP header key "apiKey" has been kept the same. Ensure that the server-side code that reads this header key is also updated to handle the case where the value could now be an "Agent Key" instead of an "API Key".

extensions/fluxninja/heartbeats/provide.go Show resolved Hide resolved
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.

Review Status

Actionable comments generated: 3

Commits Files that changed from the base of the PR and between ba447b1 and 7a108db.
Files ignored due to filter (6)
  • docs/gen/config/extensions/fluxninja/extension-swagger.yaml
  • manifests/charts/aperture-agent/crds/fluxninja.com_agents.yaml
  • manifests/charts/aperture-agent/templates/agent-deployment.yaml
  • manifests/charts/aperture-controller/crds/fluxninja.com_controllers.yaml
  • operator/config/crd/bases/fluxninja.com_agents.yaml
  • operator/config/crd/bases/fluxninja.com_controllers.yaml
Files selected for processing (18)
  • docs/agent.md (1 hunks)
  • docs/content/get-started/installation/agent/docker.md (1 hunks)
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md (1 hunks)
  • docs/content/get-started/self-hosting/agent.md (1 hunks)
  • docs/content/reference/configuration/agent.md (1 hunks)
  • docs/content/reference/configuration/controller.md (1 hunks)
  • docs/content/reference/fluxninja.md (1 hunks)
  • docs/controller.md (1 hunks)
  • extensions/fluxninja/extconfig/extconfig.go (2 hunks)
  • extensions/fluxninja/heartbeats/heartbeats.go (4 hunks)
  • extensions/fluxninja/heartbeats/peers-watcher.go (1 hunks)
  • extensions/fluxninja/heartbeats/provide.go (1 hunks)
  • extensions/fluxninja/otel/otel_test.go (1 hunks)
  • extensions/fluxninja/otel/provide.go (2 hunks)
  • operator/controllers/agent/config_test.tpl (1 hunks)
  • operator/controllers/controller/config_test.tpl (1 hunks)
  • operator/controllers/utils.go (1 hunks)
  • operator/controllers/utils_test.go (1 hunks)
Files skipped from review due to trivial changes (8)
  • docs/content/get-started/installation/agent/docker.md
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md
  • docs/content/reference/configuration/agent.md
  • docs/content/reference/configuration/controller.md
  • docs/content/reference/fluxninja.md
  • extensions/fluxninja/otel/otel_test.go
  • operator/controllers/controller/config_test.tpl
  • operator/controllers/utils.go
Additional comments (Suppressed): 12
docs/content/get-started/self-hosting/agent.md (1)
  • 68-71: The api_key field has been renamed to agent_api_key. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the new environment variable "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY" is set correctly in the deployment environment.
extensions/fluxninja/heartbeats/provide.go (1)
  • 68-73: The logic for checking the AgentAPIKey and APIKey fields has been updated to support backward compatibility. The function now checks for AgentAPIKey first and falls back to APIKey if AgentAPIKey is not set. This change is consistent with the PR summary and seems to be implemented correctly. However, ensure that all parts of the code that use these keys have been updated to reflect this change.
docs/controller.md (1)
  • 513-513: The APIKey field has been renamed to AgentAPIKey. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the new field name is correctly used in the configuration files and environment variables.
extensions/fluxninja/otel/provide.go (2)
  • 64-70: The new code checks for both AgentAPIKey and APIKey before returning. This is a good practice for backward compatibility. However, it's important to ensure that the rest of the codebase is updated to prioritize AgentAPIKey over APIKey where applicable. Also, consider adding a deprecation warning when APIKey is used.

  • 227-234: The new code correctly prioritizes AgentAPIKey over APIKey for authorization. This is consistent with the changes made in the rest of the codebase. However, consider adding a deprecation warning when APIKey is used.

operator/controllers/agent/config_test.tpl (1)
  • 48-54: The api_key field has been deprecated and replaced with agent_api_key. However, the deprecated api_key field is still present in the configuration for backward compatibility. Ensure that all references to api_key in the codebase have been updated to agent_api_key and that the fallback logic correctly uses api_key if agent_api_key is not set. Also, verify that the changes are reflected in the documentation and user instructions.
docs/agent.md (1)
  • 782-788: The APIKey field has been renamed to AgentAPIKey as per the changes mentioned in the pull request summary. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the new environment variable "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY" is being used instead of the old one "APERTURE_AGENT_FLUXNINJA_API_KEY". This change should also be reflected in the configuration files where api_key has been replaced with agent_api_key.
extensions/fluxninja/extconfig/extconfig.go (1)
  • 26-35: The APIKey field has been deprecated and replaced with AgentAPIKey. Ensure that all references to APIKey in the codebase have been updated to AgentAPIKey. Also, verify that the new field AgentAPIKey is being properly validated and used throughout the codebase.
extensions/fluxninja/heartbeats/heartbeats.go (3)
  • 66-66: The field apiKey has been renamed from APIKey. Ensure that all references to this field in the codebase have been updated to match the new name. Also, verify that this change does not break any functionality that relies on the old APIKey field.

  • 264-264: The metadata key has been kept as "apiKey" even though the field has been renamed to apiKey. If the server-side code also has been updated to look for "AgentAPIKey", this could cause issues. Please verify that the server-side code still expects the key to be "apiKey".

  • 288-288: The request header key has been kept as "apiKey" even though the field has been renamed to apiKey. If the server-side code also has been updated to look for "AgentAPIKey", this could cause issues. Please verify that the server-side code still expects the key to be "apiKey".

operator/controllers/utils_test.go (1)
  • 637-637: The environment variable "APERTURE_AGENT_FLUXNINJA_API_KEY" has been renamed to "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY". Ensure that this change is reflected in all places where this environment variable is used, including deployment scripts, CI/CD pipelines, and documentation.

extensions/fluxninja/heartbeats/heartbeats.go Show resolved Hide resolved
@IridiumOxide IridiumOxide marked this pull request as ready for review October 19, 2023 03:34
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.

Review Status

Actionable comments generated: 6

Commits Files that changed from the base of the PR and between ba447b1 and c35829d.
Files ignored due to filter (6)
  • docs/gen/config/extensions/fluxninja/extension-swagger.yaml
  • manifests/charts/aperture-agent/crds/fluxninja.com_agents.yaml
  • manifests/charts/aperture-agent/templates/agent-deployment.yaml
  • manifests/charts/aperture-controller/crds/fluxninja.com_controllers.yaml
  • operator/config/crd/bases/fluxninja.com_agents.yaml
  • operator/config/crd/bases/fluxninja.com_controllers.yaml
Files selected for processing (18)
  • docs/agent.md (1 hunks)
  • docs/content/get-started/installation/agent/docker.md (1 hunks)
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md (1 hunks)
  • docs/content/get-started/self-hosting/agent.md (1 hunks)
  • docs/content/reference/configuration/agent.md (1 hunks)
  • docs/content/reference/configuration/controller.md (1 hunks)
  • docs/content/reference/fluxninja.md (1 hunks)
  • docs/controller.md (1 hunks)
  • extensions/fluxninja/extconfig/extconfig.go (2 hunks)
  • extensions/fluxninja/heartbeats/heartbeats.go (4 hunks)
  • extensions/fluxninja/heartbeats/peers-watcher.go (1 hunks)
  • extensions/fluxninja/heartbeats/provide.go (1 hunks)
  • extensions/fluxninja/otel/otel_test.go (1 hunks)
  • extensions/fluxninja/otel/provide.go (2 hunks)
  • operator/controllers/agent/config_test.tpl (1 hunks)
  • operator/controllers/controller/config_test.tpl (1 hunks)
  • operator/controllers/utils.go (1 hunks)
  • operator/controllers/utils_test.go (1 hunks)
Files skipped from review due to trivial changes (8)
  • docs/content/get-started/installation/agent/docker.md
  • docs/content/get-started/installation/agent/kubernetes/namespace-scoped/namespace-scoped.md
  • docs/content/reference/configuration/agent.md
  • docs/content/reference/fluxninja.md
  • extensions/fluxninja/otel/otel_test.go
  • operator/controllers/agent/config_test.tpl
  • operator/controllers/controller/config_test.tpl
  • operator/controllers/utils.go
Additional comments (Suppressed): 9
extensions/fluxninja/heartbeats/provide.go (1)
  • 68-73: The logic for checking the API key has been updated to consider both AgentAPIKey and APIKey. This change is backward compatible as it falls back to APIKey if AgentAPIKey is not set. However, ensure that all instances where this function is called have been updated to pass the correct configuration object with the new AgentAPIKey field.
docs/content/get-started/self-hosting/agent.md (1)
  • 68-71: The api_key field has been renamed to agent_api_key. Ensure that all references to this field in the codebase have been updated to reflect this change. Also, verify that the configuration files have been updated accordingly.
docs/controller.md (1)
  • 513-513: The AgentAPIKey field has been introduced replacing the APIKey field. Ensure that all references to APIKey in the codebase have been updated to AgentAPIKey. Also, verify that the change is reflected in the configuration files and environment variables.
docs/content/reference/configuration/controller.md (1)
  • 945-962: The changes in this hunk reflect the renaming of the APIKey field to AgentAPIKey as mentioned in the PR summary. The old APIKey field is marked as deprecated and the new AgentAPIKey field is introduced. This change is consistent with the PR summary and seems to be correctly implemented. However, ensure that all references to the old APIKey field in the codebase have been updated to use the new AgentAPIKey field. Also, verify that the deprecation of the APIKey field does not break any existing functionality or integrations that rely on it.
extensions/fluxninja/heartbeats/heartbeats.go (2)
  • 66-66: The APIKey field has been renamed to apiKey and its visibility has been changed from public to private. This change is good for encapsulation and data hiding, but ensure that there are no external dependencies on this field.

  • 84-88: The logic has been updated to check if AgentAPIKey is empty and falls back to APIKey for backward compatibility. This is a good practice to ensure that existing configurations continue to work.

operator/controllers/utils_test.go (1)
  • 637-637: The environment variable "APERTURE_AGENT_FLUXNINJA_API_KEY" has been renamed to "APERTURE_AGENT_FLUXNINJA_AGENT_API_KEY". Ensure that this change is reflected in all places where this environment variable is used, including any deployment scripts, CI/CD pipelines, and documentation. Also, verify that the new environment variable is set in the environment where the application is running.
extensions/fluxninja/otel/provide.go (1)
  • 64-70: The new code checks if both AgentAPIKey and APIKey are empty before returning. This is a good approach for backward compatibility as it allows the use of the deprecated APIKey if AgentAPIKey is not set. However, ensure that this fallback logic is clearly documented for users who may still be using the deprecated APIKey.
extensions/fluxninja/extconfig/extconfig.go (1)
  • 26-34: The APIKey field has been deprecated and replaced with AgentAPIKey. Ensure that all references to APIKey in the codebase have been updated to AgentAPIKey. Also, verify that the new field AgentAPIKey is being properly validated and handled in the rest of the codebase.

docs/agent.md Show resolved Hide resolved
extensions/fluxninja/heartbeats/heartbeats.go Show resolved Hide resolved
extensions/fluxninja/heartbeats/heartbeats.go Show resolved Hide resolved
extensions/fluxninja/otel/provide.go Show resolved Hide resolved
extensions/fluxninja/extconfig/extconfig.go Show resolved Hide resolved
@IridiumOxide IridiumOxide merged commit 49af2c5 into main Oct 20, 2023
@IridiumOxide IridiumOxide deleted the apikey-rename branch October 20, 2023 03:30
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.

3 participants