Skip to content

Helm values with annotations for fixed IPs/IDs #2631

Description

@baptiste-gaillet

To deploy Otoroshi using Helm and GitOps, it is recommended to fix the IP addresses and provide these fixed values ​​to the deployment.

With Scaleway, you can add annotations for this purpose.

A possible example for this feature request.

Add in the helm values :

  # Fixed IPs for Leader and Worker
  # Allowed values: null or (leaderIP or scaleway leaderIPId)
  leaderIP: null
  leaderIPId: "478baa34-5bcf-438e-a72e-5a422bc46a50"
  workerIP: null
  workerIPId: "4b4fd006-7024-4e95-8024-c038ac086cae"

Add in the cluster/deploy template:

---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.cluster.leaderExternalServiceName }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "otoroshi.labels" . | nindent 4 }}
    app.kubernetes.io/component: leader
  {{- if or .Values.loadbalancer.annotations .Values.loadbalancer.leaderIPId }}
  annotations:
    {{- with .Values.loadbalancer.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    {{- if .Values.loadbalancer.leaderIPId }}
    service.beta.kubernetes.io/scw-loadbalancer-ip-ids: {{ .Values.loadbalancer.leaderIPId | quote }}
    {{- end }}
  {{- end }}
spec:
  type: {{ $lbType }}
  {{- if and (eq $lbType "LoadBalancer") .Values.loadbalancer.leaderIP }}
  loadBalancerIP: {{ .Values.loadbalancer.leaderIP | quote }}
  {{- end }}
  {{- if eq $lbType "LoadBalancer" }}
  {{- if .Values.loadbalancer.loadBalancerClass }}
  loadBalancerClass: {{ .Values.loadbalancer.loadBalancerClass | quote }}
  {{- end }}
  {{- with .Values.loadbalancer.sourceRanges }}
  loadBalancerSourceRanges:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- end }}
  selector:
    {{- include "otoroshi.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: leader
  ports:
  - port: {{ .Values.loadbalancer.http }}
    name: "http"
    targetPort: "http"
    {{- if eq $lbType "NodePort" }}
    nodePort: {{ .Values.loadbalancer.nodePort.http }}
    {{- end }}
  - port: {{ .Values.loadbalancer.https }}
    name: "https"
    targetPort: "https"
    {{- if eq $lbType "NodePort" }}
    nodePort: {{ .Values.loadbalancer.nodePort.https }}
    {{- end }}
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.cluster.workerExternalServiceName }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "otoroshi.labels" . | nindent 4 }}
    app.kubernetes.io/component: worker
  {{- if or .Values.loadbalancer.annotations .Values.loadbalancer.workerIPId }}
  annotations:
    {{- with .Values.loadbalancer.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    {{- if .Values.loadbalancer.workerIPId }}
    service.beta.kubernetes.io/scw-loadbalancer-ip-ids: {{ .Values.loadbalancer.workerIPId | quote }}
    {{- end }}
  {{- end }}
spec:
  type: {{ $lbType }}
  {{- if and (eq $lbType "LoadBalancer") .Values.loadbalancer.workerIP }}
  loadBalancerIP: {{ .Values.loadbalancer.workerIP | quote }}
  {{- end }}
  {{- if eq $lbType "LoadBalancer" }}
  {{- if .Values.loadbalancer.loadBalancerClass }}
  loadBalancerClass: {{ .Values.loadbalancer.loadBalancerClass | quote }}
  {{- end }}
  {{- with .Values.loadbalancer.sourceRanges }}
  loadBalancerSourceRanges:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- end }}
  selector:
    {{- include "otoroshi.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: worker
  ports:
  - port: {{ .Values.loadbalancer.http }}
    name: "http"
    targetPort: "http"
    {{- if eq $lbType "NodePort" }}
    nodePort: {{ .Values.loadbalancer.nodePort.http }}
    {{- end }}
  - port: {{ .Values.loadbalancer.https }}
    name: "https"
    targetPort: "https"
    {{- if eq $lbType "NodePort" }}
    nodePort: {{ .Values.loadbalancer.nodePort.https }}
    {{- end }}
{{- end }}

This template add the possibility for ID-IPs and IPs, but only ID-IPs on scaleway was tested and works well.

Thx ;p
Baptiste

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions