Skip to content

Commit

Permalink
simplify oss artificts oidc provider configuration for rrsa
Browse files Browse the repository at this point in the history
  • Loading branch information
DahuK committed Jul 28, 2023
1 parent 1e6a724 commit 1ea96a4
Show file tree
Hide file tree
Showing 38 changed files with 801 additions and 2,415 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ $(GOPATH)/bin/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.52.2

.PHONY: lint
lint: server/static/files.go $(GOPATH)/bin/golangci-lint
lint: server/static/files.go
rm -Rf v3 vendor
# If you're using `woc.wf.Spec` or `woc.execWf.Status` your code probably won't work with WorkflowTemplate.
# * Change `woc.wf.Spec` to `woc.execWf.Spec`.
Expand Down Expand Up @@ -653,7 +653,7 @@ docs-lint: /usr/local/bin/markdownlint
markdownlint docs --fix --ignore docs/fields.md --ignore docs/executor_swagger.md --ignore docs/swagger.md --ignore docs/cli --ignore docs/walk-through/the-structure-of-workflow-specs.md

/usr/local/bin/mkdocs:
python -m pip install mkdocs==1.2.4 mkdocs_material==8.1.9 mkdocs-spellcheck==0.2.1 # update this in Nix when upgrading it here
pip3 install mkdocs==1.2.4 mkdocs_material==8.1.9 mkdocs-spellcheck==0.2.1 # update this in Nix when upgrading it here


.PHONY: docs
Expand Down
24 changes: 0 additions & 24 deletions api/jsonschema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions docs/configure-artifact-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,51 @@ $ k apply -f default-artifact-repository.yaml -n demo

You can also set `createBucketIfNotPresent` to `true` to tell the artifact driver to automatically create the OSS bucket if it doesn't exist yet when saving artifacts. Note that you'll need to set additional permission for your OSS account to create new buckets.

### Alibaba Cloud OSS RRSA

If you wish to use OSS RRSA instead of passing in an `accessKey` and `secretKey`, you need to perform the following actions:

