diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/deployment.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/deployment.yaml index 5f8d35bd27..61b0052f0d 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/deployment.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/deployment.yaml @@ -202,7 +202,7 @@ spec: {{- end}} {{- end}} containers: - - name: {{ $.Chart.Name }} + - name: {{ $.Values.containerName | default $.Chart.Name }} image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} {{- if $.Values.containerSpec.lifecycle.enabled }} @@ -642,7 +642,7 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include ".Chart.Name .fullname" $ }}-{{ $.Values.secondaryWorkload.postfix | default "sec" }} + name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }} labels: app: {{ template ".Chart.Name .name" $ }} chart: {{ template ".Chart.Name .chart" $ }} @@ -655,15 +655,25 @@ metadata: {{- if .Values.appLabels }} {{ toYaml .Values.appLabels | indent 4 }} {{- end }} +{{- if .Values.secondaryWorkload.deploymentLabels }} +{{ toYaml .Values.secondaryWorkload.deploymentLabels | indent 4 }} +{{- end }} -{{- if .Values.deploymentAnnotations }} +{{- if or .Values.deploymentAnnotations .Values.secondaryWorkload.deploymentAnnotations }} annotations: +{{- if .Values.deploymentAnnotations }} {{ toYaml .Values.deploymentAnnotations | indent 4 }} {{- end }} +{{- if .Values.secondaryWorkload.deploymentAnnotations }} +{{ toYaml .Values.secondaryWorkload.deploymentAnnotations | indent 4 }} +{{- end }} +{{- end }} spec: selector: matchLabels: -{{- if .Values.customMatchLabels }} +{{- if .Values.secondaryWorkload.customMatchLabels }} +{{ toYaml .Values.secondaryWorkload.customMatchLabels | indent 6 }} +{{- else if .Values.customMatchLabels }} {{ toYaml .Values.customMatchLabels | indent 6 }} {{- else }} app: {{ template ".Chart.Name .name" $ }} @@ -673,11 +683,14 @@ spec: minReadySeconds: {{ $.Values.MinReadySeconds }} template: metadata: - {{- if .Values.podAnnotations }} + {{- if or .Values.podAnnotations .Values.secondaryWorkload.podAnnotations }} annotations: {{- range $key, $value := .Values.podAnnotations }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- range $key, $value := .Values.secondaryWorkload.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} {{- end }} labels: app: {{ template ".Chart.Name .name" $ }} @@ -692,6 +705,9 @@ spec: {{- end }} {{- if .Values.podLabels }} {{ toYaml .Values.podLabels | indent 8 }} +{{- end }} +{{- if .Values.secondaryWorkload.podLabels }} +{{ toYaml .Values.secondaryWorkload.podLabels | indent 8 }} {{- end }} spec: {{- if $.Values.podExtraSpecs }} @@ -813,7 +829,7 @@ spec: {{- end}} {{- end}} containers: - - name: {{ $.Chart.Name }} + - name: {{ $.Values.secondaryWorkload.containerName | default $.Chart.Name }} image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} {{- if $.Values.containerSpec.lifecycle.enabled }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-destinationrule.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-destinationrule.yaml index 4d06deb0b8..569c07705f 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-destinationrule.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-destinationrule.yaml @@ -35,4 +35,43 @@ spec: {{ toYaml $.Values.istio.destinationRule.trafficPolicy | indent 4 }} {{- end }} {{- end }} +{{- end }} +--- +{{- with .Values.istio }} +{{- if and .enable .destinationRule.enabled $.Values.secondaryWorkload.istio.destinationRule.enabled }} +apiVersion: networking.istio.io/v1beta1 +kind: DestinationRule +metadata: + {{- if $.Values.secondaryWorkload.istio.destinationRule.name }} + name: {{ $.Values.secondaryWorkload.istio.destinationRule.name }} + {{- else }} + name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-destinationrule + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if $.Values.secondaryWorkload.istio.destinationRule.labels }} +{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.labels | indent 4 }} + {{- end }} +{{- if $.Values.secondaryWorkload.istio.destinationRule.annotations }} + annotations: +{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.annotations | indent 4 }} +{{- end }} +spec: + host: "{{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-service.{{ $.Release.Namespace }}.svc.cluster.local" +{{- if $.Values.secondaryWorkload.istio.destinationRule.subsets }} + subsets: +{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.subsets | indent 4 }} +{{- end }} +{{- if $.Values.secondaryWorkload.istio.destinationRule.trafficPolicy }} + trafficPolicy: +{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.trafficPolicy | indent 4 }} +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-virtualservice.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-virtualservice.yaml index 02a9007ed2..5fb72c16d4 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-virtualservice.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-virtualservice.yaml @@ -5,6 +5,8 @@ kind: VirtualService metadata: {{- if .virtualService.name }} name: {{ .virtualService.name }} + {{- else if $.Values.virtualServiceName }} + name: {{ $.Values.virtualServiceName }} {{- else }} name: {{ template ".Chart.Name .fullname" $ }}-virtualservice {{- end }} @@ -34,7 +36,7 @@ spec: - {{ . | quote }} {{- end }} {{- end }} -{{- if or .gateway.enabled .virtualService.hosts }} +{{- if or .gateway.enabled .virtualService.hosts $.Values.virtualServiceHosts }} hosts: {{- if .gateway.enabled }} {{- if .gateway.host }} @@ -48,6 +50,9 @@ spec: {{- range .virtualService.hosts }} - {{ . | quote }} {{- end }} + {{- range $.Values.virtualServiceHosts }} + - {{ . | quote }} + {{- end }} {{- else }} hosts: - "{{ include ".servicename" $ }}.{{ $.Release.Namespace }}.svc.cluster.local" @@ -57,4 +62,70 @@ spec: {{ toYaml $.Values.istio.virtualService.http | indent 4 }} {{- end }} {{- end }} +{{- end }} +--- +{{- with .Values.istio }} +{{- if and .enable .virtualService.enabled $.Values.secondaryWorkload.istio.virtualService.enabled }} +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + {{- if $.Values.secondaryWorkload.istio.virtualService.name }} + name: {{ $.Values.secondaryWorkload.istio.virtualService.name }} + {{- else if $.Values.secondaryWorkload.virtualServiceName }} + name: {{ $.Values.secondaryWorkload.virtualServiceName }} + {{- else }} + name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-virtualservice + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} +{{- if $.Values.appLabels }} +{{ toYaml $.Values.appLabels | indent 4 }} +{{- end }} + {{- if $.Values.secondaryWorkload.istio.virtualService.labels }} +{{ toYaml $.Values.secondaryWorkload.istio.virtualService.labels | indent 4 }} + {{- end }} +{{- if $.Values.secondaryWorkload.istio.virtualService.annotations }} + annotations: +{{ toYaml $.Values.secondaryWorkload.istio.virtualService.annotations | indent 4 }} +{{- end }} +spec: +{{- if or .gateway.enabled $.Values.secondaryWorkload.istio.virtualService.gateways }} + gateways: + {{- if .gateway.enabled }} + - {{ template ".Chart.Name .fullname" $ }}-istio-gateway + {{- end }} + {{- range $.Values.secondaryWorkload.istio.virtualService.gateways }} + - {{ . | quote }} + {{- end }} +{{- end }} +{{- if or .gateway.enabled $.Values.secondaryWorkload.istio.virtualService.hosts $.Values.secondaryWorkload.virtualServiceHosts }} + hosts: + {{- if .gateway.enabled }} + {{- if .gateway.host }} + - {{ .gateway.host | quote }} + {{- else if .gateway.hosts }} +{{- range .gateway.hosts }} + - {{ . | quote }} +{{- end }} + {{- end }} + {{- end }} + {{- range $.Values.secondaryWorkload.istio.virtualService.hosts }} + - {{ . | quote }} + {{- end }} + {{- range $.Values.secondaryWorkload.virtualServiceHosts }} + - {{ . | quote }} + {{- end }} +{{- else }} + hosts: + - "{{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-service.{{ $.Release.Namespace }}.svc.cluster.local" +{{- end }} +{{- if $.Values.secondaryWorkload.istio.virtualService.http }} + http: +{{ toYaml $.Values.secondaryWorkload.istio.virtualService.http | indent 4 }} +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/keda-autoscaling.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/keda-autoscaling.yaml index 780afa73b1..f243737b30 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/keda-autoscaling.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/keda-autoscaling.yaml @@ -74,5 +74,86 @@ metadata: {{- end }} spec: {{ toYaml $.Values.kedaAutoscaling.triggerAuthentication.spec | indent 2 }} + {{- end }} -{{- end }} \ No newline at end of file +{{- end }} +--- +{{- if $.Values.secondaryWorkload.kedaAutoscaling.enabled }} +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + {{- if $.Values.secondaryWorkload.kedaAutoscaling.name }} + name: {{ $.Values.secondaryWorkload.kedaAutoscaling.name }} + {{- else }} + name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-keda + {{- end }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + release: {{ .Release.Name }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} + {{- if .Values.secondaryWorkload.kedaAutoscaling.labels }} +{{ toYaml .Values.secondaryWorkload.kedaAutoscaling.labels | indent 4 }} + {{- end }} + {{- if .Values.secondaryWorkload.kedaAutoscaling.annotations }} + annotations: +{{ toYaml .Values.secondaryWorkload.kedaAutoscaling.annotations | indent 4 }} + {{- end }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.envSourceContainerName }} + envSourceContainerName: {{ $.Values.secondaryWorkload.kedaAutoscaling.envSourceContainerName }} +{{- end }} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.pollingInterval }} + pollingInterval: {{ $.Values.secondaryWorkload.kedaAutoscaling.pollingInterval }} +{{- end }} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.cooldownPeriod }} + cooldownPeriod: {{ $.Values.secondaryWorkload.kedaAutoscaling.cooldownPeriod }} +{{- end }} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.idleReplicaCount }} + idleReplicaCount: {{ $.Values.secondaryWorkload.kedaAutoscaling.idleReplicaCount }} +{{- end }} + minReplicaCount: {{ $.Values.secondaryWorkload.kedaAutoscaling.minReplicaCount }} + maxReplicaCount: {{ $.Values.secondaryWorkload.kedaAutoscaling.maxReplicaCount }} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.fallback }} + fallback: +{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.fallback | indent 4 }} +{{- end }} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.advanced }} + advanced: +{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.advanced | indent 4 }} +{{- end }} + triggers: +{{ toYaml .Values.secondaryWorkload.kedaAutoscaling.triggers | indent 2}} +{{- if $.Values.secondaryWorkload.kedaAutoscaling.authenticationRef }} + authenticationRef: +{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.authenticationRef | indent 6 }} +{{- end }} +--- +{{- if $.Values.secondaryWorkload.kedaAutoscaling.triggerAuthentication.enabled }} +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: {{ $.Values.secondaryWorkload.kedaAutoscaling.triggerAuthentication.name }} + labels: + app: {{ template ".Chart.Name .name" $ }} + chart: {{ template ".Chart.Name .chart" $ }} + release: {{ $.Release.Name }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: +{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.triggerAuthentication.spec | indent 2 }} +{{- end }} +{{- end }} +--- diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/service.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/service.yaml index 99293e4e6e..5cc86765b2 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/service.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/service.yaml @@ -111,4 +111,83 @@ spec: app: {{ template ".Chart.Name .name" . }} {{- end }} {{- end }} +{{- end }} +{{- end }} + +--- +{{- if .Values.secondaryWorkload.service.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" .) (.Values.secondaryWorkload.postfix | default "sec")) }}-service + labels: + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Release.Name }} +{{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} +{{- end }} +{{- if .Values.secondaryWorkload.service.annotations }} + annotations: +{{ toYaml .Values.secondaryWorkload.service.annotations | indent 4 }} +{{- end}} +spec: + type: {{ .Values.secondaryWorkload.service.type | default .Values.service.type | default "ClusterIP" }} +{{- with .Values.secondaryWorkload.service.extraSpec }} + {{- toYaml . | nindent 2 }} + {{- end }} +{{- if (eq (.Values.secondaryWorkload.service.type | default .Values.service.type | default "ClusterIP") "LoadBalancer") }} + {{- if .Values.secondaryWorkload.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.secondaryWorkload.service.loadBalancerIP }} + {{- end }} + {{- if .Values.secondaryWorkload.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- range .Values.secondaryWorkload.service.loadBalancerSourceRanges }} + - {{ . }} + {{- end }} + {{- end }} +{{- end }} + ports: + {{- $containerPorts := .Values.secondaryWorkload.ContainerPort | default .Values.ContainerPort }} + {{- range $containerPorts }} + {{- if .servicePort }} + - port: {{ .servicePort }} + {{- else }} + - port: {{ .port }} + {{- end }} + {{- if .targetPort }} + targetPort: {{ .targetPort }} + {{- else if $.Values.appMetrics }} + targetPort: envoy-{{ .name }} + {{- else }} + targetPort: {{ .name }} + {{- end }} + protocol: {{ .protocol | default "TCP" }} + {{- if (and (eq ($.Values.secondaryWorkload.service.type | default $.Values.service.type | default "ClusterIP") "NodePort") .nodePort ) }} + nodePort: {{ .nodePort }} + {{- end }} + name: {{ .name }} + {{- end }} + {{- if $.Values.appMetrics }} + - port: 9901 + name: envoy-admin + {{- end }} + selector: + {{- if .Values.secondaryWorkload.customPodLabels }} +{{ toYaml .Values.secondaryWorkload.customPodLabels | indent 4 }} + {{- else if .Values.customPodLabels }} +{{ toYaml .Values.customPodLabels | indent 4 }} + {{- else }} + app: {{ template ".Chart.Name .name" . }} + {{- end }} + workload: secondary +{{- if .Values.secondaryWorkload.service.sessionAffinity.enabled }} + sessionAffinity: ClientIP +{{- end }} +{{- if .Values.secondaryWorkload.service.sessionAffinityConfig }} + sessionAffinityConfig: +{{ toYaml .Values.secondaryWorkload.service.sessionAffinityConfig | indent 4 }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/test_values.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/test_values.yaml index 968c865d21..f8696e6e8c 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/test_values.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/test_values.yaml @@ -769,14 +769,235 @@ affinity: topologyKey: topology.kubernetes.io/zone secondaryWorkload: - enabled: false - postfix: "od" + enabled: true + postfix: "sec" # Default postfix for secondary workload resources + fullnameOverride: "" # Override the full name of secondary workload resources + + # Replica configuration replicaCount: 1 - affinity: {} - tolerations: [] + + # Deployment configuration + deploymentLabels: + environment: "production" + team: "backend" + component: "secondary" + + deploymentAnnotations: + deployment.kubernetes.io/revision: "1" + example.com/deployment-type: "secondary" + + # Pod configuration + podLabels: + workload: "secondary" + version: "v2" + + podAnnotations: + sidecar.istio.io/inject: "true" + prometheus.io/scrape: "true" + + # Custom match labels for deployment selector + customMatchLabels: + app: "my-secondary-app" + version: "v2" + + # Custom pod labels for service selector + customPodLabels: + app: "my-secondary-app" + tier: "backend" + + # Container configuration + containerName: "secondary-container" # Custom container name + ContainerPort: # Optional, inherits from primary if not specified + - name: http + port: 8080 + servicePort: 80 + targetPort: 8080 + - name: metrics + port: 9090 + servicePort: 9090 + + # Affinity and tolerations + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: workload + operator: In + values: + - primary + topologyKey: kubernetes.io/hostname + + tolerations: + - key: "secondary-workload" + operator: "Equal" + value: "true" + effect: "NoSchedule" + + # Autoscaling configuration autoscaling: enabled: true MinReplicas: 1 - MaxReplicas: 2 - TargetCPUUtilizationPercentage: 90 - TargetMemoryUtilizationPercentage: 80 \ No newline at end of file + MaxReplicas: 5 + TargetCPUUtilizationPercentage: 70 + TargetMemoryUtilizationPercentage: 80 + behavior: + scaleDown: + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 50 + periodSeconds: 60 + scaleUp: + stabilizationWindowSeconds: 60 + policies: + - type: Percent + value: 100 + periodSeconds: 15 + extraMetrics: + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 80 + + # KEDA Autoscaling configuration + kedaAutoscaling: + enabled: true + inherit: false # Set to true to inherit all KEDA config from primary workload + name: "secondary-workload-keda" + envSourceContainerName: "secondary-container" + cooldownPeriod: 300 + minReplicaCount: 1 + maxReplicaCount: 10 + idleReplicaCount: 0 + pollingInterval: 30 + labels: + keda.component: "secondary" + annotations: + keda.autoscaler: "custom" + fallback: + failureThreshold: 3 + replicas: 2 + advanced: + restoreToOriginalReplicaCount: true + horizontalPodAutoscalerConfig: + behavior: + scaleDown: + stabilizationWindowSeconds: 300 + triggers: + - type: prometheus + name: secondary_cpu_usage + metadata: + serverAddress: http://prometheus:9090 + metricName: cpu_usage_secondary + threshold: '70' + query: avg(cpu_usage{workload="secondary"}) + authenticationRef: + name: keda-trigger-auth-prometheus + triggerAuthentication: + enabled: true + name: "secondary-trigger-auth" + spec: + secretTargetRef: + - parameter: username + name: prometheus-secret + key: username + - parameter: password + name: prometheus-secret + key: password + + # Service configuration + service: + enabled: true + type: ClusterIP # Can be ClusterIP, NodePort, LoadBalancer + annotations: + service.beta.kubernetes.io/aws-load-balancer-type: "nlb" + example.com/service-type: "secondary" + extraSpec: + sessionAffinity: ClientIP + loadBalancerIP: "" # For LoadBalancer type + loadBalancerSourceRanges: [] # For LoadBalancer type + sessionAffinity: + enabled: true + sessionAffinityConfig: + clientIP: + timeoutSeconds: 10800 + + # Istio configuration + istio: + virtualService: + enabled: true + name: "secondary-workload-vs" + labels: + istio.component: "secondary" + annotations: + istio.io/description: "Secondary workload virtual service" + gateways: + - istio-system/secondary-gateway + hosts: + - "secondary-api.example.com" + - "api-v2.example.com" + http: + - match: + - uri: + prefix: "/api/v2" + - headers: + version: + exact: "v2" + route: + - destination: + host: "secondary-workload-service.default.svc.cluster.local" + port: + number: 80 + timeout: 30s + retries: + attempts: 3 + perTryTimeout: 10s + retryOn: "5xx,reset,connect-failure,refused-stream" + headers: + request: + set: + x-workload-version: "v2" + response: + set: + x-served-by: "secondary-workload" + + destinationRule: + enabled: true + name: "secondary-workload-dr" + labels: + istio.component: "secondary" + annotations: + istio.io/description: "Secondary workload destination rule" + subsets: + - name: v2 + labels: + version: v2 + - name: canary + labels: + track: canary + trafficPolicy: + loadBalancer: + simple: LEAST_CONN + connectionPool: + tcp: + maxConnections: 100 + http: + http1MaxPendingRequests: 50 + maxRequestsPerConnection: 10 + circuitBreaker: + consecutiveErrors: 3 + interval: 30s + baseEjectionTime: 30s + outlierDetection: + consecutive5xxErrors: 3 + interval: 30s + baseEjectionTime: 30s + + # User-friendly configuration fields + virtualServiceName: "my-secondary-vs" # Direct VirtualService name input + virtualServiceHosts: # Direct hosts input + - "secondary.myapp.com" + - "v2.myapp.com" \ No newline at end of file