Skip to content

Commit

Permalink
Merge branch 'temp-metric' of https://github.com/dpadhiar/argo-workflows
Browse files Browse the repository at this point in the history
 into temp-metric

Signed-off-by: Dillen Padhiar <[email protected]>
  • Loading branch information
dpadhiar committed Jun 17, 2024
2 parents 164a289 + 848abaf commit 750dfb6
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 629 deletions.
14 changes: 7 additions & 7 deletions docs/argo-server-auth-mode.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Argo Server Auth Mode

You can choose which kube config the Argo Server uses:
You can configure how the Argo Server authenticates to Kubernetes:

* `server` - in hosted mode, use the kube config of service account, in local mode, use your local kube config.
* `client` - requires clients to provide their Kubernetes bearer token and use that.
* [`sso`](./argo-server-sso.md) - since v2.9, use single sign-on, this will use the same service account as per "server" for RBAC. We expect to change this in the future so that the OAuth claims are mapped to service accounts.
* `server`: In [hosted mode](argo-server.md#hosted-mode), use the Server's Service Account. In [local mode](argo-server.md#local-mode), use your local kube config.
* `client`: Use the Kubernetes [bearer token of clients](access-token.md).
* `sso`: Use [single sign-on](argo-server-sso.md). This will use the same SA as `server` for RBAC, unless you have enabled [SSO RBAC](argo-server-sso.md#sso-rbac)

The server used to start with auth mode of "server" by default, but since v3.0 it defaults to the "client".
For v3.0 and after, the default is `client`. Prior to v3.0, it was `server`.

To change the server auth mode specify the list as multiple auth-mode flags:
To configure the Server's auth modes, use one or multiple `--auth-mode` flags. For example:

```bash
argo server --auth-mode=sso --auth-mode=...
argo server --auth-mode=sso --auth-mode=client
```
22 changes: 22 additions & 0 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ Workflow is the definition of a workflow resource

- [`exit-handlers.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handlers.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -565,6 +567,8 @@ WorkflowSpec is the specification of a Workflow.

- [`exit-handlers.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handlers.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -1004,6 +1008,8 @@ CronWorkflowSpec is the specification of a CronWorkflow

- [`exit-handlers.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handlers.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -1333,6 +1339,8 @@ Arguments to a template

- [`exit-handler-with-param.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-param.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -2131,6 +2139,8 @@ Parameter indicate a passed string parameter to a service template with an optio

- [`exit-handler-with-param.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-param.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -2677,6 +2687,8 @@ Inputs are the mechanism for passing parameters, artifacts, volumes from one tem

- [`exit-handler-with-param.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-param.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -2878,6 +2890,8 @@ ScriptTemplate is a template subtype to enable scripting through code steps

- [`exit-handler-with-param.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-param.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -3909,6 +3923,8 @@ DataSource sources external data into a data template

- [`exit-handler-with-param.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-param.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -4659,6 +4675,8 @@ ObjectMeta is metadata that all persisted resources must have, which includes al

- [`exit-handlers.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handlers.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -5572,6 +5590,8 @@ EnvVar represents an environment variable present in a Container.

- [`colored-logs.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/colored-logs.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down Expand Up @@ -5990,6 +6010,8 @@ PersistentVolumeClaimSpec describes the common attributes of storage devices and

- [`exit-handlers.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handlers.yaml)

- [`expression-destructure-json-complex.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json-complex.yaml)

- [`expression-destructure-json.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-destructure-json.yaml)

- [`expression-reusing-verbose-snippets.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/expression-reusing-verbose-snippets.yaml)
Expand Down
36 changes: 36 additions & 0 deletions examples/expression-destructure-json-complex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: expression-destructure-json-complex-
spec:
arguments:
parameters:
- name: config
value: '{"employees": [{"name": "Baris", "age":43},{"name": "Mo", "age": 42}, {"name": "Jai", "age" :44}]}'
entrypoint: main
templates:
- name: main
inputs:
parameters:
- name: a
value: "{{=jsonpath(workflow.parameters.config, '$.employees[?(@.name==\"Baris\")].age')}}"
- name: b
value: "{{=jsonpath(workflow.parameters.config, '$.employees[?(@.age>42 && @.age<44)].age')}}"
- name: c
value: "{{=jsonpath(workflow.parameters.config, '$.employees[0:1]')}}"
- name: d
value: "{{=jsonpath(workflow.parameters.config, '$.employees[*].name')}}"
script:
env:
- name: A
value: "{{inputs.parameters.a}}"
- name: B
value: "{{inputs.parameters.b}}"
- name: C
value: "{{inputs.parameters.c}}"
- name: D
value: "{{inputs.parameters.d}}"
image: debian:9.4
command: [bash]
source: |
echo "$A$B$C$D"
15 changes: 15 additions & 0 deletions server/workflow/store/sqlite_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"sync"

log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -73,6 +74,7 @@ type WorkflowStore interface {
type SQLiteStore struct {
conn *sqlite.Conn
instanceService instanceid.Service
mtx sync.Mutex
}

var _ WorkflowStore = &SQLiteStore{}
Expand Down Expand Up @@ -102,6 +104,8 @@ where instanceid = ?
}

var workflows = wfv1.Workflows{}
s.mtx.Lock()
defer s.mtx.Unlock()
err = sqlitex.Execute(s.conn, query, &sqlitex.ExecOptions{
Args: args,
ResultFunc: func(stmt *sqlite.Stmt) error {
Expand Down Expand Up @@ -143,6 +147,8 @@ where instanceid = ?
}

var total int64
s.mtx.Lock()
defer s.mtx.Unlock()
err = sqlitex.Execute(s.conn, query, &sqlitex.ExecOptions{
Args: args,
ResultFunc: func(stmt *sqlite.Stmt) error {
Expand All @@ -161,6 +167,8 @@ func (s *SQLiteStore) Add(obj interface{}) error {
if !ok {
return fmt.Errorf("unable to convert object to Workflow. object: %v", obj)
}
s.mtx.Lock()
defer s.mtx.Unlock()
done := sqlitex.Transaction(s.conn)
err := s.upsertWorkflow(wf)
defer done(&err)
Expand All @@ -172,6 +180,8 @@ func (s *SQLiteStore) Update(obj interface{}) error {
if !ok {
return fmt.Errorf("unable to convert object to Workflow. object: %v", obj)
}
s.mtx.Lock()
defer s.mtx.Unlock()
done := sqlitex.Transaction(s.conn)
err := s.upsertWorkflow(wf)
defer done(&err)
Expand All @@ -183,6 +193,8 @@ func (s *SQLiteStore) Delete(obj interface{}) error {
if !ok {
return fmt.Errorf("unable to convert object to Workflow. object: %v", obj)
}
s.mtx.Lock()
defer s.mtx.Unlock()
return sqlitex.Execute(s.conn, deleteWorkflowQuery, &sqlitex.ExecOptions{Args: []any{string(wf.UID)}})
}

Expand All @@ -195,6 +207,8 @@ func (s *SQLiteStore) Replace(list []interface{}, resourceVersion string) error
}
wfs = append(wfs, wf)
}
s.mtx.Lock()
defer s.mtx.Unlock()
done := sqlitex.Transaction(s.conn)
err := s.replaceWorkflows(wfs)
defer done(&err)
Expand Down Expand Up @@ -222,6 +236,7 @@ func (s *SQLiteStore) GetByKey(key string) (item interface{}, exists bool, err e
}

func (s *SQLiteStore) upsertWorkflow(wf *wfv1.Workflow) error {
// Called with the mutex
err := sqlitex.Execute(s.conn, deleteWorkflowQuery, &sqlitex.ExecOptions{Args: []any{string(wf.UID)}})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"node": ">=20"
},
"dependencies": {
"argo-ui": "git+https://github.com/argoproj/argo-ui.git#741f07c28b446f432e0a46ff47cadc841883887c",
"argo-ui": "git+https://github.com/argoproj/argo-ui.git#6de6bfedc0ec0625122dd5162371fc1932f8d428",
"chart.js": "^2.9.4",
"chartjs-plugin-annotation": "^0.5.7",
"classnames": "^2.5.1",
Expand Down
Loading

0 comments on commit 750dfb6

Please sign in to comment.