Skip to content

Commit

Permalink
feat: Enhancement for namespace installation mode configuration (argo…
Browse files Browse the repository at this point in the history
…proj#1939)

* feat: Enhancement for namespace installation mode configuration

* Update deprecation message

* rename to --namespaced

* support env as well

* tiny fi

* simplify it

* remove env support and rename to managed-namespace

* manifest fi
  • Loading branch information
whynowy authored Jan 14, 2020
1 parent 6af100d commit c51c130
Showing 5 changed files with 38 additions and 13 deletions.
25 changes: 24 additions & 1 deletion cmd/workflow-controller/main.go
Original file line number Diff line number Diff line change
@@ -3,10 +3,11 @@ package main
import (
"context"
"fmt"
"github.com/argoproj/argo/workflow/cron"
"os"
"time"

"github.com/argoproj/argo/workflow/cron"

"github.com/argoproj/pkg/cli"
kubecli "github.com/argoproj/pkg/kube/cli"
"github.com/argoproj/pkg/stats"
@@ -38,6 +39,8 @@ func NewRootCommand() *cobra.Command {
glogLevel int // --gloglevel
workflowWorkers int // --workflow-workers
podWorkers int // --pod-workers
namespaced bool // --namespaced
managedNamespace string // --managed-namespace
)

var command = cobra.Command{
@@ -70,6 +73,24 @@ func NewRootCommand() *cobra.Command {
if err != nil {
return err
}
// TODO: following code will be updated in next major release to remove configmap
// setting for namespace installation mode.
if len(wfController.Config.Namespace) > 0 {
fmt.Fprintf(os.Stderr, "\n------------------------ WARNING ------------------------\n")
fmt.Fprintf(os.Stderr, "Namespaced installation with configmap setting is deprecated, \n")
fmt.Fprintf(os.Stderr, "it will be removed in next major release. Instead please add \n")
fmt.Fprintf(os.Stderr, "\"--namespaced\" to workflow-controller start args.\n")
fmt.Fprintf(os.Stderr, "-----------------------------------------------------------------\n\n")
} else {
if namespaced {
if len(managedNamespace) > 0 {
wfController.Config.Namespace = managedNamespace
} else {
wfController.Config.Namespace = namespace
}
}
}
//

cronController := cron.NewCronController(wfclientset, config, namespace)

@@ -96,6 +117,8 @@ func NewRootCommand() *cobra.Command {
command.Flags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
command.Flags().IntVar(&workflowWorkers, "workflow-workers", 8, "Number of workflow workers")
command.Flags().IntVar(&podWorkers, "pod-workers", 8, "Number of pod workers")
command.Flags().BoolVar(&namespaced, "namespaced", false, "run workflow-controller as namespaced mode")
command.Flags().StringVar(&managedNamespace, "managed-namespace", "", "namespace that workflow-controller watches, default to the installation namespace")
return &command
}

5 changes: 1 addition & 4 deletions manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# This is an auto-generated file. DO NOT EDIT
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
@@ -197,9 +196,6 @@ subjects:
name: argo-ui
---
apiVersion: v1
data:
config: |
namespace: argo
kind: ConfigMap
metadata:
name: workflow-controller-configmap
@@ -266,6 +262,7 @@ spec:
- workflow-controller-configmap
- --executor-image
- argoproj/argoexec:latest
- --namespaced
command:
- workflow-controller
image: argoproj/workflow-controller:latest
9 changes: 8 additions & 1 deletion manifests/namespace-install/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -7,5 +7,12 @@ bases:
- ./argo-ui-rbac

patchesStrategicMerge:
- ./overlays/workflow-controller-configmap.yaml
- ./overlays/argo-ui-deployment.yaml

patchesJson6902:
- target:
version: v1
group: apps
kind: Deployment
name: workflow-controller
path: ./overlays/workflow-controller-deployment.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- op: add
path: /spec/template/spec/containers/0/args/-
value:
--namespaced

0 comments on commit c51c130

Please sign in to comment.