Commit Graph

6 Commits

Author SHA1 Message Date
laminar 201c7cb7bf
Add configMap informer (#326)
Signed-off-by: laminar <fangtian@kubesphere.io>
Signed-off-by: laminar <fangtian@kubesphere.io>

Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-12-14 10:06:27 -08:00
Aaron Schlesinger 3df5d09282
Refactoring concurrency in scaler's pending HTTP queue fetcher logic (#291)
* refactoring concurrency in scaler's queue pinger

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* refactoring concurrency in scaler's queue pinger

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* implementing test for queue.Counts.Aggregate()

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding test for fetchAndSaveCounts

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* moving background processing out of the newQueuePinger constructor

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* updating queue pinger test

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding documentation to the queue pinger

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing errant ticker.Stop() call

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing errant newlines

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing manual interceptor fakes in favor of startFakeQueueEndpointServer

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
2021-10-25 12:26:58 -07:00
Aaron Schlesinger a3aeb62a4d
Adding config endpoints on admin servers for scaler, interceptor and operator (#280)
* adding config endpoint to interceptor

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding documentation about configuration  endpointss

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding operator and scaler config endpoints

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* testing scaler and operator

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* serving operator and scaler admin servers on random ports for tests

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* implementing json.Marshaler for FakeDeploymentCache

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* implementing TestRunAdminServerDeploymentsEndpoint

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
2021-10-25 11:38:53 -07:00
Aaron Schlesinger aa4e0a82b7
Specifying target in scaler for specific host (#242)
* multi-tenant interceptor and scaler

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* specifying host in XKCD ingress

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* routing the xkcd chart to the interceptor properly

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* check host header first

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* sending true active response in stream

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* passing target pending requests through to the underlying ScaledObject (so the scaler can read it later)

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* removing broken target pending requests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using getHost in proxy handler

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding integration test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding more tests to the integration test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* splitting up integration tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* more checks

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* mark new test TODO

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* expanding interceptor integration tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* error messages

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* refactor test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* more test improvements

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* rolling back target pending requests in ScaledObject

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* removing target metric error. it's not used anymore

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* improving waitFunc test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Refactoring the deployment cache to add better error handing and resilience.

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding doc comment

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* refactoring deploy cache and adding tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Using interfaces for deployment watch & list

this makes tests easier

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding more deploy cache tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Fixing up TestK8sDeploymentCacheRewatch

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* shutting down everything else when one thing errors, and adding a deployments cache endpoint

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* removing commented code

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* clarifying deployment cache JSON output, and simplifying deployment watch function

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding TODO tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* error logs and restoring the count middleware

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using consistent net/http package name throughout main.go

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Refactoring deployment cache deployment storage

Also, running go mod tidy and adding new TODO (i.e. failing) tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using deployment.Status.ReadyReplicas, instead of just replicas

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* integration_tets ==> proxy_handlers_integration_test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding some resilience to tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding deployment cache endpoint documentation

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Specifying target size for specific host in scaler

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* sending targetPendingRequests to scalers via the routing table

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using routing table reader interface in scaler

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-09-13 17:59:01 +00:00
Aaron Schlesinger c211da9bd1
Multi-tenant interceptor and scaler (#206)
* multi-tenant interceptor and scaler

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* specifying host in XKCD ingress

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* routing the xkcd chart to the interceptor properly

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* check host header first

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* sending true active response in stream

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* passing target pending requests through to the underlying ScaledObject (so the scaler can read it later)

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* removing broken target pending requests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using getHost in proxy handler

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding integration test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding more tests to the integration test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* splitting up integration tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* more checks

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* mark new test TODO

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* expanding interceptor integration tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* error messages

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* refactor test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* more test improvements

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* rolling back target pending requests in ScaledObject

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* removing target metric error. it's not used anymore

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* improving waitFunc test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Refactoring the deployment cache to add better error handing and resilience.

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding doc comment

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* refactoring deploy cache and adding tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Using interfaces for deployment watch & list

this makes tests easier

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding more deploy cache tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Fixing up TestK8sDeploymentCacheRewatch

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* shutting down everything else when one thing errors, and adding a deployments cache endpoint

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* removing commented code

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* clarifying deployment cache JSON output, and simplifying deployment watch function

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding TODO tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* error logs and restoring the count middleware

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using consistent net/http package name throughout main.go

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* Refactoring deployment cache deployment storage

Also, running go mod tidy and adding new TODO (i.e. failing) tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* using deployment.Status.ReadyReplicas, instead of just replicas

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* integration_tets ==> proxy_handlers_integration_test

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding some resilience to tests

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding deployment cache endpoint documentation

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* running the global test target with sh.RunV

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* adding timeout to magefile test target

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>

* finishing one TODO test and adding issue for the rest:

Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-09-03 10:19:20 +02:00
Aaron Schlesinger 22c912071b
Fixing app creation timing issue (#116)
* upgrading all dockerfile Go versions to 1.16

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* creating new targets for the example/test HTTPScaledObject

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* moving external scaler generated files

the scaler uses the server stubs but the operator now needs to use the client, so it needs to move out of the scaler binary

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* progress on code to wait for scaler

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* checking deployment replicas:

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Adding health check endpoints to the scaler

Also centralizing config for the scaler with envconfig

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Closing both the gRPC server and HTTP healthcheck server on context cancel/timeout

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding util functions for adding liveness/readiness probes

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fixing var name

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding readiness and liveness probes, and tests for it

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* printing output for scaler tests, even when they fail

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* simplifying scaler health check code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding health check test code to scaler

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
2021-05-18 18:55:47 +00:00