Code Monkey home page Code Monkey logo

Comments (2)

ostlerc avatar ostlerc commented on May 23, 2024 1

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.

from k8s.

ericchiang avatar ericchiang commented on May 23, 2024

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

from k8s.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.