这是indexloc提供的服务,不要输入任何密码
Skip to content

Cleanup "kn service export" data #1586

@rhuss

Description

@rhuss

Currentl kn service export export services, but does not cleanup everything. Some default values are still contained like in:

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/acceptedIssues which should be fixed (post-triage)

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions