0

I have a helm chart that contains a TargetGroupBinding

{{- range $v := .Values.targetBindings }}
  apiVersion: elbv2.k8s.aws/v1beta1
  kind: TargetGroupBinding
  metadata:
    name: {{ include "fullname" $ }}-{{ $v.name }}
    labels:
      {{- include "labels" $ | nindent 4 }}
  spec:
    targetGroupARN: {{ $v.target }}
    serviceRef:
      name: {{ include "fullname" $ }}
      port: {{ $v.port }}
  ---
{{- end }}

This works perfectly fine installing a new helm chart, but as soon as we attempt to run a helm upgrade we get the following error

Error: UPGRADE FAILED: failed to replace object: admission webhook "vtargetgroupbinding.elbv2.k8s.aws" denied the request: TargetGroupBinding must specify these fields: spec.targetType

As the error says, I have attempted adding the spec.targetType (which is 'ip' in this case), but in doing this I then get the error:

Error: UPGRADE FAILED: failed to replace object: admission webhook "vtargetgroupbinding.elbv2.k8s.aws" denied the request: TargetGroupBinding update may not change these fields: spec.ipAddressType

According to AWS's documentation, spec.targetType is optional (https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.8/guide/targetgroupbinding/spec/#elbv2.k8s.aws/v1beta1.TargetType)

Has anyone ever come across this before/know how to resolve it?

1 Answer 1

0

I seem to have resolved this for ip target types. I have added targetType to the yaml despite being said to be optional, and whilst not in the AWS documentation at all, running a kubectl edit on the resource I noticed there was also ipAddressType, so I have also added this to my yaml.

My result is:

{{- range $v := .Values.targetBindings }}
  apiVersion: elbv2.k8s.aws/v1beta1
  kind: TargetGroupBinding
  metadata:
    name: {{ include "fullname" $ }}-{{ $v.name }}
    labels:
      {{- include "labels" $ | nindent 4 }}
  spec:
    targetGroupARN: {{ $v.target }}
    ipAddressType: ipv4
    targetType: {{ $v.targetGroup | default "ip" }}
    serviceRef:
      name: {{ include "fullname" $ }}
      port: {{ $v.port }}
  ---
{{- end }}

I don't know what ipAddressType would look like, or if it would even exist if the targetType was instance, but for the time being I don't need to worry about this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .