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

VolumeMount not replace existing item by name #3131

Open
sergey-kudriavtsev opened this issue Dec 15, 2023 · 0 comments
Open

VolumeMount not replace existing item by name #3131

sergey-kudriavtsev opened this issue Dec 15, 2023 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@sergey-kudriavtsev
Copy link

sergey-kudriavtsev commented Dec 15, 2023

Bug Report

What did you do?
subscription-config
VolumeMount not replace existing item by name

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: minio
spec:
  channel: stable
  name: minio-operator
  source: redhat-certified-operators
  sourceNamespace: olm
  config:
    env:
    - name: OPERATOR_STS_ENABLED
      value: "off"
    - name: MINIO_OPERATOR_RUNTIME
      value: "Rancher"
    volumes:
      - name: tmp
        projected:
          defaultMode: 420
          sources:
            - secret:
                items:
                  - key: private.key
                    path: private.key
                  - key: public.crt
                    path: public.crt
                name: console-tls
                optional: true
    volumeMounts:
      - name: tmp
        mountPath: /tmp/certs

What did you expect to see?
OLM operator replace a mountPath in existing item by name

What did you see instead? Under which circumstances?
OLM operator trying to add new item with existing name

image

Environment

  • operator-lifecycle-manager version: 0.26.0
  • Kubernetes version information: 1.26
  • Kubernetes cluster kind: RKE2

Possible Solution
Suggested Method

func InjectVolumeMountsIntoDeployment(podSpec *corev1.PodSpec, volumeMounts []corev1.VolumeMount) error {
	if podSpec == nil {
		return errors.New("no pod spec provided")
	}

	for i := range podSpec.Containers {
		container := &podSpec.Containers[i]
		container.VolumeMounts = mergeVolumeMounts(container.VolumeMounts, volumeMounts)
	}

	return nil
}

Additional context
Original Manifest Minio Operator

@sergey-kudriavtsev sergey-kudriavtsev added the kind/bug Categorizes issue or PR as related to a bug. label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant