Skip to content

Commit

Permalink
feat: expose image pull policy and upgrade stan to v0.22.1 (#1325)
Browse files Browse the repository at this point in the history
* feat: expose image pull policy and upgrade stan to v0.22.1

Signed-off-by: Derek Wang <whynowy@gmail.com>

* lint

Signed-off-by: Derek Wang <whynowy@gmail.com>

* ok

Signed-off-by: Derek Wang <whynowy@gmail.com>
  • Loading branch information
whynowy committed Sep 1, 2021
1 parent 0e7a0b4 commit 9cac83a
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 98 deletions.
23 changes: 23 additions & 0 deletions api/event-bus.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions api/event-bus.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions controllers/eventbus/installer/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ func (i *natsInstaller) buildConfigMap() (*corev1.ConfigMap, error) {
if i.eventBus.Spec.NATS.Native.MaxMsgs != nil {
maxMsgs = *i.eventBus.Spec.NATS.Native.MaxMsgs
}
maxSubs := uint64(1000)
if i.eventBus.Spec.NATS.Native.MaxSubs != nil {
maxSubs = *i.eventBus.Spec.NATS.Native.MaxSubs
}
maxBytes := "1GB"
if i.eventBus.Spec.NATS.Native.MaxBytes != nil {
maxBytes = *i.eventBus.Spec.NATS.Native.MaxBytes
Expand Down Expand Up @@ -480,8 +484,9 @@ streaming {
max_age: %s
max_msgs: %v
max_bytes: %s
max_subs: %v
}
}`, strconv.Itoa(int(monitorPort)), strconv.Itoa(int(clusterPort)), strings.Join(routes, ","), clusterID, strings.Join(peers, ","), maxAge, maxMsgs, maxBytes)
}`, strconv.Itoa(int(monitorPort)), strconv.Itoa(int(clusterPort)), strings.Join(routes, ","), clusterID, strings.Join(peers, ","), maxAge, maxMsgs, maxBytes, maxSubs)
cm := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: i.eventBus.Namespace,
Expand Down Expand Up @@ -573,6 +578,7 @@ func (i *natsInstaller) buildStatefulSetSpec(serviceName, configmapName, authSec
if replicas < 3 {
replicas = 3
}
var stanContainerPullPolicy, metricsContainerPullPolicy corev1.PullPolicy
stanContainerResources := corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: apiresource.MustParse("0"),
Expand All @@ -581,10 +587,12 @@ func (i *natsInstaller) buildStatefulSetSpec(serviceName, configmapName, authSec
containerTmpl := i.eventBus.Spec.NATS.Native.ContainerTemplate
if containerTmpl != nil {
stanContainerResources = containerTmpl.Resources
stanContainerPullPolicy = containerTmpl.ImagePullPolicy
}
metricsContainerResources := corev1.ResourceRequirements{}
if i.eventBus.Spec.NATS.Native.MetricsContainerTemplate != nil {
metricsContainerResources = i.eventBus.Spec.NATS.Native.MetricsContainerTemplate.Resources
metricsContainerPullPolicy = i.eventBus.Spec.NATS.Native.MetricsContainerTemplate.ImagePullPolicy
}
podTemplateLabels := make(map[string]string)
if i.eventBus.Spec.NATS.Native.Metadata != nil &&
Expand Down Expand Up @@ -654,8 +662,9 @@ func (i *natsInstaller) buildStatefulSetSpec(serviceName, configmapName, authSec
},
Containers: []corev1.Container{
{
Name: "stan",
Image: i.streamingImage,
Name: "stan",
Image: i.streamingImage,
ImagePullPolicy: stanContainerPullPolicy,
Ports: []corev1.ContainerPort{
{Name: "client", ContainerPort: clientPort},
{Name: "cluster", ContainerPort: clusterPort},
Expand Down Expand Up @@ -683,8 +692,9 @@ func (i *natsInstaller) buildStatefulSetSpec(serviceName, configmapName, authSec
},
},
{
Name: "metrics",
Image: i.metricsImage,
Name: "metrics",
Image: i.metricsImage,
ImagePullPolicy: metricsContainerPullPolicy,
Ports: []corev1.ContainerPort{
{Name: "metrics", ContainerPort: common.EventBusMetricsPort},
},
Expand Down
3 changes: 2 additions & 1 deletion docs/eventbus.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ affinity:
deleted automatically. It can be cutomized by setting
`spec.nats.native.maxAge`, i.e. `240h`.

- Max subscription number is 1000.
- Max subscription number is defaults to `1000`, it could be customized by
setting `spec.nats.native.maxSubs`.

### Exotic

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: NATS_STREAMING_IMAGE
value: nats-streaming:0.17.0
value: nats-streaming:0.22.1
- name: NATS_METRICS_EXPORTER_IMAGE
value: synadia/prometheus-nats-exporter:0.6.2
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: NATS_STREAMING_IMAGE
value: nats-streaming:0.17.0
value: nats-streaming:0.22.1
- name: NATS_METRICS_EXPORTER_IMAGE
value: synadia/prometheus-nats-exporter:0.6.2
image: quay.io/argoproj/argo-events:v1.4.0
Expand Down
2 changes: 1 addition & 1 deletion manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: NATS_STREAMING_IMAGE
value: nats-streaming:0.17.0
value: nats-streaming:0.22.1
- name: NATS_METRICS_EXPORTER_IMAGE
value: synadia/prometheus-nats-exporter:0.6.2
image: quay.io/argoproj/argo-events:v1.4.0
Expand Down
Loading

0 comments on commit 9cac83a

Please sign in to comment.