Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Project domain attribute for workflow Execution config #298

Merged
merged 5 commits into from
Mar 25, 2022

Conversation

pmahindrakar-oss
Copy link
Contributor

@pmahindrakar-oss pmahindrakar-oss commented Mar 24, 2022

Signed-off-by: Prafulla Mahindrakar prafulla.mahindrakar@gmail.com

TL;DR

Refer the flyteadmin PR for how this feature is used
flyteorg/flyteadmin#378

No existing project domain attribute for execution config

flytectl get workflow-execution-config -p flytesnacks -d development
Error: rpc error: code = NotFound desc = Resource [{Project:flytesnacks Domain:development Workflow: LaunchPlan: ResourceType:WORKFLOW_EXECUTION_CONFIG}] not found

Generate a sample file for project domain attribute for execution config

 flytectl get workflow-execution-config -p flytesnacks -d development --attrFile wec.yaml --gen
Generating a sample workflow execution config file
warning file wec.yaml will be overwritten [y/n]: y
wrote the config to file wec.yaml%      

Sample file contents

cat wec.yaml
annotations:
  values:
    cliAnnotationKey: cliAnnotationValue
domain: development
labels:
  values:
    cliLabelKey: cliLabelValue
max_parallelism: 10
project: flytesnacks
raw_output_data_config:
  output_location_prefix: cliOutputLocationPrefix
security_context:
  run_as:
    k8s_service_account: default

Update project domain attribute for execution config

flytectl update workflow-execution-config --attrFile wec.yaml
Updated attributes from flytesnacks project and domain development

GET an existing project domain attribute for execution config

flytectl get workflow-execution-config -p flytesnacks -d development                     
{
  "project": "flytesnacks",
  "domain": "development",
  "max_parallelism": 10,
  "security_context": {
    "run_as": {
      "k8s_service_account": "default"
    }
  },
  "raw_output_data_config": {
    "output_location_prefix": "cliOutputLocationPrefix"
  },
  "labels": {
    "values": {
      "cliLabelKey": "cliLabelValue"
    }
  },
  "annotations": {
    "values": {
      "cliAnnotationKey": "cliAnnotationValue"
    }
  }
}%   

Delete project domain attribute for workflow exeuction config.

flytectl delete workflow-execution-config --attrFile wec.yaml
Deleted matchable resources from flytesnacks project and domain development

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

How did you fix the bug, make the feature etc. Link to any design docs etc

Tracking Issue

flyteorg/flyte#2070

Follow-up issue

NA

Signed-off-by: Prafulla Mahindrakar <prafulla.mahindrakar@gmail.com>
Copy link
Contributor

@katrogan katrogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! do you mind updating the PR title and linking the issue

@@ -4,6 +4,7 @@ package workflowexecutionconfig

type AttrFetchConfig struct {
AttrFile string `json:"attrFile" pflag:",attribute file name to be used for generating attribute for the resource type."`
Gen bool `json:"gen" pflag:",generates an empty workflow execution config file with conformance to the api format."`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love this!

Project: project,
Domain: domain,
Workflow: workflow,
WorkflowExecutionConfig: &admin.WorkflowExecutionConfig{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great, but it's too bad we have to manually update this if the proto structure changes. is there anyways to use reflection somehow to populate all the fields from the proto definition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can dump it in following way if we enable EmitDefaults in jsnonpb.Marshaller.
The user still has to know the types for each of the fields when modifying it.

annotations: null
labels: null
maxParallelism: 0
rawOutputDataConfig: null
securityContext: null

Having a customized default lets us give a sample structure with the populated types which is something like this.
And also this gives us to go beyond one level and define deeper customized objects instead of default which would be nil.

annotations:
  values:
    cliAnnotationKey: cliAnnotationValue
domain: development
labels:
  values:
    cliLabelKey: cliLabelValue
max_parallelism: 10
project: flytesnacks
raw_output_data_config:
  output_location_prefix: cliOutputLocationPrefix
security_context:
  run_as:
    k8s_service_account: default

I understand its going to be maintenance to add a new field and requires a corresponding change in the default but doesn't this provide a more user friendly option.
Let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prioritizing user-friendliness definitely is the superior option! I don't imagine we'll update the proto structure too frequently so this seems like a superior choice 👍

go.mod Outdated Show resolved Hide resolved
Signed-off-by: Prafulla Mahindrakar <prafulla.mahindrakar@gmail.com>
@pmahindrakar-oss pmahindrakar-oss changed the title WIP: Project domain setting WIP: Project domain attribute for workflow Execution config Mar 25, 2022
Signed-off-by: Prafulla Mahindrakar <prafulla.mahindrakar@gmail.com>
Signed-off-by: Prafulla Mahindrakar <prafulla.mahindrakar@gmail.com>
katrogan
katrogan previously approved these changes Mar 25, 2022
Copy link
Contributor

@katrogan katrogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more nit: please update the PR title!

cmd/config/subcommand/matchable_attr_file_config_utils.go Outdated Show resolved Hide resolved
Signed-off-by: Prafulla Mahindrakar <prafulla.mahindrakar@gmail.com>
@pmahindrakar-oss pmahindrakar-oss changed the title WIP: Project domain attribute for workflow Execution config Project domain attribute for workflow Execution config Mar 25, 2022
@pmahindrakar-oss
Copy link
Contributor Author

@katrogan need your re-approval. Also please have a look at this issue flyteorg/flyte#2287
as it block workflow matchable attributes for execution config

@pmahindrakar-oss pmahindrakar-oss merged commit d636ab8 into master Mar 25, 2022
@pmahindrakar-oss pmahindrakar-oss deleted the pmahindrakar/2070-Project-Domain-Setting branch March 25, 2022 17:29
pmahindrakar-oss added a commit that referenced this pull request Mar 30, 2022
Signed-off-by: Prafulla Mahindrakar <prafulla.mahindrakar@gmail.com>

Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants