-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): support scaling of resources in UI (#15505) #20097
base: master
Are you sure you want to change the base?
feat(ui): support scaling of resources in UI (#15505) #20097
Conversation
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
✅ Preview Environment created on Bunnyshell but will not be auto-deployedSee: Environment Details Available commands (reply to this comment):
|
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
* Add state to pkce flow Signed-off-by: Jungho Son <js3692@users.noreply.github.com> * Call unset Signed-off-by: Jungho Son <js3692@users.noreply.github.com> --------- Signed-off-by: Jungho Son <js3692@users.noreply.github.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
* docs: add link to example repo creds yaml Signed-off-by: Nicholas Morey <nicholas@morey.tech> * docs: add project to repo creds examples Signed-off-by: Nicholas Morey <nicholas@morey.tech> --------- Signed-off-by: Nicholas Morey <nicholas@morey.tech> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Without the extra line break, the paragraph was rendered as part of the Kustomize application manifest. Signed-off-by: Allan M. de Azevedo <4llan@users.noreply.github.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Signed-off-by: Josh Soref <jsoref@gmail.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…18441) * feat: option to disable writing k8s events optioned to write logs for k8s events. Each is passed as an environment variable and defaults to true, disabling it requires explicitly setting the option to false. Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com> * feat: option to disable writing k8s events fix unit test - application_test - applicationset_test - project_test - appcontroller_tes - audit_logger_test Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com> * rebase Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com> --------- Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…goproj#18025) (argoproj#20009) Signed-off-by: linghaoSu <linghao.su@daocloud.io> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…roj#20059) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.66.2 to 1.67.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](grpc/grpc-go@v1.66.2...v1.67.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…oproj#20065) Signed-off-by: nueavv <nuguni@kakao.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
* fix broken link Signed-off-by: nitishfy <justnitish06@gmail.com> * fix broken link Signed-off-by: nitishfy <justnitish06@gmail.com> --------- Signed-off-by: nitishfy <justnitish06@gmail.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…roj#20068) Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Signed-off-by: CI <ci@argoproj.com> Co-authored-by: CI <ci@argoproj.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
… plugin-based applications (argoproj#19209) * chore: transmit manifest-generate-path resources to the cmp-server for plugin-based applications Signed-off-by: Javier Solana <javier.solana@cabify.com> * use SecureJoin Signed-off-by: Javier Solana <javier.solana@cabify.com> * make cmp manifests generation using manifest generate path annotation configurable by environment variable Signed-off-by: Javier Solana <javier.solana@cabify.com> * fix missing doc running codegen-local Signed-off-by: Javier Solana <javier.solana@cabify.com> * set reposerver.plugin.enable.manifests.generation.using.annotations false by default Signed-off-by: Javier Solana <javier.solana@cabify.com> * define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly Signed-off-by: Javier Solana <javier.solana@cabify.com> * define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly Signed-off-by: Javier Solana <javier.solana@cabify.com> * Fix conflict Signed-off-by: Javier Solana <javier.solana@cabify.com> * autogenerate install manifests Signed-off-by: Javier Solana <javier.solana@cabify.com> * add note about common root path calculation for manifest paths annotation Signed-off-by: Javier Solana <javier.solana@cabify.com> * log common root path calculated Signed-off-by: Javier Solana <javier.solana@cabify.com> * app path must be the lower common path Signed-off-by: Javier Solana <javier.solana@cabify.com> * tweaks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Javier Solana <javier.solana@cabify.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…pgrading path-to-regexp from 1.8.0 to 1.9.0 (argoproj#20087) Signed-off-by: Cheng Fang <cfang@redhat.com> Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
a6efc06
to
f864d68
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20097 +/- ##
=========================================
Coverage ? 55.15%
=========================================
Files ? 324
Lines ? 55221
Branches ? 0
=========================================
Hits ? 30457
Misses ? 22153
Partials ? 2611 ☔ View full report in Codecov by Sentry. |
@@ -1,3 +1,4 @@ | |||
local actions = {} | |||
actions["restart"] = {} | |||
actions["scale"] = {["defaultValue"] = tostring(obj.spec.replicas), ["hasParameters"] = true, ["errorMessage"] = "Enter any valid number", ["regexp"]= "^[0-9][0-9]*$"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is +
not supported?
I'd expect a space before =
.
Is \d
defined to more than [0-9]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added space and Updated regex
local os = require("os") | ||
|
||
obj.spec.replicas = tonumber(scale) | ||
return obj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add newline at end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new line
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…rgo-cd into 15505-scale-resources-in-ui
@@ -7,4 +7,5 @@ if obj.spec.paused ~= nil then | |||
actions["pause"] = {paused} | |||
end | |||
actions["resume"] = {["disabled"] = not(paused)} | |||
actions["scale"] = {["defaultValue"] = tostring(obj.spec.replicas), ["hasParameters"] = true, ["errorMessage"] = "Enter any valid number", ["regexp"] = "^[0-9]*$", } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this feature also extended to Argo Rollouts resources which is based on K8s Deployment? Can this be done in this PR?
Probably worth documenting this feature and set expectations when using HPA or application auto-sync is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature in argo rollouts will be done in a separate PR
…le-resources-in-ui
Hello @crenshaw-dev, please look into this PR - an enhancement feature: #15505 which was already approved about a year ago. Could you please help me on how to move forward? |
@@ -1,3 +1,4 @@ | |||
local actions = {} | |||
actions["restart"] = {} | |||
actions["scale"] = {["defaultValue"] = tostring(obj.spec.replicas), ["hasParameters"] = true, ["errorMessage"] = "Enter any valid number", ["regexp"] = "^[0-9]*$"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the scale action is not relevant for Daemon Sets, since they operate on NodeSelectors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed DaemonSet scale action
util/lua/lua.go
Outdated
@@ -60,7 +61,7 @@ type VM struct { | |||
UseOpenLibs bool | |||
} | |||
|
|||
func (vm VM) runLua(obj *unstructured.Unstructured, script string) (*lua.LState, error) { | |||
func (vm VM) runLua(obj *unstructured.Unstructured, script string, resourceActionParameters []*applicationpkg.ResourceActionParameters) (*lua.LState, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a new method, something like runLuaWithResourceActionParameters
, be added? And the new method would invoke the existing one and then operate on the input parameters afterwards?
This way most places in the code, that don't require the parameters, can remain unchanged and then only the new code which needs the params would invoke the new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the suggestion, added a new method that invokes the existing one.
@@ -600,7 +600,7 @@ argocd admin settings resource-overrides action run /tmp/deploy.yaml restart --a | |||
action, err := luaVM.GetResourceAction(&res, action) | |||
errors.CheckError(err) | |||
|
|||
modifiedRes, err := luaVM.ExecuteResourceAction(&res, action.ActionLua) | |||
modifiedRes, err := luaVM.ExecuteResourceAction(&res, action.ActionLua, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resource parameters should be passed here, if received from the command line.
An e2e argocd cli test would ensure the cli works correctly with the new functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please help on the following error in end-to-end test? seems to be a lock on the Git repository, preventing the application from being created successfully.
time="2024-10-20T21:54:36Z" level=error msg="`../../dist/argocd app create test-installation-id --repo file:///tmp/argo-e2e/testdata.git --dest-server https://kubernetes.default.svc --path guestbook --project default --dest-namespace argocd-e2e--test-installation-id-yrgcy --plaintext --server 127.0.0.1:8088 --auth-token *** --insecure` failed exit status 20: time=\"2024-10-20T21:54:35Z\" level=fatal msg=\"rpc error: code = InvalidArgument desc = application spec for test-installation-id is invalid: InvalidSpecError: Unable to generate manifests in guestbook: rpc error: code = Unknown desc = failed to initialize repository resources: rpc error: code = Internal desc = Failed to fetch default: `git fetch origin --tags --force --prune` failed exit status 1: error: cannot lock ref 'refs/remotes/origin/master': Unable to create '<path to cached source>/.git/refs/remotes/origin/master.lock': File exists.\\n\\nAnother git process seems to be running in this repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue has been resolved, please check
@@ -0,0 +1,4 @@ | |||
local os = require("os") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ArgoCD, there are automatic tests that run for each built-in resource action.
Those tests are run in TestLuaResourceActionsScript
in util/lua/custom_actions_test.go
Those tests expect an input manifest, and and output manifest, that represents the output of the action when run on the input manifest.
Look at resource_customizations/apps/Deployment/actions/action_test.yaml
, it has an example of input and output files for the action test, you would need to add a similar for Deployment + StatefulSet. The idea is that you provide a Deployment manifest with replicas set to x as an input, and provide a Deployment manifest with replicas set to y as an output. The automatic test will succeed if your custom action yields the output manifest.
You don't have to do this twice for scale-in and scale-out, one example of a scale change is enough for Deployment and one for StatefulSet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added scale actions in resource_customizations/apps/Deployment/actions/action_test.yaml
and resource_customizations/apps/StatefulSet/actions/action_test.yaml
files and also tests in util/lua/custom_actions_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @reggie-k, could you please take a look into this? it's green I believe.
IconClass string `json:"iconClass,omitempty" protobuf:"bytes,4,opt,name=iconClass"` | ||
DisplayName string `json:"displayName,omitempty" protobuf:"bytes,5,opt,name=displayName"` | ||
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` | ||
Params []ResourceActionParam `json:"params,omitempty" protobuf:"bytes,2,rep,name=params"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is an existing Params
field, and looking at ResourceActionParam
, it has most of the needed fields, I checked and it is used in the util/lua/lua_test.go
, and there is even a test there for an action scale
. Can you maybe make use of this field and check what this existing scale
test is used for?
…le-resources-in-ui
… updated admin cli Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…li_test Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
… for testing Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…le-resources-in-ui
…le-resources-in-ui
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…le-resources-in-ui
@@ -0,0 +1,21 @@ | |||
# Scale Resources in ArgoCD UI | |||
|
|||
This enables users to scale resources directly from the ArgoCD UI. Users will be able to increase or decrease the number of replicas (Pods) for Jobs, Deployments, and StatefulSets by using input field. The feature aims to enhance user experience, especially for non-technical users, by eliminating the need to modify configuration files or use kubectl commands for scaling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enables users to scale resources directly from the ArgoCD UI. Users will be able to increase or decrease the number of replicas (Pods) for Jobs, Deployments, and StatefulSets by using input field. The feature aims to enhance user experience, especially for non-technical users, by eliminating the need to modify configuration files or use kubectl commands for scaling. | |
This enables users to scale resources directly from the ArgoCD UI. Users will be able to increase or decrease the number of replicas (Pods) for Jobs, Deployments, and StatefulSets by using an input field. The feature aims to enhance user experience, especially for non-technical users, by eliminating the need to modify configuration files or use kubectl commands for scaling. |
|
||
|
||
## Example Usage | ||
1. User navigates to a Deployment, StatefulSet or Job in any ArgoCD application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. User navigates to a Deployment, StatefulSet or Job in any ArgoCD application. | |
1. User navigates to a Deployment, StatefulSet, or Job in any ArgoCD application. |
<div> | ||
{!action.hasParameters && ( | ||
<div className='argo-form-row'> | ||
<div> Are you sure you want to execute {action.name} action?</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of execute
in user facing content.
<div> Are you sure you want to execute {action.name} action?</div> | |
<div> Are you sure you want to perform {action.name} action?</div> |
iconClassName: action.iconClass, | ||
action: async () => { | ||
const confirmed = false; | ||
const title = action.hasParameters ? `Enter input parameters for action: ${action.name}` : `Execute ${action.name} action?`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const title = action.hasParameters ? `Enter input parameters for action: ${action.name}` : `Execute ${action.name} action?`; | |
const title = action.hasParameters ? `Enter input parameters for action: ${action.name}` : `Perform ${action.name} action?`; |
(Alternatively Run
)
inputPath: testdata/statefulset.yaml | ||
expectedOutputPath: testdata/statefulset-scaled.yaml | ||
parameters: | ||
scale: "6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scale: "6" | |
scale: "6" |
(Don't trigger missing newline at eof)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no newline at eof
readyReplicas: 2 | ||
replicas: 3 | ||
unavailableReplicas: 1 | ||
updatedReplicas: 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updatedReplicas: 3 | |
updatedReplicas: 3 |
Don't add missing newline at eof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no newline at eof
expectedOutputPath: testdata/deployment-scaled.yaml | ||
parameters: | ||
scale: "6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scale: "6" | |
scale: "6" |
Don't add missing newline at eof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no newline at eof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that's effectively a warning. Don't do that. Add a newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! should I add this as a comment in the top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just add an extra newline at the end of each file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
…le-resources-in-ui
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…le-resources-in-ui
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
…le-resources-in-ui
Note: you have to include #15505 in the PR description as well to link to the issue properly. |
added |
Checklist: