how to run openstack octavia commands in curl? - openstack

I'm using openstack octavia to maintain some loadbalancer. Usually I need to run
openstack loadbalancer list
openstack loadbalancer pool list
openstack loadbalancer member list
openstack loadbalancer member show
openstack loadbalancer member delete
I know there's Rest API for openstack operation, it can send commands to openstack with "curl". But I can't find details for octavia client on openstack docs... Only one sample (create pool) found on -- https://docs.openstack.org/api-ref/load-balancer/v2/index.html?expanded=create-pool-detail
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: " -d '{"pool":{"lb_algorithm":"ROUND_ROBIN","protocol":"HTTP","description":"Super Round Robin Pool","admin_state_up":true,"session_persistence":{"cookie_name":"ChocolateChip","type":"APP_COOKIE"},"listener_id":"023f2e34-7806-443b-bfae-16c324569a3d","name":"super-pool","tags":["test_tag"],"tls_container_ref":"http://198.51.100.10:9311/v1/containers/4073846f-1d5e-42e1-a4cf-a7046419d0e6","ca_tls_container_ref":"http://198.51.100.10:9311/v1/containers/5f0d5540-fae6-4646-85d6-8a84883807fb","crl_container_ref":"http://198.51.100.10:9311/v1/containers/6faf0a01-6892-454c-aaac-650282820c0b","tls_enabled":true,"tls_ciphers":"ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256", "tls_versions": ["TLSv1.2", "TLSv1.3"], "alpn_protocols": ["http/1.1", "http/1.0"]}}' http://198.51.100.10:9876/v2/lbaas/pools
So if it's possible to run those command with curl for openstack, please kind help on how to implement it. Thanks in advance for any help.
Regards
Eisen

Related

send dummy logs to my docker fluentbit agent

I have installed fluentbit agent on my docker and also exposed the port 24224 to my localhost.
How do I send a dummy log to my fluentbit docker agent ?
For what I understand is when I will send a log to :24224 somehow, the agent will do some processing on logs and will send it to localhost:8006
which should be captured in my otel-collector.
I have done all the setup, all I missing is -- a dummy log to test the scenario.
Thanks in advance !
docker run --log-driver=fluentd -t ubuntu echo "Testing a log message"
The command is mostly self explanatory for docker users, I have added a description for the ease of understanding.
The command simply follows docker run syntax
docker run [OPTIONS] IMAGE [COMMAND]
IMAGE=ubuntu
This command simply uses the ubuntu docker image.
COMMAND= echo "Testing a log message"
runs the basic echo command.
the main helpful portion is log-driver
Appearantly, ubuntu docker image supports several log drivers, this list also includes fluend -- which will automatically send the message to localhost:24224 without specifying port !
There might be other tools which can be configured to send logs to localhost:24224, this is one of those many solutions which came handy !

How to import system backup to Artifactory using JFrog cli

I've run Artifactory using Docker.
Downloaded JFrog cli inside the container and configured it.
So ./jfrog rt ping returns
OK
Is there a way to perform system level export/import using JFrog cli?
Succeeded to perform it using web ui. Couldn't find information on how to perform system level export/import in the documentation.
Edit
Succeeded to perform export using REST API:
curl -u admin:pass -X POST -H "Content-Type: application/json" --data #/tmp/export-settings.json http://localhost:8081/artifactory/api/export/system
You can invoke the same REST API using JFrog CLI's curl command as shown below. This way, you don't need to provide the URL and credentials. JFrog CLI's config storage will be used. You can manage this storage using the jfrog rt c command.
If you have multiple Artifactory severs configured, and you don't want to use the default server, the jfrog rt curl command also accepts the --server-id option, with the pre configured Artifactory server ID as the valve.
jfrog rt curl -X POST -H "Content-Type: application/json" --data #/tmp/export-settings.json api/export/system
This feature is currently not supported by the CLI.
Feel free to create a feature request.

Why can't I access a host port from my Docker container?

I've read this post which asks the same question, but the solutions there don't seem to work. Basically I'm trying to access a port on the host os from inside the docker, and I'm using the --net="host" flag as suggested in the linked post. However, I'm still unable to access the port. The only thing that works for me is to run my host web service on 0.0.0.0 and then access it from 192.168.###.###, but that address changes based on what Wifi I'm on, so I don't want to do that. Here's what I've tried:
Set up a test webserver that I can try to access from inside the container:
bash-3.2$ echo hi > index.html
bash-3.2$ python -m SimpleHTTPServer 1234 >/dev/null 2>&1 &
[1] 57942
Curl it from the host to make sure it's running:
bash-3.2$ curl localhost:1234
hi
Start up a container that has curl installed (this is just ubuntu + curl):
bash-3.2$ docker run --rm -it --net="host" tutum/curl bash
Try curling from inside the container:
root#moby:/# curl localhost:1234
curl: (7) Failed to connect to localhost port 1234: Connection refused
I am on macOS, so I'm thinking it might have something to do with the container's host being boot2docker rather than my mac, but I still don't know how to mitigate this.
Any advice would be much appreciated! :)

How to create an openstack VM instance on a specific port using jcloud api

I know how to create a VM instance in jCloud using ServerApi but it creates instance on any available port. I want to know how to create an instance on a given port number.
In openstack cli we use --nic port-id parameter to specify the port as show here:
$ nova boot \
--nic port-id=3c564dd5-fd45-4f61-88df-715f71667b3b \
--flavor m1.tiny \
--image fedora-20-x86_64 \
--key-name lars test0
How can I create server using this port-id in jClouds?
https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/options/NovaTemplateOptions.java#L694
In NovaTemplateOptions, you should be able to specify network details.

neutron error "(rule:create_port and rule:create_port:fixed_ips) to be performed"

I am trying to add multiple fixed IP address to some open stack instances I have running. I am attempting to do this with the following command:
neutron port-create \
--format shell \
--fixed-ip subnet_id <subnet id> \
--fixed-ip subnet_id <subnet id> \
--name whatever \
<network id>
However running this command results in the following error:
Policy doesn't allow (rule:create_port and rule:create_port:fixed_ips) to be performed.
If I try to create a port without the --fixed-ip subnet_id <subnet id> I can successfully create it. With the following command:
neutron port-create --name whatever <network id>
However when I attempt to attach it to an instance I get the following error message:
ERROR (BadRequest): The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400)
I have also tried to attach additionaly IP addresses to my instance with:
nova add-fixed-ip <server> <network-id>
Which successfully runs, but does not change my instance at all, add additional network interfaces or add additional IP addresses.
Shouldn't the format for fixed_ip have been
"--fixed-ip subnet_id=SUBNET" ?
Did you try adding the port using the 'nova interface-attach' command ?

Resources