Skip to content

Commit

Permalink
Merge branch 'master' into arm
Browse files Browse the repository at this point in the history
  • Loading branch information
lwj5 committed Jul 21, 2024
2 parents 7919108 + a9218b8 commit 73d85db
Show file tree
Hide file tree
Showing 49 changed files with 175 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
set -o pipefail
make install generate fmt vet
# Use tee to flush output to the log. Other solutions like stdbuf don't work, not sure why.
REDIS_CONFIG_PATH="build/redis" go run ./main.go 2>&1 | tee /tmp/e2e-operator-run.log &
REDIS_CONFIG_PATH="build/redis" go run ./cmd/main.go 2>&1 | tee /tmp/e2e-operator-run.log &
- name: Run tests
run: |
set -o pipefail
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ COPY go.sum go.sum
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY cmd/main.go cmd/main.go
COPY api/ api/
COPY common/ common/
COPY controllers/ controllers/
COPY version/ version/

# Build
ARG LD_FLAGS
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="$LD_FLAGS" -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="$LD_FLAGS" -a -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# Set the Operator SDK version to use.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.32.0
OPERATOR_SDK_VERSION ?= v1.35.0


# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
Expand Down Expand Up @@ -104,10 +104,10 @@ test: manifests generate fmt vet envtest ## Run tests.
##@ Build

build: generate fmt vet ## Build manager binary.
go build -ldflags=$(LD_FLAGS) -o bin/manager main.go
go build -ldflags=$(LD_FLAGS) -o bin/manager cmd/main.go

run: manifests generate fmt vet ## Run a controller from your host.
REDIS_CONFIG_PATH="build/redis" go run -ldflags=$(LD_FLAGS) ./main.go
REDIS_CONFIG_PATH="build/redis" go run -ldflags=$(LD_FLAGS) ./cmd/main.go

