Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Better documentation #77

Open
ostlerc opened this issue Jan 30, 2018 · 2 comments
Open

Better documentation #77

ostlerc opened this issue Jan 30, 2018 · 2 comments

Comments

@ostlerc
Copy link

ostlerc commented Jan 30, 2018

This most recent rewrite I am having a difficult time digging to see how to do basic things. ie: How do I scale a deployment, how do I update an image for a deployment? I have been able to pull out a pod list, iterate to find the container status where images are listed and altered those structures and attempted to update. No errors, but the images aren't changing. I haven't found any clue from the code how you could possibly scale a deployment either. I want this library to work with its less dependencies, but it seem very unfriendly for non experts of kubernetes now. Can you help me with these specific actions, and enhance the documentation or point me in the right place

I'm sorry if an Issue is the incorrect place for this kind of comment. I just don't know where else to go.

@ericchiang
Copy link
Owner

To your specific question, you'd do something like:

var d appsv1.Deployment
if err := client.Get(ctx, "my-namespace", "my-deployment", &d); err != nil {
    // Handle error
}
d.Spec.Replicas = k8s.Int32(10)
if err := client.Update(ctx, d); err != nil {
    // Handle error
} 

I want this library to work with its less dependencies, but it seem very unfriendly for non experts of kubernetes now.

I can see how that might happen. Would adding API reference links help? For example:

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/

Or some example of "how do I track down an object?" like mapping

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny
spec:
  podSelector: {}
  policyTypes:
  - Ingress

to the associated godocs:

https://godoc.org/github.com/ericchiang/k8s/apis/networking/v1#NetworkPolicy

@ostlerc
Copy link
Author

ostlerc commented Feb 1, 2018

My main confusion is/was around how the API worked. With your sample I was able to figure out the apis folder contains lots of the types that when they are pointers can be used as k8s.Resources.

It would be nice to document the api folder is where all the types live and is the crux to knowing how to get / update k8s.Resources. the README shows where corev1 is, but i'm not a k8s expert and core doesn't really mean anything to me, so I thought I could get everything there. Seems apps is where Deployments live. /shrug maybe I should have known that?

I don't fully understand what the apiVersions are in k8s still. so it depends on how easy you want beginners to use your API. I was hoping the API would abstract away a lot of the need to understand fine grain details of how k8s works internally, but maybe that's just a mis-guided approach.

Also thanks for your help. I was able to get scale / set image working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants