My goal is to understand how to use the new pebble functionality to create a k8s operator charm. I am targeting the jupyter-enterprise-gateway workload for my example, and am hoping to get some feedback in areas where I don’t fully understand how to proceed.
Find the k8s yaml for the jupyter-enterprise-gateway here
Purpose of the charmed operator
In the context of jupyter-enterprise-gateway, I see the charm serving two primary functions:
- provision the resources in k8s that are required by for the workload to run
- facilitate operation of the workload inside of k8s
The resources that jupyter-enterprise-gateway depend on (from the k8s yaml above):
- ClusterRole (enterprise-gateway-controller)
- ClusterRole (kernel-controller)
Picking these k8s resources apart one by one and mapping each of the them to their counterpart in Juju and the Operator Framework will give us a mapping of how the resources can be assembled.
Namespace is created by juju when you create a model on the k8s cloud. The name of the
Namespace can be accessed via the environment variable
JUJU_MODEL_NAME or through
Namespace is the only k8s resource I can identify right now. I don’t know where to look to get information about how to proceed with assembling the others using the Operator Framework. I see set_pot_spec(), but am unsure how to use this with pebble. Searching for
ServiceAccount in the sdk docs doesn’t give much.This highlights a place where documentation could be helpful, “Mapping k8s resources to charmed operator primitives”.
I would like some feedback about how to proceed with provisioning the resources needed to run the jupyter-enterprise-gateway workload using the Operator Framework.
Operation of the k8s workload
Operating the jupyter-enterprise-gateway workload inside of k8s would consist of two responsibilities as far as I see it:
- Lifecycle operations for the containers in the Deployment (the containers that supply the enterprise gateway api endpoint), and
- Lifecycle operations for the kernel-image-puller DaemonSet.
This is another juncture where I’m not sure what to do and thus anther opportunity to enhance the documentation, “DaemonSets and Deployments using the Operator Framework” would do a lot of good here.
Given this short experiment, I am looking for feedback on two things:
- How do I provision k8s resources required by the workload via primitives in the Operator Framework?
- How do I use pebble to manage the workload;
(Edit) After giving some more thought, I’m inclined to think that the kernel-image-puller
DaemonSet and the enterprise-gateway-api
Deployment might be best modeled as two separate charms.