Skip to content

Commit 3721275

Browse files
committed
feat: convert remote-console service to Fabrica
Signed-off-by: Chris Harris <cjh@lbl.gov>
1 parent f340003 commit 3721275

43 files changed

Lines changed: 2398 additions & 413 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fabrica.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
project:
2+
name: remote-console
3+
module: github.com/OpenCHAMI/remote-console
4+
description: OpenCHAMI remote console service
5+
created: 2026-07-08T18:41:14.860713878Z
6+
features:
7+
validation:
8+
enabled: true
9+
mode: strict
10+
events:
11+
enabled: false
12+
bus_type: memory
13+
conditional:
14+
enabled: true
15+
etag_algorithm: sha256
16+
auth:
17+
enabled: true
18+
storage:
19+
enabled: false
20+
type: file
21+
db_driver: sqlite3
22+
reconciliation:
23+
enabled: false
24+
worker_count: 5
25+
requeue_delay: 5
26+
security:
27+
authn:
28+
enabled: true
29+
authz:
30+
enabled: false
31+
mode: enforce
32+
generation:
33+
handlers: true
34+
storage: false
35+
client: false
36+
openapi: true
37+
events: false
38+
middleware: true
39+
reconciliation: false

.github/workflows/integration_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
go-version-file: go.mod
1616
- name: Build remote-console binary for Dockerfile
1717
run: |
18-
go build -o remote-console ./cmd/remote-console
18+
go build -o remote-console ./cmd/server
1919
- name: Run integration tests
2020
run: |
2121
go test ./test -timeout 20m ./test

.github/workflows/unit_test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515
go-version-file: go.mod
1616
- name: Run unit tests
1717
run: |
18-
# Exclude the integration tests
19-
go test ./internal/...
18+
# Exclude Docker-backed integration tests in ./test.
19+
go test ./apis/... ./cmd/... ./internal/... ./pkg/...

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ before:
88

99
builds:
1010
- id: remote-console
11-
main: ./cmd/remote-console
11+
main: ./cmd/server
1212
binary: remote-console
1313
goos:
1414
- linux

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ RUN go env -w GO111MODULE=auto
4444

4545
# Copy source files
4646
COPY cmd $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd
47+
COPY apis $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/apis
4748
COPY configs configs
4849
COPY scripts scripts
4950
COPY internal $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/internal
51+
COPY pkg $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/pkg
5052
COPY go.mod $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.mod
5153
COPY go.sum $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.sum
5254

5355
# Build the image
54-
RUN set -ex && go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/remote-console -v -o /usr/local/bin/remote-console
56+
RUN set -ex && go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/server -v -o /usr/local/bin/remote-console
5557

5658
### Final Stage ###
5759
FROM ubuntu:24.04 AS final

Dockerfile.debug

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-bookworm
1+
FROM golang:1.26-bookworm
22

33
# Configure go env
44
ENV GOPATH=/usr/local/golib
@@ -8,14 +8,16 @@ RUN export CGO_ENABLED=0
88

99
# Copy source files
1010
COPY cmd $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd
11+
COPY apis $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/apis
1112
COPY configs configs
1213
COPY scripts scripts
1314
COPY internal $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/internal
15+
COPY pkg $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/pkg
1416
COPY go.mod $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.mod
1517
COPY go.sum $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/go.sum
1618

1719
# Build the image
18-
RUN go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/remote-console -v \
20+
RUN go build -C $GOPATH/src/github.com/OpenCHAMI/remote-console/v2/cmd/server -v \
1921
-gcflags=all="-N -l" \
2022
-o /usr/local/bin/remote-console
2123

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ VERSION ?= $(shell git describe --tags --always --abbrev=0)
88
GOLANGCI_LINT ?= golangci-lint
99
GO_PACKAGES ?= ./...
1010
TEST_PACKAGES ?= $(GO_PACKAGES)
11+
FABRICA ?= go run github.com/openchami/fabrica/cmd/fabrica
12+
FABRICA_GENERATE_ARGS ?=
1113

12-
.PHONY: all lint test image
14+
.PHONY: all lint test image generate format-generated
1315

1416
all : lint image
1517

@@ -22,3 +24,11 @@ test:
2224

2325
image:
2426
docker build --pull $(DOCKER_ARGS) --tag '$(NAME):$(VERSION)' .
27+
28+
generate:
29+
$(FABRICA) generate $(FABRICA_GENERATE_ARGS)
30+
$(MAKE) format-generated
31+
32+
format-generated:
33+
@files=$$(find apis cmd/server pkg/resources -name '*.go' -type f 2>/dev/null); \
34+
if [ -n "$$files" ]; then gofmt -w $$files; fi

apis.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
groups:
2+
- name: remote-console.openchami.io
3+
storageVersion: v1
4+
versions:
5+
- v1
6+
resources:
7+
Console:
8+
path: /remote-console/consoles
9+
operations:
10+
- list
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright © 2026 OpenCHAMI a Series of LF Projects, LLC
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
package v1
6+
7+
import "github.com/openchami/fabrica/pkg/fabrica"
8+
9+
// Console represents a console resource
10+
type Console struct {
11+
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
12+
Kind string `json:"kind" yaml:"kind"`
13+
Metadata fabrica.Metadata `json:"metadata" yaml:"metadata"`
14+
Spec ConsoleSpec `json:"spec" yaml:"spec" validate:"required"`
15+
}
16+
17+
// ConsoleSpec defines the desired state of Console
18+
type ConsoleSpec struct {
19+
ConnectionType string `json:"connectionType" yaml:"connectionType"`
20+
ConnectionHost string `json:"connectionHost" yaml:"connectionHost"`
21+
ConnectionPort int `json:"connectionPort" yaml:"connectionPort"`
22+
ConsoleEntryCommand string `json:"consoleEntryCommand,omitempty" yaml:"consoleEntryCommand,omitempty"`
23+
}
24+
25+
// GetKind returns the kind of the resource
26+
func (r *Console) GetKind() string {
27+
return "Console"
28+
}
29+
30+
// GetName returns the name of the resource
31+
func (r *Console) GetName() string {
32+
return r.Metadata.Name
33+
}
34+
35+
// GetUID returns the UID of the resource
36+
func (r *Console) GetUID() string {
37+
return r.Metadata.UID
38+
}
39+
40+
// IsHub marks this as the hub/storage version
41+
func (r *Console) IsHub() {}

authz/grouping.csv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: MIT
2+
# SPDX-FileCopyrightText: 2025-2026 OpenCHAMI a Series of LF Projects, LLC
3+
# Starter grouping policy for Fabrica-generated services.
4+
#
5+
# TokenSmith's authorizer evaluates role subjects directly (role:<name>).
6+
# Use grouping for role inheritance so broader roles automatically include the
7+
# permissions of narrower roles.
8+
9+
g, role:editor, role:viewer
10+
g, role:admin, role:editor

0 commit comments

Comments
 (0)