docker-build: test ## Build docker image with the manager.
$(CONTAINER_RUNTIME) build --build-arg LD_FLAGS=$(LD_FLAGS) -t ${IMG} .
Expand Down
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
layout:
- go.kubebuilder.io/v3
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
Expand Down
4 changes: 2 additions & 2 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=argocd-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.35.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
Expand Down
8 changes: 4 additions & 4 deletions bundle/manifests/argocd-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ metadata:
capabilities: Deep Insights
categories: Integration & Delivery
certified: "false"
createdAt: "2024-07-10T07:02:10Z"
createdAt: "2024-07-16T05:45:52Z"
description: Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
operators.operatorframework.io/builder: operator-sdk-v1.35.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
repository: https://github.com/argoproj-labs/argocd-operator
support: Argo CD
name: argocd-operator.v0.10.1
Expand Down Expand Up @@ -1669,7 +1669,7 @@ spec:
```
See the [documentation](https://argocd-operator.readthedocs.io) and examples on
[github](https://github.com/argoproj-labs/argocd-operator) for more information.
[GitHub](https://github.com/argoproj-labs/argocd-operator) for more information.
displayName: Argo CD
icon:
- base64data: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+Cjxzdmcgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDIzIDMwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zOnNlcmlmPSJodHRwOi8vd3d3LnNlcmlmLmNvbS8iIHN0eWxlPSJmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLW1pdGVybGltaXQ6MjsiPgogICAgPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwtOS4yLC03KSI+CiAgICAgICAgPGc+CiAgICAgICAgICA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ICAgICAgICAgICAgICAgPGc+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8Zz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8Zz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGNpcmNsZSBjeD0iMjQuMiIgY3k9IjE5LjMiIHI9IjMuMSIgc3R5bGU9ImZpbGw6cmdiKDIzMywxMDEsNzUpOyIvPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8Y2lyY2xlIGN4PSIxNy4yIiBjeT0iMTkuMyIgcj0iMy4xIiBzdHlsZT0iZmlsbDpyZ2IoMjMzLDEwMSw3NSk7Ii8+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxnPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8Y2lyY2xlIGN4PSIyNC4yIiBjeT0iMTkuMyIgcj0iMi40IiBzdHlsZT0iZmlsbDp3aGl0ZTsiLz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGNpcmNsZSBjeD0iMTciIGN5PSIxOS4zIiByPSIyLjQiIHN0eWxlPSJmaWxsOndoaXRlOyIvPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxnPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxjaXJjbGUgY3g9IjE3IiBjeT0iMTkiIHI9IjAuNyIgc3R5bGU9ImZpbGw6cmdiKDEsMSwxKTsiLz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8Y2lyY2xlIGN4PSIyNC4yIiBjeT0iMTkiIHI9IjAuNyIgc3R5bGU9ImZpbGw6cmdiKDEsMSwxKTsiLz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgIC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43QzE0LjEsMjIuOCAxNC4xLDIzLjEgMTMuOSwyMy4yQzEzLjgsMjMuMyAxMy44LDIzLjMgMTMuNywyMy4zWiIgc3R5bGU9ImZpbGw6d2hpdGU7ZmlsbC1ydWxlOm5vbnplcm87Ii8+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjUuMiwyOEwyNS4yLDI3LjJDMjMuOCwyOCAyMi4zLDI4LjggMjAuNSwyOC44QzE4LjUsMjguOCAxNy4yLDI3LjkgMTUuOSwyNy4yTDE2LDI4QzE2LDI4IDE3LjUsMjkuNiAyMC42LDI5LjZDMjMuNSwyOS41IDI1LjIsMjggMjUuMiwyOFoiIHN0eWxlPSJmaWxsOnJnYigyMzMsMTAxLDc1KTtmaWxsLW9wYWNpdHk6MC4yNTtmaWxsLXJ1bGU6bm9uemVybzsiLz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==
Expand Down
4 changes: 2 additions & 2 deletions bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ annotations:
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: argocd-operator
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
operators.operatorframework.io.metrics.builder: operator-sdk-v1.35.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v4

# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion config/manifests/patches/description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
```
See the [documentation](https://argocd-operator.readthedocs.io) and examples on
[github](https://github.com/argoproj-labs/argocd-operator) for more information.
[GitHub](https://github.com/argoproj-labs/argocd-operator) for more information.
38 changes: 28 additions & 10 deletions controllers/argocd/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,15 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor
deploy.Spec.Template.Spec.InitContainers = append(deploy.Spec.Template.Spec.InitContainers, cr.Spec.Repo.InitContainers...)
}

// If the user has specified a custom volume mount that overrides the existing /tmp mount, then we should use the user's custom mount, rather than the default.
volumeMountOverridesTmpVolume := false
for _, volumeMount := range cr.Spec.Repo.VolumeMounts {
if volumeMount.MountPath == "/tmp" {
volumeMountOverridesTmpVolume = true
break
}
}

repoServerVolumeMounts := []corev1.VolumeMount{
{
Name: "ssh-known-hosts",
Expand All @@ -912,10 +921,6 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor
Name: "gpg-keyring",
MountPath: "/app/config/gpg/keys",
},
{
Name: "tmp",
MountPath: "/tmp",
},
{
Name: "argocd-repo-server-tls",
MountPath: "/app/config/reposerver/tls",
Expand All @@ -930,6 +935,15 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor
},
}

if !volumeMountOverridesTmpVolume {

repoServerVolumeMounts = append(repoServerVolumeMounts, corev1.VolumeMount{
Name: "tmp",
MountPath: "/tmp",
})

}

if cr.Spec.Repo.VolumeMounts != nil {
repoServerVolumeMounts = append(repoServerVolumeMounts, cr.Spec.Repo.VolumeMounts...)
}
Expand Down Expand Up @@ -1024,12 +1038,6 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
{
Name: "tmp",
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
{
Name: "argocd-repo-server-tls",
VolumeSource: corev1.VolumeSource{
Expand Down Expand Up @@ -1062,6 +1070,16 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoproj.ArgoCD, useTLSFor
},
}

// If the user is not used a custom /tmp mount, then just use the default
if !volumeMountOverridesTmpVolume {
repoServerVolumes = append(repoServerVolumes, corev1.Volume{
Name: "tmp",
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
})
}

if cr.Spec.Repo.Volumes != nil {
repoServerVolumes = append(repoServerVolumes, cr.Spec.Repo.Volumes...)
}
Expand Down
78 changes: 71 additions & 7 deletions controllers/argocd/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,70 @@ func TestReconcileArgoCD_reconcileRepoDeployment_mounts(t *testing.T) {
assert.NoError(t, err)
assert.Contains(t, deployment.Spec.Template.Spec.Containers[0].VolumeMounts, testMount)
})

t.Run("Add extra volume mount and volume that override default /tmp volume mount and volume", func(t *testing.T) {
testMount := corev1.VolumeMount{
Name: "test-mount",
MountPath: "/tmp",
}

logf.SetLogger(ZapLogger(true))
a := makeTestArgoCD(func(a *argoproj.ArgoCD) {
a.Spec.Repo.VolumeMounts = []corev1.VolumeMount{testMount}
a.Spec.Repo.Volumes = []corev1.Volume{{Name: "test-mount"}}
})

resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

err := r.reconcileRepoDeployment(a, false)
assert.NoError(t, err)

deployment := &appsv1.Deployment{}
err = r.Client.Get(context.TODO(), types.NamespacedName{
Name: "argocd-repo-server",
Namespace: testNamespace,
}, deployment)
assert.NoError(t, err)

assert.Len(t, deployment.Spec.Template.Spec.Containers, 1)

container := deployment.Spec.Template.Spec.Containers[0]

containsTestMount := false
containsDefaultMount := false

for _, volumeMount := range container.VolumeMounts {

if volumeMount.Name == testMount.Name {
containsTestMount = true
} else if volumeMount.MountPath == "/tmp" {
containsDefaultMount = true
}
}

assert.True(t, containsTestMount, "should contain test-mount volume mount")
assert.False(t, containsDefaultMount, "should not contain the default mount, since this is being overriden by the test-mount")

containsTestMountVolume := false
containsDefaultVolume := false
for _, volume := range deployment.Spec.Template.Spec.Volumes {
if volume.Name == "test-mount" {
containsTestMountVolume = true
}
if volume.Name == "tmp" {
containsDefaultVolume = true
}
}

assert.True(t, containsTestMountVolume, "should contain test-mount molume")
assert.False(t, containsDefaultVolume, "should not contain default tmp volume")

})
}

func TestReconcileArgoCD_reconcileRepoDeployment_initContainers(t *testing.T) {
Expand Down Expand Up @@ -1776,12 +1840,6 @@ func repoServerDefaultVolumes() []corev1.Volume {
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
{
Name: "tmp",
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
{
Name: "argocd-repo-server-tls",
VolumeSource: corev1.VolumeSource{
Expand Down Expand Up @@ -1812,6 +1870,12 @@ func repoServerDefaultVolumes() []corev1.Volume {
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
{
Name: "tmp",
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
}
return volumes
}
Expand All @@ -1823,10 +1887,10 @@ func repoServerDefaultVolumeMounts() []corev1.VolumeMount {
{Name: "tls-certs", MountPath: "/app/config/tls"},
{Name: "gpg-keys", MountPath: "/app/config/gpg/source"},
{Name: "gpg-keyring", MountPath: "/app/config/gpg/keys"},
{Name: "tmp", MountPath: "/tmp"},
{Name: "argocd-repo-server-tls", MountPath: "/app/config/reposerver/tls"},
{Name: common.ArgoCDRedisServerTLSSecretName, MountPath: "/app/config/reposerver/tls/redis"},
{Name: "plugins", MountPath: "/home/argocd/cmp-server/plugins"},
{Name: "tmp", MountPath: "/tmp"},
}
return mounts
}
Expand Down
3 changes: 1 addition & 2 deletions controllers/argocd/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
Expand Down Expand Up @@ -79,7 +78,7 @@ func (r *ReconcileArgoCD) reconcileNotificationsController(cr *argoproj.ArgoCD)
func (r *ReconcileArgoCD) reconcileNotificationsConfigurationCR(cr *argoproj.ArgoCD) error {

defaultNotificationsConfigurationCR := &v1alpha1.NotificationsConfiguration{
ObjectMeta: metav1.ObjectMeta{
ObjectMeta: v1.ObjectMeta{
Name: DefaultNotificationsConfigurationInstanceName,
Namespace: cr.Namespace,
},
Expand Down
3 changes: 2 additions & 1 deletion controllers/argocd/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"crypto/sha256"
"fmt"
argopass "github.com/argoproj/argo-cd/v2/util/password"
"reflect"
"sort"
"testing"

argopass "github.com/argoproj/argo-cd/v2/util/password"

configv1 "github.com/openshift/api/config/v1"
routev1 "github.com/openshift/api/route/v1"
"github.com/stretchr/testify/assert"
Expand Down
Loading

0 comments on commit 73d85db

Please sign in to comment.