Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidecar and initContainer can't be generated by HELM in Cluster / Replication / Sentinel #176

Open
mrhovunping opened this issue Nov 28, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@mrhovunping
Copy link

Does this issue reproduce with the latest release?

Yes.

redis-cluster: 0.15.11
redis-replication: 0.15.11
redis-sentinel: 0.15.12

What operating system and processor architecture are you using (kubectl version)?

kubectl version Output
$ kubectl version
Client Version: v1.28.2

Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

Server Version: v1.21.9

WARNING: version difference between client (1.28) and server (1.21) exceeds the supported minor version skew of +/-1

What did you do?

Set SideCar
`

sidecars:
  - name: "redis-labeler-sidecar"
    image: "registry.gitlab.com/smartadserver/infra/containers/k8s-redis-labeler-sidecar/k8s-redis-labeler-sidecar:0.0.3"
    imagePullPolicy: "IfNotPresent"
    resources: {}
    env: 
      - name: LABEL_SELECTOR
        value: "role=replication,redis_setup_type=replication"
      - name: NAMESPACE
        valueFrom:
          fieldRef:
            fieldPath: metadata.namespace
      - name: LOG_LEVEL
        value: "debug"
      - name: POD_NAME
        valueFrom:
          fieldRef:
            fieldPath: metadata.name

What did you expect to see?
`
Expect to have a yml file generated with :

apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisReplication
metadata:
name: test
labels:
app.kubernetes.io/name: test
helm.sh/chart: redis-replication-0.15.11
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: test
app.kubernetes.io/version: 0.15.1
app.kubernetes.io/component: middleware
spec:
clusterSize: 3
kubernetesConfig:
image: "quay.io/opstree/redis:v7.0.12"
imagePullPolicy: "IfNotPresent"

redisExporter:
enabled: false
image: "quay.io/opstree/redis-exporter:v1.44.0"
imagePullPolicy: "IfNotPresent"
storage:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
podSecurityContext:
fsGroup: 1000
runAsUser: 1000
sidecars:

name: toto
image: registry.gitlab.com/smartadserver/infra/containers/k8s-redis-labeler-sidecar/k8s-redis-labeler-sidecar:0.0.3
imagePullPolicy: IfNotPresent
resources:
  
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 50m
    memory: 64Mi
env:

  - name: LABEL_SELECTOR
    value: role=replication,redis_setup_type=replication
  - name: NAMESPACE
    valueFrom:
      fieldRef:
        fieldPath: metadata.namespace
  - name: LOG_LEVEL
    value: debug
  - name: POD_NAME
    valueFrom:
      fieldRef:
        fieldPath: metadata.name

What did you see instead?

Error message:

Install.go:192: [debug] Original chart version: ""
install.go:209: [debug] CHART PATH: /home/sho/git/bug-165/charts/redis-replication


Error: template: redis-replication/templates/redis-replication.yaml:80:15: executing "redis-replication/templates/redis-replication.yaml" at <include>: wrong number of args for include: want 2 got 1
helm.go:84: [debug] template: redis-replication/templates/redis-replication.yaml:80:15: executing "redis-replication/templates/redis-replication.yaml" at <include>: wrong number of args for include: want 2 got 1

@mrhovunping mrhovunping added the bug Something isn't working label Nov 28, 2023
@mrhovunping
Copy link
Author

The problem comes from the code :

  {{- if and .Values.sidecars (ne .Values.sidecars.name "") (ne .Values.sidecars.image "") }}
  sidecars: {{ include "sidecar.properties" | nindent 4 }}
  {{- end }}

Where it should be

  {{- if and .Values.sidecars (ne .Values.sidecars.name "") (ne .Values.sidecars.image "") }}
  sidecars: {{ include "sidecar.properties ." | nindent 4 }}
  {{- end }}

Same problem found in redis-replication / redis-sentinel and redis-cluster with sidecars and initContainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant