lpiob commented on code in PR #345:
URL: https://github.com/apache/apisix-helm-chart/pull/345#discussion_r970804211


##########
charts/apisix/templates/ingress.yaml:
##########
@@ -34,7 +34,7 @@ metadata:
     {{- toYaml . | nindent 4 }}
   {{- end }}
 spec:
-  {{- if .Values.gateway.ingress.className }}
+  {{- if and .Values.gateway.ingress.className (semverCompare ">=1.18-0" 
.Capabilities.KubeVersion.GitVersion) }}

Review Comment:
   Implemented now in 
<https://github.com/apache/apisix-helm-chart/pull/345/files#diff-3a22eeb01325380f68706901c6733b574958c40d0b7329385729f85ba4a74c80R20>,
 in the same way that [current 
helm](https://github.com/helm/helm/blob/bed23120b048977d67c929cec915e1d6e0887c5d/pkg/chartutil/create.go#L218-L242)
 templates adds those annotations.
   
   The change was tested by simulating older kube version:
   ```
   l-lbiegaj apisix [gateway-]≠1?5 -> helm template . --set 
'gateway.ingress.enabled=true' --set 'gateway.ingress.className=TESTME' 
--kube-version 1.17  | grep -A15 Ingress
   kind: Ingress
   metadata:
     name: RELEASE-NAME-apisix
     labels:
       helm.sh/chart: apisix-0.11.1-localtests
       app.kubernetes.io/name: apisix
       app.kubernetes.io/instance: RELEASE-NAME
       app.kubernetes.io/version: "2.15.0"
       app.kubernetes.io/managed-by: Helm
     annotations:
       kubernetes.io/ingress.class: TESTME
   spec:
     rules:
   ...
   
   l-lbiegaj apisix [gateway-]≠1?5 -> helm template . --set 
'gateway.ingress.enabled=true' --set 'gateway.ingress.className=TESTME' 
--kube-version 1.23  | grep -A15 Ingress
   kind: Ingress
   metadata:
     name: RELEASE-NAME-apisix
     labels:
       helm.sh/chart: apisix-0.11.1-localtests
       app.kubernetes.io/name: apisix
       app.kubernetes.io/instance: RELEASE-NAME
       app.kubernetes.io/version: "2.15.0"
       app.kubernetes.io/managed-by: Helm
   spec:
     ingressClassName: TESTME
     rules:
   ...
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to