Skip to content

Commit 514f1df

Browse files
Merge pull request #172 from port-labs/live-events-rollout-init-match-integ-versions
live events rollout init match integ versions
2 parents 9c717f7 + 20e9ebc commit 514f1df

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

charts/port-ocean/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: port-ocean
33
description: A Helm chart for Port Ocean integrations
44
type: application
5-
version: 0.6.4
5+
version: 0.7.0
66
appVersion: "0.1.0"
77
home: https://getport.io/
88
sources:

charts/port-ocean/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ The following table lists the configuration parameters of the `port-ocean` chart
102102
| `liveEvents.worker.enabled` | Enable stand-alone live events worker | `false` |
103103
| `liveEvents.worker.replicaCount` | Number of stand-alone live events worker replicas | `1` |
104104
| `liveEvents.worker.resources` | Container resource requests and limits for stand-alone live events worker | `{}` |
105+
| `liveEvents.deployment.rolloutStrategy` | Standalone live events worker deployment rollout strategy. | `RollingUpdate` |
105106
| `liveEvents.service.enabled` | Specifies whether the service is enabled or not. | `true` |
106107
| `liveEvents.service.type` | Service type for the Port application. | `ClusterIP` |
107108
| `liveEvents.service.port` | Port number for the service. | `8000` |

charts/port-ocean/templates/cron-job/cron-jobs-init-container-sa.yml

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ rules:
2020
- apiGroups: [ "" ]
2121
resources: [ "pods" ]
2222
verbs: [ "get", "list", "watch" ]
23+
- apiGroups: [ "apps" ]
24+
resources: [ "deployments" ]
25+
verbs: [ "get", "list", "patch" ]
2326
---
2427
apiVersion: rbac.authorization.k8s.io/v1
2528
kind: RoleBinding

charts/port-ocean/templates/cron-job/cron.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ spec:
8080
8181
echo "kubectl get jobs -l ${LABEL_SELECTOR} -o=json | jq -r \".items[] | select(.status.active > 0) | select(.metadata.name != \"$CURRENT_JOB_NAME\") | .metadata.name\""
8282
JOBS=$(kubectl get jobs -l ${LABEL_SELECTOR} -o=json --token=$TOKEN | jq -r ".items[] | select(.status.active > 0) | select(.metadata.name != \"$CURRENT_JOB_NAME\") | .metadata.name")
83-
echo "Found jobs: $JOBS"
8483
if [ -n "$JOBS" ]; then
84+
echo "Found jobs: $JOBS"
8585
for JOB in $JOBS; do
8686
echo "Setting deadline for job: $JOB"
8787
kubectl patch job $JOB -n ${NAMESPACE} -p "{\"spec\":{\"activeDeadlineSeconds\":$DEADLINE}, \"metadata\":{\"labels\":{\"canceled\": \"$CURRENT_JOB_NAME\"}}}" --token=$TOKEN
@@ -94,6 +94,20 @@ spec:
9494
else
9595
echo "No running resync jobs found. Starting new job: $CURRENT_JOB_NAME"
9696
fi
97+
98+
# Rollout live events deployment if exists to match integration image versions
99+
DEPLOYMENT_NAME={{ include "port-ocean.liveEvents.deploymentName" . }}
100+
101+
echo "Running: kubectl get deployment ${DEPLOYMENT_NAME} -o=json | jq -r \".metadata.name\""
102+
DEPLOYMENT=$(kubectl get deployment ${DEPLOYMENT_NAME} --token=$TOKEN -o=json | jq -r ".metadata.name")
103+
if [ -n $DEPLOYMENT ]; then
104+
echo "Found deployment: $DEPLOYMENT"
105+
echo "Rolling out $DEPLOYMENT"
106+
kubectl rollout restart deployment $DEPLOYMENT -n ${NAMESPACE} --token=$TOKEN
107+
else
108+
echo "Deployment $DEPLOYMENT_NAME does not exist. Skipping rollout restart."
109+
fi
110+
97111
echo "Exiting init container"
98112
containers:
99113
- name: {{ include "port-ocean.containerName" . }}

charts/port-ocean/templates/deployment-live-events.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ metadata:
66
labels:
77
{{- include "port-ocean.liveEvents.labels" . | nindent 4 }}
88
spec:
9+
{{- with .Values.liveEvents.deployment.rolloutStrategy }}
910
strategy:
10-
type: {{ .Values.workload.deployment.rolloutStrategy | default "Recreate" }}
11+
{{- toYaml . | trim | nindent 4 }}
12+
{{- end }}
1113
replicas: {{ .Values.liveEvents.worker.replicaCount | default 1 }}
1214
selector:
1315
matchLabels:

charts/port-ocean/values.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ liveEvents:
146146
limits:
147147
memory: "1024Mi"
148148
cpu: "500m"
149+
deployment:
150+
rolloutStrategy:
151+
type: RollingUpdate
152+
maxSurge: 25%
153+
maxUnavailable: 25%
149154
service:
150155
enabled: true
151156
type: ClusterIP

0 commit comments

Comments
 (0)