quarkiverse / quarkus-helm

Quarkus Extension to generate the Helm artifacts
Apache License 2.0
11 stars 10 forks source link

Deployment.yaml is malformed if quarkus.management.enabled is set true on a project #295

Closed nullptr0000 closed 11 months ago

nullptr0000 commented 11 months ago

Using Quarkus 3.5.0 or 3.5.1, and Quarkus-Helm 1.2.0

If a project is built with the option 'quarkus.management.enabled=true', the deployment.yaml generated is malformed, including a spurious ' | quote' against one port value, and only linking one out of the three probes to the management port.

The management port definition is correctly created, as is the value, and the startupProbe is linked to it so something is at least attempting to process it correctly.

The Quarkus generated kubernetes.yml elsewhere has the expected values. If the management port option is disabled the deployment.yaml is generated without any spurious ' | quote', and obviously without any references to the management port.

Generated yaml snippet:

spec:  
  containers:  
    - env:  
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
      image: {{ .Values.app.image }}
      imagePullPolicy: Always
      livenessProbe:
        failureThreshold: {{ .Values.app.livenessProbe.failureThreshold }}
        httpGet:
          path: {{ .Values.app.livenessProbe.httpGet.path }}
          port: {{ .Values.app.ports.http | quote }}
          scheme: {{ .Values.app.livenessProbe.httpGet.scheme }}
        initialDelaySeconds: {{ .Values.app.livenessProbe.initialDelaySeconds }}
        periodSeconds: {{ .Values.app.livenessProbe.periodSeconds }}
        successThreshold: {{ .Values.app.livenessProbe.successThreshold }}
        timeoutSeconds: {{ .Values.app.livenessProbe.timeoutSeconds }}
      name: example-project
      ports:
        - containerPort: {{ .Values.app.ports.management }}
          name: management
          protocol: TCP
        - containerPort: {{ .Values.app.ports.http }}
          name: http
          protocol: TCP
      readinessProbe:
        failureThreshold: {{ .Values.app.readinessProbe.failureThreshold }}
        httpGet:
          path: {{ .Values.app.readinessProbe.httpGet.path }}
          port: {{ .Values.app.ports.http }}
          scheme: {{ .Values.app.readinessProbe.httpGet.scheme }}
        initialDelaySeconds: {{ .Values.app.readinessProbe.initialDelaySeconds }}
        periodSeconds: {{ .Values.app.readinessProbe.periodSeconds }}
        successThreshold: {{ .Values.app.readinessProbe.successThreshold }}
        timeoutSeconds: {{ .Values.app.readinessProbe.timeoutSeconds }}
      startupProbe:
        failureThreshold: {{ .Values.app.startupProbe.failureThreshold }}
        httpGet:
          path: {{ .Values.app.startupProbe.httpGet.path }}
          port: {{ .Values.app.ports.management }}
          scheme: {{ .Values.app.startupProbe.httpGet.scheme }}
        initialDelaySeconds: {{ .Values.app.startupProbe.initialDelaySeconds }}
        periodSeconds: {{ .Values.app.startupProbe.periodSeconds }}
        successThreshold: {{ .Values.app.startupProbe.successThreshold }}
        timeoutSeconds: {{ .Values.app.startupProbe.timeoutSeconds }}
  serviceAccountName: example-project

Expected yaml snippet:

spec:
  containers:
    - env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
      image: {{ .Values.app.image }}
      imagePullPolicy: Always
      livenessProbe:
        failureThreshold: {{ .Values.app.livenessProbe.failureThreshold }}
        httpGet:
          path: {{ .Values.app.livenessProbe.httpGet.path }}
          port: {{ .Values.app.ports.management }}
          scheme: {{ .Values.app.livenessProbe.httpGet.scheme }}
        initialDelaySeconds: {{ .Values.app.livenessProbe.initialDelaySeconds }}
        periodSeconds: {{ .Values.app.livenessProbe.periodSeconds }}
        successThreshold: {{ .Values.app.livenessProbe.successThreshold }}
        timeoutSeconds: {{ .Values.app.livenessProbe.timeoutSeconds }}
      name: example-project
      ports:
        - containerPort: {{ .Values.app.ports.management }}
          name: management
          protocol: TCP
        - containerPort: {{ .Values.app.ports.http }}
          name: http
          protocol: TCP
      readinessProbe:
        failureThreshold: {{ .Values.app.readinessProbe.failureThreshold }}
        httpGet:
          path: {{ .Values.app.readinessProbe.httpGet.path }}
          port: {{ .Values.app.ports.management }}
          scheme: {{ .Values.app.readinessProbe.httpGet.scheme }}
        initialDelaySeconds: {{ .Values.app.readinessProbe.initialDelaySeconds }}
        periodSeconds: {{ .Values.app.readinessProbe.periodSeconds }}
        successThreshold: {{ .Values.app.readinessProbe.successThreshold }}
        timeoutSeconds: {{ .Values.app.readinessProbe.timeoutSeconds }}
      startupProbe:
        failureThreshold: {{ .Values.app.startupProbe.failureThreshold }}
        httpGet:
          path: {{ .Values.app.startupProbe.httpGet.path }}
          port: {{ .Values.app.ports.management }}
          scheme: {{ .Values.app.startupProbe.httpGet.scheme }}
        initialDelaySeconds: {{ .Values.app.startupProbe.initialDelaySeconds }}
        periodSeconds: {{ .Values.app.startupProbe.periodSeconds }}
        successThreshold: {{ .Values.app.startupProbe.successThreshold }}
        timeoutSeconds: {{ .Values.app.startupProbe.timeoutSeconds }}
  serviceAccountName: example-project
Sgitario commented 11 months ago

Thanks for reporting! The resolution of ports was indeed wrong. This is caused by the definition of this mapping by Quarkus/Dekorate. For now, https://github.com/quarkiverse/quarkus-helm/pull/296 should fix it.