Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benwh committed Dec 12, 2023
1 parent b086cd7 commit 5722ce7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 8 additions & 2 deletions cmd/acceptance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
prepareImage = prepare.Flag("image", "Docker image tag used for exchanging test images").Default("theatre:latest").String()
prepareConfigFile = prepare.Flag("config-file", "Path to Kind config file").Default("kind-e2e.yaml").ExistingFile()
prepareDockerfile = prepare.Flag("dockerfile", "Path to acceptance dockerfile").Default("Dockerfile").ExistingFile()
prepareKindNodeImage = prepare.Flag("kind-node-image", "Kind Node Image").Default("kindest/node:v1.24.13").String()
prepareKindNodeImage = prepare.Flag("kind-node-image", "Kind Node Image").Default("kindest/node:v1.27.3").String()
prepareVerbose = prepare.Flag("verbose", "Use a higher log level when creating the cluster").Short('v').Bool()

destroy = app.Command("destroy", "Destroys the test Kubernetes cluster and other resources")
Expand Down Expand Up @@ -138,8 +138,14 @@ func main() {
contextTimeout := 3 * time.Minute
ctx, deadline := context.WithTimeout(ctx, contextTimeout)
defer deadline()
waitCmd := exec.CommandContext(ctx, "kubectl", "--context", fmt.Sprintf("kind-%s", *clusterName), "wait", "--all-namespaces", "--for", "condition=Ready", "pods", "--all", "--timeout", "2m")

// Deployments
waitCmd := exec.CommandContext(ctx, "kubectl", "--context", fmt.Sprintf("kind-%s", *clusterName), "wait", "--all-namespaces", "--for", "condition=Available", "deployments", "--all", "--timeout", "2m")
if err := pipeOutput(waitCmd).Run(); err != nil {
app.Fatalf("not all setup resources are running: %v", err)
}
// Pods - covers those created by Statefulsets
waitCmd = exec.CommandContext(ctx, "kubectl", "--context", fmt.Sprintf("kind-%s", *clusterName), "wait", "--all-namespaces", "--for", "condition=Ready", "pods", "--all", "--timeout", "2m")
if err := pipeOutput(waitCmd).Run(); err != nil {
app.Fatalf("not all setup resources are running: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions controllers/rbac/directoryrolebinding/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/go-logr/logr"
rbacv1 "k8s.io/api/rbac/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -113,7 +112,7 @@ func (r *DirectoryRoleBindingReconciler) SetupWithManager(mgr manager.Manager) e
For(&rbacv1alpha1.DirectoryRoleBinding{}).
Watches(
&rbacv1.RoleBinding{},
handler.EnqueueRequestForOwner(r.Scheme, &meta.DefaultRESTMapper{}, &rbacv1alpha1.DirectoryRoleBinding{}, handler.OnlyControllerOwner()),
handler.EnqueueRequestForOwner(r.Scheme, mgr.GetRESTMapper(), &rbacv1alpha1.DirectoryRoleBinding{}, handler.OnlyControllerOwner()),
).
Complete(
recutil.ResolveAndReconcile(
Expand Down
5 changes: 2 additions & 3 deletions controllers/workloads/console/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -114,14 +113,14 @@ func (r *ConsoleReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manag
).
Watches(
&workloadsv1alpha1.ConsoleAuthorisation{},
handler.EnqueueRequestForOwner(r.Scheme, &meta.DefaultRESTMapper{}, &workloadsv1alpha1.Console{}, handler.OnlyControllerOwner()),
handler.EnqueueRequestForOwner(r.Scheme, mgr.GetRESTMapper(), &workloadsv1alpha1.Console{}, handler.OnlyControllerOwner()),
// Don't unnecessarily reconcile when the controller initially creates the
// authorisation object.
builder.WithPredicates(IgnoreCreatePredicate{}),
).
Watches(
&batchv1.Job{},
handler.EnqueueRequestForOwner(r.Scheme, &meta.DefaultRESTMapper{}, &workloadsv1alpha1.Console{}, handler.OnlyControllerOwner()),
handler.EnqueueRequestForOwner(r.Scheme, mgr.GetRESTMapper(), &workloadsv1alpha1.Console{}, handler.OnlyControllerOwner()),
).
Complete(
recutil.ResolveAndReconcile(
Expand Down

0 comments on commit 5722ce7

Please sign in to comment.