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

Hpa fixup #15

Merged
merged 5 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions bundle/manifests/operators.ibm.com_stocktraders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,27 @@ spec:
type: string
type: object
mq:
description: IBM MQ settings (optional)
description: MQ settings (optional)
properties:
kind:
description: Kind of MQ Provider
enum:
- ibm-mq
- amazon-mq-apache-mq
type: string
channel:
description: Channel
type: string
url:
description: >-
Connection string with protocol(s) and port
type: string
host:
description: Host name (or IP address)
type: string
id:
description: User ID
type: string
kind:
description: MQ vendor
type: string
password:
description: Password
format: password
Expand Down
1 change: 1 addition & 0 deletions bundle/manifests/operators_v1_stocktrader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ spec:
mq:
kind: ibm-mq
host: mqtrader1-mqtrader1
url: ssl://mqtrader-amazonaws.com:61617
port: 1414
id: app
password: pwd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ metadata:
"mq": {
"kind": "ibm-mq",
"host": "mqtrader1-mqtrader1",
"url": "ssl://mqtrader-amazonaws.com:61617",
"port": 1414,
"id": "app",
"password": "pwd",
Expand Down Expand Up @@ -1335,7 +1336,7 @@ spec:

# Section for MQ settings
- path: mq
displayName: IBM MQ settings
displayName: MQ settings
- path: mq.kind
description: This controls which JMS resource adapter (.rar file) gets loaded and how it is configured
displayName: Select the appropriate MQ vendor for point-to-point messaging
Expand All @@ -1348,6 +1349,12 @@ spec:
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:mq
- path: mq.url
description: Connection string for MQ
displayName: MQ connection string [ssl:// or failover://(ssl://..)]
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:mq
- path: mq.port
description: Use the local port number (not the node port or Ingress port) if using an intra-cluster deployment of MQ
displayName: Port number for MQ
Expand Down
9 changes: 7 additions & 2 deletions config/crd/bases/operators.ibm.com_stocktraders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,18 @@ spec:
type: string
type: object
mq:
description: IBM MQ settings (optional)
description: MQ settings (optional)
properties:
channel:
description: Channel
type: string
url:
description: >-
Connection string with protocol(s) and port
type: string
host:
description: Host name (or IP address)
description: >-
Host name, connection string, or IP address
type: string
id:
description: User ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ metadata:
"url": "http://odmtrader1-ibm-odm-dev:9060/DecisionService/rest/ICP_Trader_Dev_1/determineLoyalty"
},
"mq": {
"kind": "ibm-mq",
"host": "mqtrader1-mqtrader1",
"port": 1414,
"id": "app",
Expand Down Expand Up @@ -1335,7 +1334,7 @@ spec:

# Section for MQ settings
- path: mq
displayName: IBM MQ settings
displayName: MQ settings
- path: mq.kind
description: This controls which JMS resource adapter (.rar file) gets loaded and how it is configured
displayName: Select the appropriate MQ vendor for point-to-point messaging
Expand All @@ -1348,6 +1347,12 @@ spec:
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:mq
- path: mq.url
description: Connection string for MQ
displayName: MQ connection string [ssl:// or failover://(ssl://..)]
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:mq
- path: mq.port
description: Use the local port number (not the node port or Ingress port) if using an intra-cluster deployment of MQ
displayName: Port number for MQ
Expand Down
1 change: 1 addition & 0 deletions config/samples/operators_v1_stocktrader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ spec:
kind: ibm-mq
host: mqtrader1-mqtrader1
port: 1414
url: ssl://mqtrader-amazonaws.com:61617
id: app
password: pwd
queueManager: stocktrader
Expand Down
69 changes: 68 additions & 1 deletion helm-charts/stocktrader/templates/account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ spec:
sidecar.istio.io/inject: 'true'
{{- end }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- account
topologyKey: "kubernetes.io/hostname"
{{- if .Values.global.pullSecret }}
imagePullSecrets:
- name: {{ tpl .Values.global.pullSecretName . }}
Expand Down Expand Up @@ -146,6 +158,11 @@ spec:
configMapKeyRef:
name: {{ tpl .Values.global.configMapName . }}
key: mq.kind
- name: MQ_URL
valueFrom:
configMapKeyRef:
name: {{ tpl .Values.global.configMapName . }}
key: mq.url
- name: MQ_HOST
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -288,6 +305,49 @@ spec:
{{- if .Values.account.autoscale }}
---
#Deploy the autoscaler
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-account-hpa
labels:
app: stock-trader
spec:
behavior:
scaleUp:
stabilizationWindowSeconds: 0
selectPolicy: Min
policies:
- type: Pods
value: 1
periodSeconds: 15
scaleDown:
stabilizationWindowSeconds: 300
selectPolicy: Max
policies:
- type: Percent
value: 100
periodSeconds: 120
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-account
minReplicas: {{ .Values.account.replicas }}
maxReplicas: {{ .Values.account.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.account.cpuThreshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
{{- else }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
Expand Down Expand Up @@ -316,7 +376,14 @@ spec:
name: {{ .Release.Name }}-account
minReplicas: {{ .Values.account.replicas }}
maxReplicas: {{ .Values.account.maxReplicas }}
targetCPUUtilizationPercentage: {{ .Values.account.cpuThreshold }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.account.cpuThreshold }}
{{- end }}
{{- end }}
---
#Deploy the service
Expand Down
64 changes: 63 additions & 1 deletion helm-charts/stocktrader/templates/broker-query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ spec:
sidecar.istio.io/inject: 'true'
{{- end }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- broker-query
topologyKey: "kubernetes.io/hostname"
{{- if .Values.global.pullSecret }}
imagePullSecrets:
- name: {{ tpl .Values.global.pullSecretName . }}
Expand Down Expand Up @@ -192,6 +204,49 @@ spec:
{{- if .Values.brokerCQRS.autoscale }}
---
#Deploy the autoscaler
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-broker-query-hpa
labels:
app: stock-trader
spec:
behavior:
scaleUp:
stabilizationWindowSeconds: 0
selectPolicy: Min
policies:
- type: Pods
value: 1
periodSeconds: 15
scaleDown:
stabilizationWindowSeconds: 300
selectPolicy: Max
policies:
- type: Percent
value: 100
periodSeconds: 120
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-broker-query
minReplicas: {{ .Values.brokerCQRS.replicas }}
maxReplicas: {{ .Values.brokerCQRS.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.brokerCQRS.cpuThreshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
{{- else }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
Expand Down Expand Up @@ -220,7 +275,14 @@ spec:
name: {{ .Release.Name }}-broker-query
minReplicas: {{ .Values.brokerCQRS.replicas }}
maxReplicas: {{ .Values.brokerCQRS.maxReplicas }}
targetCPUUtilizationPercentage: {{ .Values.brokerCQRS.cpuThreshold }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.brokerCQRS.cpuThreshold }}
{{- end }}
{{- end }}
---
#Deploy the service
Expand Down
64 changes: 63 additions & 1 deletion helm-charts/stocktrader/templates/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ spec:
sidecar.istio.io/inject: 'true'
{{- end }}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- broker
topologyKey: "kubernetes.io/hostname"
{{- if .Values.global.pullSecret }}
imagePullSecrets:
- name: {{ tpl .Values.global.pullSecretName . }}
Expand Down Expand Up @@ -158,6 +170,49 @@ spec:
{{- if .Values.broker.autoscale }}
---
#Deploy the autoscaler
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-broker-hpa
labels:
app: stock-trader
spec:
behavior:
scaleUp:
stabilizationWindowSeconds: 0
selectPolicy: Min
policies:
- type: Pods
value: 1
periodSeconds: 15
scaleDown:
stabilizationWindowSeconds: 300
selectPolicy: Max
policies:
- type: Percent
value: 100
periodSeconds: 120
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-broker
minReplicas: {{ .Values.broker.replicas }}
maxReplicas: {{ .Values.broker.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.broker.cpuThreshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
{{- else }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
Expand Down Expand Up @@ -186,7 +241,14 @@ spec:
name: {{ .Release.Name }}-broker
minReplicas: {{ .Values.broker.replicas }}
maxReplicas: {{ .Values.broker.maxReplicas }}
targetCPUUtilizationPercentage: {{ .Values.broker.cpuThreshold }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.broker.cpuThreshold }}
{{- end }}
{{- end }}
---
#Deploy the service
Expand Down
Loading