Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PodCheckpoint with long (>63 characters) CR name fail to be processed #20

Open
tekenstam opened this issue Jun 25, 2020 · 1 comment
Open

Comments

@tekenstam
Copy link
Member

Is this a BUG REPORT or FEATURE REQUEST?:
BUG

What happened:
When submitting a PodCheckpoint, if the name is long (>63 characters) then the PodCheckpoint will fail to process.

{"level":"error","ts":1593128067.005712,"logger":"kubebuilder.controller","msg":"Reconciler error","controller":"podsavestate-controller","request":"forensics-system/podsavestate-long-name-123456789012345678901234567890123456789012345678901234567890","error":"Job.batch \"podsavestate-long-name-123456789012345678901234567890123456789012345678901234567890-job\" is invalid: spec.template.labels: Invalid value: \"podsavestate-long-name-123456789012345678901234567890123456789012345678901234567890-job\": must be no more than 63 characters","stacktrace":"github.intuit.com/kubernetes/pod-savestate/vendor/github.com/go-logr/zapr.(*zapLogger).Error\n\t/go/src/github.intuit.com/kubernetes/pod-savestate/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.intuit.com/kubernetes/pod-savestate/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/src/github.intuit.com/kubernetes/pod-savestate/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:217\ngithub.intuit.com/kubernetes/pod-savestate/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1\n\t/go/src/github.intuit.com/kubernetes/pod-savestate/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158\ngithub.intuit.com/kubernetes/pod-savestate/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/go/src/github.intuit.com/kubernetes/pod-savestate/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133\ngithub.intuit.com/kubernetes/pod-savestate/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/go/src/github.intuit.com/kubernetes/pod-savestate/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134\ngithub.intuit.com/kubernetes/pod-savestate/vendor/k8s.io/apimachinery/pkg/util/wait.Until\n\t/go/src/github.intuit.com/kubernetes/pod-savestate/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}

What you expected to happen:
PodCheckpoint should be allowed to have long names. Instead of creating a Job with a name based on the PodCheckpoint name (just appending -job), the controller should check the length. If the length is >60 characters, get a short hash of the PodCheckpoint name and name the job by truncating the name of the PodCheckpoint an appropriate amount and then prepending the hash and -job such that the resulting length of the job name is <64 characters.

How to reproduce it (as minimally and precisely as possible):

apiVersion: forensics.keikoproj.io/v1alpha1
kind: PodCheckpoint
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
  name: podsavestate-long-name-123456789012345678901234567890123456789012345678901234567890
  namespace: forensics-system
spec:
  destination: s3://kops-state-store-999999999-us-west-2
  subpath: tee-test.cluster.k8s.local
  pod: debug-pod
  namespace: default

Anything else we need to know?:

Environment:

  • kube-forensics version
  • Kubernetes version :
$ kubectl version -o yaml

Other debugging information (if applicable):

  • PodCheckpoint status:
$ kubectl describe -n forensics-system podcheckpoint <checkpoint-name>
  • controller logs:
$ kubectl logs -n forensics-system <forensics-controller-manager pod>
@tekenstam
Copy link
Member Author

As part of fixing this issue and validating the job name, should also replace any dots (.) with dashes (-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant