acorn-io/runtime

When user creates a new credentials as part of deploying app/ picks an existing one , he is prompted again to pick a credential.

sangee2004 opened this issue · 8 comments

acorn version - v0.10.0-rc2-9-g43dbcbf4+43dbcbf4

Steps to reproduce the problem:

Scenario 1:

  1. Deploy app with credentials
secrets: config: {
	type: "credential.acorn.io/mytestcred"
	params: {
		promptOrder: ["username", "password"]
	}
	data: {
		username:      "abc"
		password:      "ppp"
	}
}
containers: {
	mytest: {
		image: "nginx"
	}
}
  1. When prompted for credentials , enter new credentials.
  2. After this , user is presented withe list of existing credentials (which also includes the one that was just created) and asked to choose from the list.
mytestnew
STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] 
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] waiting for quota allocation; (container: mytest): pending; (secret: config): pending
? password **
? username **
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] "acorn login mytestnew" required
STATUS: ENDPOINTS[] HEALTHY[0/1] UPTODATE[0] "acorn login mytestnew" required
STATUS: ENDPOINTS[] HEALTHY[0/1] UPTODATE[1] "acorn login mytestnew" required
? Choose an existing credential or enter a new one Existing: config-n778n (Keys: [password, username], Created: [2024-01-12 10:55:50 -0800 PST])
STATUS: ENDPOINTS[] HEALTHY[1] UPTODATE[1] "acorn login mytestnew" required

┌───────────────────────────────────────────────┐
| STATUS: ENDPOINTS[] HEALTHY[1] UPTODATE[1] OK |
└───────────────────────────────────────────────┘

Expected Behavior:
If user is creating a new cred , we should be able to use the created one for the app instead of having to letting him select again.

Scenario 2:

  1. Deploy app with creds and create new cred.
  2. Deploy another app with same credential type as step1.
  3. When prompted for credentials , pick the existing one that gets listed.
  4. Notice that user will be prompted again to pick a cred.
mytestnew5
STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] 
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] waiting for quota allocation; (container: mytest): pending; (secret: config): pending
? Choose an existing credential or enter a new one Existing: config-2kl5g (Keys: [password, username], Created: [2024-01-12 11:09:45 -0800 PST])
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] "acorn login mytestnew5" required
STATUS: ENDPOINTS[] HEALTHY[0/1] UPTODATE[0] "acorn login mytestnew5" required
STATUS: ENDPOINTS[] HEALTHY[0/1] UPTODATE[1] "acorn login mytestnew5" required
? Choose an existing credential or enter a new one Existing: config-2kl5g (Keys: [password, username], Created: [2024-01-12 11:09:45 -0800 PST])
STATUS: ENDPOINTS[] HEALTHY[1] UPTODATE[1] "acorn login mytestnew5" required

Expected Behavior:
User should not be prompted multiple times.

Not sure what changed, but I am no longer seeing this behavior on the main branch of runtime, installed in my local k8s. (Haven't tried it against the SaaS.) Both scenarios produce the expected behavior as described in this issue. Moving this into QA. Let me know if something still seems broken.

@g-linville This issue reproduced inconsistently for me earlier. Also i saw this happen when testing in main .

I'll bring it back to In Progress for now and play around some more and see if I can cause this bug to appear.

Merged the fix. The user should now be prompted only one time to provide credentials (or select existing ones).

@g-linville With latest build - acorn version - v0.10.0-rc2-35-g3cf6c107+3cf6c107 , I am not prompted to enter credentials when deploying apps with credentials.

App deployment just stays at acorn login mytestapp" required state without prompting the user:

mytestapp
STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] 
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] "acorn login mytestapp" required
^C%  

@g-linville The Acornfile I used for deploying apps when I am not prompted to enter the creds (has secrets being used as env variable in container):

secrets: config: {
	type: "credential.acorn.io/mytestcred"
	params: {
		promptOrder: ["username", "password","testnodef"]
	}
	data: {
		username:      "abcd"
		password:      "ppp"
		testnodef:      "yy"
	}
}
containers: {
	mytest: {
		image: "nginx"
        env:{
           username: "secret://config/username"
           password: "secret://config/password"
	}
}
}

I am prompted as expected when using the Acornfile mentioned in the issue.

Should be good now.

Tested with - acorn version - v0.10.0-rc2-36-g994b4680+994b4680

User is prompted to enter/pick existing credentials as expected when deploying apps with creds and containers having secrets consumed as env variables.

Also i am not able to reproduce the initial issue reported in this issue with user being prompted twice when entering a new cred/ choosing an existing cred. User is prompted only once to enter a new credential/pick existing one.