Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmrodri/node-operator-sample
https://github.com/jmrodri/node-operator-sample
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jmrodri/node-operator-sample
- Owner: jmrodri
- Created: 2020-08-01T15:49:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-01T15:57:19.000Z (over 4 years ago)
- Last Synced: 2024-11-06T15:58:54.389Z (about 2 months ago)
- Language: TypeScript
- Size: 4.01 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Notes
The original implementation had the following error:
```
body: {
kind: 'Status',
apiVersion: 'v1',
metadata: {},
status: 'Failure',
message: 'Deployment.apps "" is invalid: [metadata.name: Required value: name or generateName is r
equired, spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string(
nil): `selector` does not match template `labels`, spec.template.spec.containers: Required value]',
reason: 'Invalid',
details: [Object],
code: 422
},
[Symbol(kCapture)]: false
```So when I printed `console.log(x)` it printed: `V1Deployment{}`. And there was
nothing created in the server:```
[jesusr@transam node-operator{master}]$ kubectl get deployment
No resources found.
[jesusr@transam node-operator{master}]$ kubectl get pod login
No resources found.
Error from server (NotFound): pods "login" not found
```I changed the creation of `deployment` from `let deployment =
V1Deployment({...})` to `let deployment = { ... }`.Then I ran it:
```
[jesusr@transam node-operator{master}]$ node main.ts
{
apiVersion: 'apps/v1',
kind: 'Deployment',
metadata: { name: 'login', namespace: 'default', labels: { app: 'login' } },
spec: {
replicas: 1,
selector: { matchLabels: [Object] },
template: { metadata: [Object], spec: [Object] }
}
}
V1Deployment {
...```
Then the resources were created in the cluster:
```
[jesusr@transam node-operator{master}]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
login 1/1 1 1 38s
[jesusr@transam node-operator{master}]$ kubectl get pod
NAME READY STATUS RESTARTS AGE
login-cf847475b-tzj87 1/1 Running 0 42s
```