Skip to content

Instantly share code, notes, and snippets.

@wzhliang
Created October 30, 2020 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wzhliang/8d66ab4d2e7c11d63174f753477c4dd7 to your computer and use it in GitHub Desktop.
Save wzhliang/8d66ab4d2e7c11d63174f753477c4dd7 to your computer and use it in GitHub Desktop.
function KubeObj(name, kind) {
return {
"name": name,
"kind": kind,
sayHello: function() {
console.log(`Hello from ${this.name}`)
},
}
}
function WorkLoad(name, kind, image) {
const me = KubeObj(name, kind)
return Object.assign({}, me, {
"image": image,
deploy: function() {
console.log(`${this.name}: Deploying ${this.image}...`)
}
})
}
let svc = KubeObj("abc", "Service")
svc.sayHello()
let dep = WorkLoad("www", "Deployment", "nginx")
dep.sayHello()
dep.deploy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment