Skip to content

Commit

Permalink
k8s: Gather all information from kind cluster
Browse files Browse the repository at this point in the history
Due to failing PostStart hook it seems that one of the Redpanda broker is in
degraded state and AdminAPI is not responsive. The Pod log collector does not
work if pod is in `PodInitializing` state.

To find more evidence what is happening kind export logs command was added.
It should be collected by the buildkite agent and served for later
investigations.

REF
redpanda-data#7396

(cherry picked from commit 441a967)
  • Loading branch information
Rafal Korepta authored and joejulian committed Apr 12, 2023
1 parent 816696c commit 09f3c58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
9 changes: 3 additions & 6 deletions src/go/k8s/apis/redpanda/v1alpha1/cluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,17 +684,14 @@ func (r *Cluster) validateRedpandaResources(

func (r *Cluster) validateLicense(old *Cluster) field.ErrorList {
var allErrs field.ErrorList
// Cluster has finalizers now, no validation if it is deleting
if r.GetDeletionTimestamp() != nil {
return allErrs
}
if l := r.Spec.LicenseRef; l != nil {
secret, err := l.GetSecret(context.Background(), kclient)
key := &SecretKeyRef{Namespace: l.Namespace, Name: l.Name, Key: l.Key}
secret, err := key.GetSecret(context.Background(), kclient)
if err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("licenseRef"), r.Spec.LicenseRef, err.Error()))
}
if secret != nil {
if _, err := l.GetValue(secret, DefaultLicenseSecretKey); err != nil {
if _, err := key.GetValue(secret, DefaultLicenseSecretKey); err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("licenseRef"), r.Spec.LicenseRef, err.Error()))
}
}
Expand Down
12 changes: 0 additions & 12 deletions src/go/k8s/apis/redpanda/v1alpha1/cluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,18 +633,6 @@ func TestValidateUpdate_NoError(t *testing.T) {
assert.Error(t, err)
})

t.Run("cluster can be deleted even if licenseRef not found", func(t *testing.T) {
license := redpandaCluster.DeepCopy()
license.Spec.LicenseRef = &v1alpha1.SecretKeyRef{Name: "notfound", Namespace: "notfound"}

// Set cluster to deleting state
now := metav1.Now()
license.SetDeletionTimestamp(&now)

err := license.ValidateUpdate(redpandaCluster)
assert.NoError(t, err)
})

decreaseCases := []struct {
initial string
target string
Expand Down
2 changes: 2 additions & 0 deletions src/go/k8s/tests/e2e/endpoint-template/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ collectors:
command: kubectl get clusters -o jsonpath={@} -n $NAMESPACE
- type: command
command: kubectl get pods -o jsonpath={@} -n $NAMESPACE
- type: command
command: kind export logs --name kind tests/_e2e_artifacts/endpoint-template

0 comments on commit 09f3c58

Please sign in to comment.