-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support unified deployment of Poller and Scaler to GKE
- Loading branch information
Showing
93 changed files
with
8,287 additions
and
179 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
kubernetes/unified/autoscaler-config/autoscaler-config-hourly.yaml.template
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,33 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: autoscaler-config-hourly | ||
namespace: spanner-autoscaler | ||
data: | ||
autoscaler-config-hourly.yaml: | | ||
--- | ||
- projectId: ${PROJECT_ID} | ||
instanceId: autoscale-test | ||
# Delete this stanza if using Firestore for state | ||
stateDatabase: | ||
name: spanner | ||
instanceId: autoscale-test-state | ||
databaseId: spanner-autoscaler-state | ||
scalingMethod: DIRECT | ||
units: PROCESSING_UNITS | ||
minSize: 200 | ||
maxSize: 200 |
33 changes: 33 additions & 0 deletions
33
kubernetes/unified/autoscaler-config/autoscaler-config.yaml.template
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,33 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: autoscaler-config | ||
namespace: spanner-autoscaler | ||
data: | ||
autoscaler-config.yaml: | | ||
--- | ||
- projectId: ${PROJECT_ID} | ||
instanceId: autoscale-test | ||
# Delete this stanza if using Firestore for state | ||
stateDatabase: | ||
name: spanner | ||
instanceId: autoscale-test-state | ||
databaseId: spanner-autoscaler-state | ||
scalingMethod: LINEAR | ||
units: PROCESSING_UNITS | ||
minSize: 100 | ||
maxSize: 500 |
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,21 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
apiVersion: kpt.dev/v1 | ||
kind: Kptfile | ||
metadata: | ||
name: autoscaler-pkg | ||
annotations: | ||
config.kubernetes.io/local-config: "true" | ||
info: | ||
description: Config for Spanner autoscaler |
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,16 @@ | ||
# autoscaler-pkg | ||
|
||
## Description | ||
|
||
Config for Spanner Autoscaler | ||
|
||
### View package content | ||
|
||
`kpt pkg tree autoscaler-pkg` | ||
[Details](https://kpt.dev/reference/cli/pkg/tree/) | ||
|
||
## Installation | ||
|
||
See [documentation][docs] for installation and configuration instructions. | ||
|
||
[docs]: ../../../terraform/gke/README.md |
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,23 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: default-deny-all | ||
namespace: spanner-autoscaler # kpt-set: ${namespace} | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress |
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,21 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
apiVersion: kpt.dev/v1 | ||
kind: Kptfile | ||
metadata: | ||
name: scaler | ||
annotations: | ||
config.kubernetes.io/local-config: "true" | ||
info: | ||
description: Config for Spanner autoscaler |
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,16 @@ | ||
# scaler | ||
|
||
## Description | ||
|
||
Config for Spanner Autoscaler | ||
|
||
### View package content | ||
|
||
`kpt pkg tree scaler` | ||
[Details](https://kpt.dev/reference/cli/pkg/tree/) | ||
|
||
## Installation | ||
|
||
See [documentation][docs] for installation and configuration instructions. | ||
|
||
[docs]: ../../../../terraform/gke/unified/README.md |
51 changes: 51 additions & 0 deletions
51
kubernetes/unified/autoscaler-pkg/scaler/scaler-hourly.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,51 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: scaler-hourly | ||
namespace: spanner-autoscaler # kpt-set: ${namespace} | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: "1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: scaler | ||
spec: | ||
containers: | ||
- name: scaler | ||
image: scaler-image # kpt-set: ${scaler_image} | ||
resources: | ||
requests: | ||
memory: "256Mi" | ||
cpu: "250m" | ||
limits: | ||
memory: "256Mi" | ||
env: | ||
- name: AUTOSCALER_CONFIG | ||
value: "/etc/autoscaler-config/autoscaler-config-hourly.yaml" | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/autoscaler-config | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: autoscaler-config-hourly | ||
nodeSelector: | ||
iam.gke.io/gke-metadata-server-enabled: "true" | ||
restartPolicy: Never | ||
serviceAccountName: scaler-sa |
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,48 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: scaler | ||
namespace: spanner-autoscaler # kpt-set: ${namespace} | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: "*/2 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: scaler | ||
spec: | ||
containers: | ||
- name: scaler | ||
image: scaler-image # kpt-set: ${scaler_image} | ||
resources: | ||
requests: | ||
memory: "256Mi" | ||
cpu: "250m" | ||
limits: | ||
memory: "256Mi" | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/autoscaler-config | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: autoscaler-config | ||
nodeSelector: | ||
iam.gke.io/gke-metadata-server-enabled: "true" | ||
restartPolicy: Never | ||
serviceAccountName: scaler-sa |
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,14 @@ | ||
ARG NODE_VERSION=18 | ||
FROM node:${NODE_VERSION}-alpine AS build-env | ||
|
||
WORKDIR /usr/src/app | ||
COPY . . | ||
|
||
RUN npm config set update-notifier false | ||
RUN npm install | ||
|
||
FROM gcr.io/distroless/nodejs${NODE_VERSION}:latest | ||
COPY --from=build-env /usr/src/app /usr/src/app | ||
WORKDIR /usr/src/app/scaler/scaler-core | ||
|
||
CMD ["../../index.js"] |
Oops, something went wrong.