Open AlexGilleran opened 4 years ago
The official Kubernetes client for Javascript/Typescript has plenty of utility functions to interface with the Kubernetes Cluster.
Let's look at the scenario where we need to turn a deployment off and then on.
To delete a deployment, do this:
const k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const k8sBatchApi = kc.makeApiClient(k8s.BatchV1Api);
const k8sCoreApi = kc.makeApiClient(k8s.CoreV1Api);
const k8sAppsApi = kc.makeApiClient(k8s.AppsV1Api);
const NAMESPACE = 'default';
k8sCoreApi.listNamespacedPod(NAMESPACE).then((res) => {
console.log("Pods: ");
const pods = res.body.items;
pods.forEach((pod, index) => {
console.log(index + ': ' + pod.metadata.name);
})
k8sAppsApi.deleteNamespacedDeployment('storage-api', NAMESPACE).then((res) => {
console.log('Deleted pod');
console.log(res.body);
})
return res.body;
});
To create the deployment again, you can use the function createNamespacedDeployment
, defined here.
You would need to create a V1Deployment
object. The model is defined here.
I could not find any helm API that could change Kubernetes deployments. Here is an article that I looked at though.
Result of refinement discussion: Helm Operators still warrant further investigation (https://docs.fluxcd.io/projects/helm-operator/en/stable/helmrelease-guide/chart-sources/), because that might get us a solution that gets us everything we want. Next step is to dive deeper into helm operators and see if they'll do what we need and how complex that will make deployments.
Helm operator looks quite promising even without helm's three-way merge.
Our chart based fit this solution well if we make sure the following:
HelmRelease
object 's valueIn this way, we can have two layers of configuration:
HelmRelease
object)The later actually works like helm's values file and can overwrite the former.
We still can upgrade to the newer version without losing a runtime setting.
Just saw this, might help: https://github.com/opskumu/helm-wrapper
@AlexGilleran That's really cool~ it probaly allow us to have a mini version tiller running with HTTP API easily. I also think about picking up some GO lately 😄
Description
Right now, most configuration that will be changeable in the new control panel is specified via values passed to helm. This means that when you want to change these values, you change the Helm
values.yaml
file andhelm upgrade
to make the changes to the installation.However, the control panel wants to expose this to a user via a web UI with controls like this:
Obviously this is quite a ways from a command line. We need to figure out how to let a user make these changes from the UI and have them propagated across the whole system.
Things to address
values.yaml
passed into helm, how would we make subsequent deployments on the command line if the values have been changed via the UI?Acceptance Criteria