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

Autoscaler basic auth optional #3044

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

asalan316
Copy link
Contributor

@asalan316 asalan316 commented Jun 26, 2024

The goal of this PR is to make basic authentication when communicating with custom metrics optional.

A new parameter credential_type is introduced as part of the service binding request.
valid values of credential_type are binding-secret and x509

Example Request

cf bind-service <APP_NAME> <AUTOSCLAER_SERVICE_NAME> -c "{ \"credential_type\": \"x509\", \"instance_min_count\": 1, \"instance_max_count\": 4, \"scaling_rules\": [{ \"metric_type\": \"memoryused\", \"breach_duration_secs\": 600, \"threshold\": 30, \"operator\": \"<\", \"cool_down_secs\": 300, \"adjustment\": \"-1\" }] }"

  • credential-type = "binding-secret" => allow basic authentication
  • credential-type = "x509" => allow mtls authentication only
  • no or empty credential-type is provided = > "binding-secret" is the default value

Sample Broker Response Output

# credential-type = "x509"

VCAP_SERVICES: {
    "autoscaler-3044": [
      {
        "binding_guid": "372f14bb-efb3-486c-af81-c41384028d8b",
        "binding_name": null,
        "credentials": {
          "custom_metrics": {
            "mtls_url": "https://autoscaler-3044-metricsforwarder-mtls.autoscaler.app-runtime-interfaces.ci.cloudfoundry.org"
          }
        },..
        ....

# credential-type = "binding-secret"

VCAP_SERVICES: {
    "autoscaler-3044": [
      {
        "binding_guid": "372f14bb-efb3-486c-af81-c41384028d8b",
        "binding_name": null,
        "credentials": {
          "custom_metrics": {
            "mtls_url": "https://autoscaler-3044-metricsforwarder-mtls.autoscaler.app-runtime-interfaces.ci.cloudfoundry.org",
            "username": "XXXXX",
            "password": "XXXXX",
            "url": "https://autoscaler-3044metrics....",
          }
        },

@asalan316 asalan316 added allow-acceptance-tests This label needs to be added to enable the acceptance tests to run. skip-cleanup and removed allow-acceptance-tests This label needs to be added to enable the acceptance tests to run. labels Jun 26, 2024
@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch 4 times, most recently from 94c98bf to ff1d697 Compare June 26, 2024 10:22
@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch from ff1d697 to 66e75e4 Compare June 26, 2024 12:29
@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch from 45fd841 to 65ceb1c Compare July 1, 2024 15:26
@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch from 65ceb1c to d572bf4 Compare July 2, 2024 10:05
@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch from d2f5607 to cc4d0d9 Compare July 5, 2024 13:03
@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch 2 times, most recently from e074764 to 7c99ad4 Compare July 5, 2024 16:06
Copy link

sonarcloud bot commented Jul 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
5.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch from 7c99ad4 to 95e096e Compare July 5, 2024 17:06
@@ -31,7 +31,7 @@ type Credential struct {

type CustomMetricsCredentials struct {
*Credential
URL string `json:"url"`
URL string `json:"url,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ignore url in the json output if zero value for string exist e.g ""

@asalan316 asalan316 force-pushed the autoscaler-basic-auth-optional branch from 95e096e to 82b7b4f Compare July 5, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allow-acceptance-tests This label needs to be added to enable the acceptance tests to run. skip-cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant