Skip to content
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

Add Go client and CLI commands for files API #107

Closed
5 tasks done
tunahanertekin opened this issue Feb 22, 2022 · 4 comments
Closed
5 tasks done

Add Go client and CLI commands for files API #107

tunahanertekin opened this issue Feb 22, 2022 · 4 comments

Comments

@tunahanertekin
Copy link

tunahanertekin commented Feb 22, 2022

Progress on this:

For completeness, we need to Go back and implement the Go client and CLI commands for the files API. Our previously discussed approach to this is shown in the spec. See there for details, but in summary:

# Go client. For now, we're not proposing to support multi-file push/pull (same as Python client).
func (*Client) Pull(opts *PullOptions) (PushResult, error)
func (*Client) Push(opts *PushOptions) (PushResult, error)
func (*Client) ListFiles(opts *ListFilesOptions) (ListFilesResult, error)
func (*Client) MakeDir(opts *MakeDirOptions) (MakeDirResult, error)
func (*Client) RemovePath(opts *RemovePathOptions) (RemovePathResult, error)

# Pebble CLI.
pebble push file.txt /path [-m|--mode=644 --user=USER|uid --group=GROUP|gid]
pebble pull /path file.txt
pebble cat /path # same as pull, but write to stdout
pebble mkdir /path [-p|--parents -m|--mode=755 --user=USER|uid --group=GROUP|gid]
pebble rm /path [-r|--recursive]
pebble ls '/etc/*.conf'  # path can be dir, file, or glob

@tunahanertekin's original message:

Hi there, Pebble's File API usage is explained here when using it on Juju operator framework. Is there a way to use Pebble's File API on Golang? I've tried to find it in Pebble's Go client but I couldn't.

@benhoyt
Copy link
Contributor

benhoyt commented Feb 22, 2022

Thanks, @tunahanertekin -- yeah, at this point we don't have a Go client or CLI commands for the files API (there's only the Python one as part of the Python Operator Framework). I'm going to update this issue to request adding that. We should have it for completeness, though we haven't needed it to date for Juju.

Out of interest, what's your use case, and what APIs specifically would be most important? Are you trying to write a Juju operator in Go?

@benhoyt benhoyt changed the title Using File API with Go client Add Go client and CLI commands for files API Feb 22, 2022
@tunahanertekin
Copy link
Author

Thanks, @tunahanertekin -- yeah, at this point we don't have a Go client or CLI commands for the files API (there's only the Python one as part of the Python Operator Framework). I'm going to update this issue to request adding that. We should have it for completeness, though we haven't needed it to date for Juju.

Out of interest, what's your use case, and what APIs specifically would be most important? Are you trying to write a Juju operator in Go?

Thanks for your reply @benhoyt.

As robolaunch, our use case is to adapt ROS 2 and DDS domain to the Kubernetes environment and provide an open source solution for cloud robotics & simulation & fleet management. We're planning to develop our Kubernetes operators with Kubebuilder SDK and looking for methods to manage container processes. An additional motivation of ours is to expose some of the abilities of our container supervisor to CR.

Legacy methods like supervisord have other drawbacks such as it's native way to expose itself is XMLRPC. It seems that Pebble is the best fit for our use cases with it's flexibility and we do want to configure some parts of the filesystem directly using files API, not with ConfigMaps or Secrets. Also Container exec is a hard method to automate when reconciling, but configuring files with files API can easily be automated.

Additionally, being able to add new layers on runtime is an awesome feature of Pebble since it allows us to do dynamic configurations and seamless upgrades. If you have a suggestion or comment about our use case, we'll be glad to hear.

@benhoyt
Copy link
Contributor

benhoyt commented Mar 13, 2024

This is all done now (and has been for a while), thanks @anpep!

@benhoyt benhoyt closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants