Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions cmd/ate-env/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,19 @@ func prune(v any) any {
}
}

// apiAccessLabel is the namespace label Substrate's network policy requires of
// in-cluster API clients: ate-system denies ingress by default and admits
// non-worker pods from namespaces carrying it (substrate #2522). Without it
// ate-env-api cannot reach ateapi and crash-loops on its startup atespace check.
const apiAccessLabel = "ate.dev/api-access"

func buildNamespace(cfg manifestConfig) *corev1.Namespace {
return &corev1.Namespace{
TypeMeta: metav1.TypeMeta{APIVersion: "v1", Kind: "Namespace"},
ObjectMeta: metav1.ObjectMeta{Name: cfg.namespace},
TypeMeta: metav1.TypeMeta{APIVersion: "v1", Kind: "Namespace"},
ObjectMeta: metav1.ObjectMeta{
Name: cfg.namespace,
Labels: map[string]string{apiAccessLabel: "true"},
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/ate-env/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ func TestBuildManifests(t *testing.T) {
if ns.Name != "ate-env" {
t.Errorf("namespace = %q, want ate-env", ns.Name)
}
if got := ns.Labels[apiAccessLabel]; got != "true" {
t.Errorf("namespace label %s = %q, want \"true\" (ate-system admits API clients by it)", apiAccessLabel, got)
}

pool := objs[1].(*atev1alpha1.WorkerPool)
if pool.Namespace != cfg.namespace || pool.Name != "default-template-workerpool" {
Expand Down Expand Up @@ -210,6 +213,7 @@ func TestWriteManifests(t *testing.T) {
}
for _, want := range []string{
"kind: Namespace",
"ate.dev/api-access: \"true\"",
"kind: WorkerPool",
"kind: Deployment",
"kind: Service",
Expand Down
Loading