- Install [pod-identity-webhook](https://www.alibabacloud.com/help/en/ack/product-overview/ack-pod-identity-webhook) in your cluster to automatically inject the OIDC tokens and environment variables.
- Add the label `pod-identity.alibabacloud.com/injection: 'on'` to the target workflow namespace.
- Add the annotation `pod-identity.alibabacloud.com/role-name: $your_ram_role_name` to the service account of running workflow.
- Set `useSDKCreds: true` in your target artifact repository cm and remove the secret references to AK/SK.

```yaml

apiVersion: v1
kind: Namespace
metadata:
name: my-ns
labels:
pod-identity.alibabacloud.com/injection: 'on'

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-sa
namespace: rrsa-demo
annotations:
pod-identity.alibabacloud.com/role-name: $your_ram_role_name

---
apiVersion: v1
kind: ConfigMap
metadata:
# If you want to use this config map by default, name it "artifact-repositories". Otherwise, you can provide a reference to a
# different config map in `artifactRepositoryRef.configMap`.
name: artifact-repositories
annotations:
# v3.0 and after - if you want to use a specific key, put that key into this annotation.
workflows.argoproj.io/default-artifact-repository: default-oss-artifact-repository
data:
default-oss-artifact-repository: |
oss:
endpoint: http://oss-cn-zhangjiakou-internal.aliyuncs.com
bucket: $mybucket
useSDKCreds: true
```
## Configuring Azure Blob Storage
Create an Azure Storage account and a container within that account. There are a number of
Expand Down
3 changes: 0 additions & 3 deletions docs/executor_swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -2707,15 +2707,12 @@ save/load the directory appropriately.

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| OidcProviderARN | string| `string` | | | OidcProviderARN is the Alibaba Cloud Resource Name (ARN) of the OIDC IdP. | |
| OidcTokenFile | string| `string` | | | OidcTokenFile is the file path of the OIDC token. | |
| accessKeySecret | [SecretKeySelector](#secret-key-selector)| `SecretKeySelector` | | | | |
| bucket | string| `string` | | | Bucket is the name of the bucket | |
| createBucketIfNotPresent | boolean| `bool` | | | CreateBucketIfNotPresent tells the driver to attempt to create the OSS bucket for output artifacts, if it doesn't exist | |
| endpoint | string| `string` | | | Endpoint is the hostname of the bucket endpoint | |
| key | string| `string` | | | Key is the path in the bucket where the artifact resides | |
| lifecycleRule | [OSSLifecycleRule](#o-s-s-lifecycle-rule)| `OSSLifecycleRule` | | | | |
| roleARN | string| `string` | | | RoleARN is the Alibaba Cloud Resource Name(ARN) of the role to assume. | |
| secretKeySecret | [SecretKeySelector](#secret-key-selector)| `SecretKeySelector` | | | | |
| securityToken | string| `string` | | | SecurityToken is the user's temporary security token. For more details, check out: https://www.alibabacloud.com/help/doc-detail/100624.htm | |
| useSDKCreds | boolean| `bool` | | | UseSDKCreds tells the driver to figure out credentials based on sdk defaults. | |
Expand Down
6 changes: 0 additions & 6 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -3450,15 +3450,12 @@ OSSArtifact is the location of an Alibaba Cloud OSS artifact
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`OidcProviderARN`|`string`|OidcProviderARN is the Alibaba Cloud Resource Name (ARN) of the OIDC IdP.|
|`OidcTokenFile`|`string`|OidcTokenFile is the file path of the OIDC token.|
|`accessKeySecret`|[`SecretKeySelector`](#secretkeyselector)|AccessKeySecret is the secret selector to the bucket's access key|
|`bucket`|`string`|Bucket is the name of the bucket|
|`createBucketIfNotPresent`|`boolean`|CreateBucketIfNotPresent tells the driver to attempt to create the OSS bucket for output artifacts, if it doesn't exist|
|`endpoint`|`string`|Endpoint is the hostname of the bucket endpoint|
|`key`|`string`|Key is the path in the bucket where the artifact resides|
|`lifecycleRule`|[`OSSLifecycleRule`](#osslifecyclerule)|LifecycleRule specifies how to manage bucket's lifecycle|
|`roleARN`|`string`|RoleARN is the Alibaba Cloud Resource Name(ARN) of the role to assume.|
|`secretKeySecret`|[`SecretKeySelector`](#secretkeyselector)|SecretKeySecret is the secret selector to the bucket's secret key|
|`securityToken`|`string`|SecurityToken is the user's temporary security token. For more details, check out: https://www.alibabacloud.com/help/doc-detail/100624.htm|
|`useSDKCreds`|`boolean`|UseSDKCreds tells the driver to figure out credentials based on sdk defaults.|
Expand Down Expand Up @@ -4196,15 +4193,12 @@ OSSArtifactRepository defines the controller configuration for an OSS artifact r
### Fields
| Field Name | Field Type | Description |
|:----------:|:----------:|---------------|
|`OidcProviderARN`|`string`|OidcProviderARN is the Alibaba Cloud Resource Name (ARN) of the OIDC IdP.|
|`OidcTokenFile`|`string`|OidcTokenFile is the file path of the OIDC token.|
|`accessKeySecret`|[`SecretKeySelector`](#secretkeyselector)|AccessKeySecret is the secret selector to the bucket's access key|
|`bucket`|`string`|Bucket is the name of the bucket|
|`createBucketIfNotPresent`|`boolean`|CreateBucketIfNotPresent tells the driver to attempt to create the OSS bucket for output artifacts, if it doesn't exist|
|`endpoint`|`string`|Endpoint is the hostname of the bucket endpoint|
|`keyFormat`|`string`|KeyFormat is defines the format of how to store keys. Can reference workflow variables|
|`lifecycleRule`|[`OSSLifecycleRule`](#osslifecyclerule)|LifecycleRule specifies how to manage bucket's lifecycle|
|`roleARN`|`string`|RoleARN is the Alibaba Cloud Resource Name(ARN) of the role to assume.|
|`secretKeySecret`|[`SecretKeySelector`](#secretkeyselector)|SecretKeySecret is the secret selector to the bucket's secret key|
|`securityToken`|`string`|SecurityToken is the user's temporary security token. For more details, check out: https://www.alibabacloud.com/help/doc-detail/100624.htm|
|`useSDKCreds`|`boolean`|UseSDKCreds tells the driver to figure out credentials based on sdk defaults.|
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ require (
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible
github.com/Masterminds/sprig/v3 v3.2.3
github.com/TwiN/go-color v1.4.0
github.com/alibabacloud-go/tea v1.2.1
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/aliyun/credentials-go v1.3.1
github.com/antonmedv/expr v1.12.7
github.com/argoproj/argo-events v1.7.3
github.com/argoproj/pkg v0.13.6
Expand Down Expand Up @@ -75,6 +77,7 @@ require (
)

require (
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/google/s2a-go v0.1.4 // indirect
google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230720185612-659f7aaaa771 // indirect
Expand Down
Loading

0 comments on commit 1ea96a4

Please sign in to comment.