From 912c6c016bc06528b3f0d7e1bf8d95bbc1b0036c Mon Sep 17 00:00:00 2001 From: Jonathan West Date: Mon, 5 Aug 2024 16:08:52 -0400 Subject: [PATCH] Move controllers back to controllers/ due to gitops-operator Signed-off-by: Jonathan West --- Dockerfile | 4 +- .../argoproj.io_rolloutmanagers.yaml | 59 +++++++++++++++++++ cmd/main.go | 2 +- .../argorollouts_controller.go | 0 .../argorollouts_controller_test.go | 0 .../controller => controllers}/configmap.go | 0 .../configmap_test.go | 0 .../controller => controllers}/default.go | 0 .../controller => controllers}/deployment.go | 0 .../deployment_test.go | 0 .../controller => controllers}/reconcile.go | 0 .../controller => controllers}/resources.go | 0 .../resources_test.go | 0 .../controller => controllers}/status.go | 0 .../controller => controllers}/status_test.go | 0 .../controller => controllers}/suite_test.go | 0 {internal/controller => controllers}/utils.go | 0 .../controller => controllers}/utils_test.go | 0 hack/upgrade-rollouts-script/main.go | 2 +- .../cluster_scoped_rollouts_test.go | 2 +- .../namespace_scoped_rollouts_test.go | 2 +- tests/e2e/rollout_tests_all.go | 2 +- tests/e2e/test_utils.go | 2 +- 23 files changed, 67 insertions(+), 8 deletions(-) rename {internal/controller => controllers}/argorollouts_controller.go (100%) rename {internal/controller => controllers}/argorollouts_controller_test.go (100%) rename {internal/controller => controllers}/configmap.go (100%) rename {internal/controller => controllers}/configmap_test.go (100%) rename {internal/controller => controllers}/default.go (100%) rename {internal/controller => controllers}/deployment.go (100%) rename {internal/controller => controllers}/deployment_test.go (100%) rename {internal/controller => controllers}/reconcile.go (100%) rename {internal/controller => controllers}/resources.go (100%) rename {internal/controller => controllers}/resources_test.go (100%) rename {internal/controller => controllers}/status.go (100%) rename {internal/controller => controllers}/status_test.go (100%) rename {internal/controller => controllers}/suite_test.go (100%) rename {internal/controller => controllers}/utils.go (100%) rename {internal/controller => controllers}/utils_test.go (100%) diff --git a/Dockerfile b/Dockerfile index ef4cfaf..1d67265 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.19 as builder +FROM golang:1.21 AS builder ARG TARGETOS ARG TARGETARCH @@ -14,7 +14,7 @@ RUN go mod download # Copy the go source COPY cmd/main.go cmd/main.go COPY api/ api/ -COPY internal/controller/ internal/controller/ +COPY controllers/ controllers/ # Build # the GOARCH has not a default value to allow the binary be built according to the host where the command diff --git a/bundle/manifests/argoproj.io_rolloutmanagers.yaml b/bundle/manifests/argoproj.io_rolloutmanagers.yaml index 7f54fe9..d399754 100644 --- a/bundle/manifests/argoproj.io_rolloutmanagers.yaml +++ b/bundle/manifests/argoproj.io_rolloutmanagers.yaml @@ -53,6 +53,61 @@ spec: description: Labels to add to the resources during its creation. type: object type: object + controllerResources: + description: Resources requests/limits for Argo Rollout controller + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object env: description: Env lets you specify environment for Rollouts pods items: @@ -231,6 +286,10 @@ spec: type: object type: array type: object + skipNotificationSecretDeployment: + description: SkipNotificationSecretDeployment lets you specify if + the argo notification secret should be deployed + type: boolean version: description: Version defines Argo Rollouts controller tag (optional) type: string diff --git a/cmd/main.go b/cmd/main.go index a03fc5e..81329e1 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -36,7 +36,7 @@ import ( rolloutsmanagerv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1" - controllers "github.com/argoproj-labs/argo-rollouts-manager/internal/controller" + controllers "github.com/argoproj-labs/argo-rollouts-manager/controllers" monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" //+kubebuilder:scaffold:imports diff --git a/internal/controller/argorollouts_controller.go b/controllers/argorollouts_controller.go similarity index 100% rename from internal/controller/argorollouts_controller.go rename to controllers/argorollouts_controller.go diff --git a/internal/controller/argorollouts_controller_test.go b/controllers/argorollouts_controller_test.go similarity index 100% rename from internal/controller/argorollouts_controller_test.go rename to controllers/argorollouts_controller_test.go diff --git a/internal/controller/configmap.go b/controllers/configmap.go similarity index 100% rename from internal/controller/configmap.go rename to controllers/configmap.go diff --git a/internal/controller/configmap_test.go b/controllers/configmap_test.go similarity index 100% rename from internal/controller/configmap_test.go rename to controllers/configmap_test.go diff --git a/internal/controller/default.go b/controllers/default.go similarity index 100% rename from internal/controller/default.go rename to controllers/default.go diff --git a/internal/controller/deployment.go b/controllers/deployment.go similarity index 100% rename from internal/controller/deployment.go rename to controllers/deployment.go diff --git a/internal/controller/deployment_test.go b/controllers/deployment_test.go similarity index 100% rename from internal/controller/deployment_test.go rename to controllers/deployment_test.go diff --git a/internal/controller/reconcile.go b/controllers/reconcile.go similarity index 100% rename from internal/controller/reconcile.go rename to controllers/reconcile.go diff --git a/internal/controller/resources.go b/controllers/resources.go similarity index 100% rename from internal/controller/resources.go rename to controllers/resources.go diff --git a/internal/controller/resources_test.go b/controllers/resources_test.go similarity index 100% rename from internal/controller/resources_test.go rename to controllers/resources_test.go diff --git a/internal/controller/status.go b/controllers/status.go similarity index 100% rename from internal/controller/status.go rename to controllers/status.go diff --git a/internal/controller/status_test.go b/controllers/status_test.go similarity index 100% rename from internal/controller/status_test.go rename to controllers/status_test.go diff --git a/internal/controller/suite_test.go b/controllers/suite_test.go similarity index 100% rename from internal/controller/suite_test.go rename to controllers/suite_test.go diff --git a/internal/controller/utils.go b/controllers/utils.go similarity index 100% rename from internal/controller/utils.go rename to controllers/utils.go diff --git a/internal/controller/utils_test.go b/controllers/utils_test.go similarity index 100% rename from internal/controller/utils_test.go rename to controllers/utils_test.go diff --git a/hack/upgrade-rollouts-script/main.go b/hack/upgrade-rollouts-script/main.go index 7e86e4d..051e553 100644 --- a/hack/upgrade-rollouts-script/main.go +++ b/hack/upgrade-rollouts-script/main.go @@ -36,7 +36,7 @@ const ( argoprojlabsRepoOrg = "argoproj-labs" argoRolloutsManagerRepoName = "argo-rollouts-manager" - controllersDefaultGo = "internal/controller/default.go" + controllersDefaultGo = "controllers/default.go" ) func main() { diff --git a/tests/e2e/cluster-scoped/cluster_scoped_rollouts_test.go b/tests/e2e/cluster-scoped/cluster_scoped_rollouts_test.go index d62c676..77f5624 100644 --- a/tests/e2e/cluster-scoped/cluster_scoped_rollouts_test.go +++ b/tests/e2e/cluster-scoped/cluster_scoped_rollouts_test.go @@ -15,7 +15,7 @@ import ( rmv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1" - controllers "github.com/argoproj-labs/argo-rollouts-manager/internal/controller" + controllers "github.com/argoproj-labs/argo-rollouts-manager/controllers" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/tests/e2e/namespace-scoped/namespace_scoped_rollouts_test.go b/tests/e2e/namespace-scoped/namespace_scoped_rollouts_test.go index feb45b8..4a90857 100644 --- a/tests/e2e/namespace-scoped/namespace_scoped_rollouts_test.go +++ b/tests/e2e/namespace-scoped/namespace_scoped_rollouts_test.go @@ -17,7 +17,7 @@ import ( rmv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1" - controllers "github.com/argoproj-labs/argo-rollouts-manager/internal/controller" + controllers "github.com/argoproj-labs/argo-rollouts-manager/controllers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/tests/e2e/rollout_tests_all.go b/tests/e2e/rollout_tests_all.go index 4cf7240..8b985db 100644 --- a/tests/e2e/rollout_tests_all.go +++ b/tests/e2e/rollout_tests_all.go @@ -17,7 +17,7 @@ import ( rolloutsmanagerv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1" - controllers "github.com/argoproj-labs/argo-rollouts-manager/internal/controller" + controllers "github.com/argoproj-labs/argo-rollouts-manager/controllers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" diff --git a/tests/e2e/test_utils.go b/tests/e2e/test_utils.go index 5d0c20a..5e533f7 100644 --- a/tests/e2e/test_utils.go +++ b/tests/e2e/test_utils.go @@ -16,7 +16,7 @@ import ( rmv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1" - controllers "github.com/argoproj-labs/argo-rollouts-manager/internal/controller" + controllers "github.com/argoproj-labs/argo-rollouts-manager/controllers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1"