Cleanup "kn service export" data
- Dominant language
- Go
- Stars
- 387
- Forks
- 274
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 8
Description
Currentl `kn service export` export services, but does not cleanup everything. Some default values are still contained like in:
```yaml
apiVersion: client.knative.dev/v1alpha1
kind: Export
metadata:
creationTimestamp: null
spec:
revisions: null
service:
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
creationTimestamp: null
name: demo
spec:
template:
metadata:
annotations:
client.knative.dev/user-image: rhuss/random:1.0
creationTimestamp: null
spec:
containerConcurrency: 0
containers:
- env:
- name: foo
value: bar
- name: blub
value: bla
image: index.docker.io/rhuss/random@sha256:946b7ca7f880ca38e4930cd625d4533616bba75f5fafde132cc3b7e7ae3a18b5
name: user-container
readinessProbe:
successThreshold: 1
tcpSocket:
port: 0
resources: {}
enableServiceLinks: false
timeoutSeconds: 300
status: {}
```
* `creationTimestamp` should be removed
* Remove `status:` section
* Readiness Probe can be removed, too, if its the default (tricky)
* `user-container` name can be removed
* `revisions:` section can be removed
---------------
For the "replay" format:
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
creationTimestamp: null
name: demo
spec:
template:
metadata:
annotations:
client.knative.dev/user-image: rhuss/random:1.0
creationTimestamp: null
spec:
containerConcurrency: 0
containers:
- env:
- name: foo
value: bar
- name: blub
value: bla
image: index.docker.io/rhuss/random@sha256:946b7ca7f880ca38e4930cd625d4533616bba75f5fafde132cc3b7e7ae3a18b5
name: user-container
readinessProbe:
successThreshold: 1
tcpSocket:
port: 0
resources: {}
enableServiceLinks: false
timeoutSeconds: 300
status: {}
```
As above, plus
* `enableServiceLinks` and `timeoutSeconds` could be removed if they reflect the default. Again, this is tricky as how should we know when this is default or not ?
* the empty `resources:` can be removed
Contributor guide
Research direction
Start with the implementation of the `kn service export` command and its replay output, then inspect how Kubernetes service objects are serialized. Compare both formats with the examples and verify that metadata defaults, status, revisions, probes, container names, resources, and replay defaults are omitted only when appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100