-
Notifications
You must be signed in to change notification settings - Fork 44
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
Enhance the usability of the Libvirt provider for confidential container administrators #435
Comments
Here is my understanding of the issue: Before creating a podVM image for libvirt (either operator built or from a pre-built image) an administrator must perform the following steps
After the above steps the KataConfig will be created which will then create the podvm image. And you want to automate step 1 and 2 for a better admin experience. Is this the correct problem summary and goal ? |
Yes, @bpradipt . In addition to items 1 and 2, I would like to automate the following:
Additionally, as we discussed, it would be beneficial to decouple the following optional tasks:
|
Now its much clearer to me. At a high level I think the following functionality can be implemented first:
Regarding SSH key, afaik all the providers require SSH key ( for non CoCo). Can there be a generic method that applies to all the providers? And does this needs to be in the OSC operator or cloud-api-adaptor ? As for automating the bootstrap configuration that needs to go in configmap and secrets it needs to be discussed how it can work for all the providers, as the problem is same for all the providers. And does this functionality need to be in the OSC operator or cloud-api-adaptor ? |
@bpradipt, the Libvirt volume name information needs to be included in the peer-pod-secret. Therefore, we handled all the creation steps through the same job and handler. Here are my thoughts: It’s more efficient to manage SSH key pair generation and the creation of the secret object using OpenShift Sandbox Container Operator(OSC) rather than the cloud-api-adapter because:
|
@bpradipt, @savitriH, sorry answering late here.
|
Improve the usability of the Libvirt provider for confidential container administrators
Summary
To improve the user experience for confidential container administrators to enable the confidential container functionality, sandbox container operators should utilize a specialized script designed for Libvirt provider for managing administrative tasks specific to confidential containers during the activation of Peerpod through the KataConfig configmap.
Motivation
Currently, the OpenShift Sandbox Container(OSC) Operator manages the following tasks:
OSC operator handles above operations automatically but still it requires following manual operations to be executed by confidential container administrator:
1. Generation of SSH Key(public-private key) in OCP cluster.
$ ssh-keygen -f ./id_rsa -N ""
2. Copy the SSH public key to KVM Host(LPAR). So that worker node can perform Libvirt specific operations such as creating the peerpod on the LPAR(KVM host) and lifecycle management of the peerpod VM.
$ ssh-copy-id -i ./id_rsa.pub <KVM_HOST_IP_ADDRESS>
3. Create the SSH secret object
4. Create Libvirt POOL and Volume
Set the name of the libvirt pool by running the following command:
$ export LIBVIRT_POOL=<name_of_libvirt_pool_to_create>
Set the name of the libvirt volume by running the following command:
$ export LIBVIRT_VOL_NAME=<name_of_libvirt_volume_to_create>
Set the path of the default storage pool location, by running the following command:
$ export LIBVIRT_POOL_DIRECTORY=<name_of_target_directory>
Note:To ensure libvirt has read and write access permissions, use a subdirectory of libvirt’s storage directory. The default is /var/lib/libvirt/images/
Create a libvirt pool by running the following command:
$ virsh pool-define-as $LIBVIRT_POOL --type dir --target "$LIBVIRT_POOL_DIRECTORY"
Start the libvirt pool by running the following command:
$ virsh pool-start $LIBVIRT_POOL
5. Create and apply the PeerPod Secret and ConfigMap.
1. Create and apply the PeerPod Secret
Create a YAML file peer-pods-secret.yaml with the following manifest:
1 Enter libvirt as the cloud provider.
2 Enter the libvirt_gateway_uri value you retrieved.
3 (https://docs.redhat.com/en/documentation/openshift_sandboxed_containers/1.5/html-single/openshift_sandboxed_containers_user_guide/index#CO17-3) Enter the libvirt_pool value you retrieved.
4 (https://docs.redhat.com/en/documentation/openshift_sandboxed_containers/1.5/html-single/openshift_sandboxed_containers_user_guide/index#CO17-4) Enter the libvirt_volume value you retrieved.
2. Create the peer-pod-secret object:
$ oc apply -f peer-pods-secret.yaml
3. Create and apply ConfigMap.
Create a peerpod configuration file(peer-pods-cm.yaml)
Apply the ConfigMap:
$ oc apply -f peer-pods-cm.yaml
4. Create Libvirt image config map
i. For Operator built PodVM image
ii. For Pre built PodVM image
The goal is to enhance user experience by automating the aforementioned manual operations through a script. These scripts will be called from OSC through job.
Goals
To improve the user experience for confidential container administrators to enable the confidential container functionality, sandbox container operators should utilize a specialized script designed for Libvirt provider for managing administrative tasks specific to confidential containers during the activation or de-activation of Peerpod through the KataConfig configmap.
Proposal
This new script
libvirt-config-manager.sh
will be developed and shipped with openshift sandbox container operator. This script can be called for s390x Libvirt provider in the reconcile path(routine) of the openshift sandbox container in the functionsprocessKataConfigInstallRequest
andhandleFeatureConfidential
. This reduces the manual operation.Design
This design focuses to improve the usability experience for the OCP Admin user to enable the confidential containers.
Four new files
libvirt-podvm-secret.yaml
,libvirt-config-manager.sh
,osc-podvm-pre-config-job.yaml
andosc-cleanup.yaml
will be added to improve the usability.libvirt-podvm-secret.yaml
file will contain the following fields(Keys)......
KVM HOST(LPAR) IP, KVM HOST Username and KVM HOST password are mandatory fields. Libvirt Pool Path, Pool Name Volume names, SE_BOOT and PODVM_IMAGE_URI are optional.
Note: Administrators need to create a user on the LPAR with the necessary permissions to execute virsh commands and apply the Libvirt configuration file
libvirt-podvm-secret.yaml
on the OpenShift Container Platform (OCP) before enabling peerpods through KataConfig configmap.The
libvirt-config-manager.sh
script utilizes the administrative user's specified data from thelibvirt-podvm-secret.yaml
file.The
libvirt-config-manager.sh
script sequentially executes the following tasks.Validate the mandatory field values in the
libvirt-podvm-secret.yaml
file.Generate a SSH key pair (public-private key) within the OCP cluster.
Decode the encoded KVM host password as specified in
libvirt-podvm-secret.yaml
.Copy the generated SSH public key to the KVM Host(LPAR).
Create the SSH secret object on OCP
Create the directory on the KVM host where the user specifies the path for the default storage pool location.
Create a Libvirt pool using the specified pool name if specified by the admin user in the
libvirt-podvm-secret.yaml
file. Otherwise, create the libvirt pool using the default pool name.Start the created libvirt pool
Create a Libvirt volume using the specified volume name if specified by the admin user in the
libvirt-podvm-secret.yaml
file. Otherwise, create the libvirt volume using the default volume name.Generate and apply PeerPod Secret, PeerPod ConfigMap and Libvirt Image ConfigMap.
This script
libvirt-config-manager.sh
will be shipped with openshift sandbox container operator. This script can be called for s390x Libvirt provider in reconcile path(routine) of the openshift sandbox container in the functionsprocessKataConfigInstallRequest
andhandleFeatureConfidential
through the jobsosc-podvm-pre-config-job.yaml
andosc-cleanup.yaml
to create Secrets, ConfigMaps, Libvirt Pool and Volume during PeerPod activation and remove them during PeerPod de-activation through jobs.Future Work Items related to this
Currently, the KVM host (LPAR) password is encoded and applied via script for the Tech Preview phase. For the General Availability (GA) release, TLS server certificates will be generated and stored securely, similar to other credentials. The plan is to establish a TLS connection between the LPAR and OCP host, enabling secure transmission of the SSH public key generated on OCP to the LPAR.
Conclusion
This approach improves user experience for confidential container administrators to enable/disable the confidential container functionality, sandbox container operators should utilize a specialized
script designed for Libvirt provider for managing administrative tasks specific to confidential containers during the activation or de-activation of Peerpod through the KataConfig configmap.
This proposal can be found in following google document:
https://docs.google.com/document/d/1ZfgG2PJXs4FeKeV5RkGGkrJ_MLZJxX5smSGrOiN8ZUw/edit
The text was updated successfully, but these errors were encountered: