Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2318 from njhale/job-ports
Browse files Browse the repository at this point in the history
Enable generating endpoints with paths and exposing job ports.
  • Loading branch information
njhale authored Nov 4, 2023
2 parents ba42df7 + ef0ed60 commit 1849371
Show file tree
Hide file tree
Showing 23 changed files with 646 additions and 18 deletions.
1 change: 1 addition & 0 deletions pkg/apis/internal.acorn.io/v1/appinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ type Endpoint struct {
Address string `json:"address,omitempty"`
Protocol Protocol `json:"protocol,omitempty"`
PublishProtocol PublishProtocol `json:"publishProtocol,omitempty"`
Path string `json:"path,omitempty"`
Pending bool `json:"pending,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions pkg/apis/internal.acorn.io/v1/appspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func (in PortDef) FormatString(serviceName string) string {

type PortDef struct {
Hostname string `json:"hostname,omitempty"`
Path string `json:"path,omitempty"`
Protocol Protocol `json:"protocol,omitempty"`
Publish bool `json:"publish,omitempty"`
Dev bool `json:"dev,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/internal.acorn.io/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type PortPublish struct {
Port int32 `json:"port,omitempty"`
Protocol Protocol `json:"protocol,omitempty"`
Hostname string `json:"hostname,omitempty"`
Path string `json:"path,omitempty"`
TargetPort int32 `json:"targetPort,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions pkg/appdefinition/app.acorn
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
port?: int
targetPort?: int
protocol?: enum("tcp", "udp", "http", "http2")
path?: string =~ "^/.*"
}

Metrics: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,41 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
acorn.io/public-name: app-name.oneimage
name: oneimage-job
namespace: app-created-namespace
spec:
appName: app-name
appNamespace: app-namespace
container: oneimage
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
ports:
- port: 80
protocol: http
targetPort: 81
- port: 90
protocol: tcp
targetPort: 91
status: {}

---
apiVersion: internal.acorn.io/v1
kind: AppInstance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,47 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job-name
acorn.io/managed: "true"
acorn.io/public-name: app-name.job-name
name: job-name-job
namespace: app-created-namespace
spec:
annotations:
admit-job.io: test-admit-job-ann
admit.io: test-admit-app-spec-ann
allowed-global.io: test-global
allowed.io: test-allowed-app-spec-ann
appName: app-name
appNamespace: app-namespace
container: job-name
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job-name
acorn.io/managed: "true"
allowed-global.io: test-global
allowed-job.io: test-allowed-job-label
allowed.io: test-allowed-app-spec-label
permit.io: test-permit-app-spec-label
ports:
- port: 80
protocol: http
targetPort: 81
status: {}

---
apiVersion: v1
kind: PersistentVolumeClaim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,45 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job-name
acorn.io/managed: "true"
acorn.io/public-name: app-name.job-name
name: job-name-job
namespace: app-created-namespace
spec:
annotations:
appSpecAnn: test-app-spec-ann
global-scoped-ann: test-global
jobAnn: test-job-ann
appName: app-name
appNamespace: app-namespace
container: job-name
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job-name
acorn.io/managed: "true"
appSpecLabel: test-app-spec-label
global-scoped-label: test-global
jobLabel: test-job-label
ports:
- port: 80
protocol: http
targetPort: 81
status: {}

---
apiVersion: v1
kind: PersistentVolumeClaim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,38 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job-name
acorn.io/managed: "true"
acorn.io/public-name: app-name.job-name
name: job-name-job
namespace: app-created-namespace
spec:
appName: app-name
appNamespace: app-namespace
container: job-name
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job-name
acorn.io/managed: "true"
ports:
- port: 80
protocol: http
targetPort: 81
status: {}

---
apiVersion: v1
kind: PersistentVolumeClaim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,41 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
acorn.io/public-name: app-name.oneimage
name: oneimage-job
namespace: app-created-namespace
spec:
appName: app-name
appNamespace: app-namespace
container: oneimage
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
ports:
- port: 80
protocol: http
targetPort: 81
- port: 90
protocol: tcp
targetPort: 91
status: {}

---
apiVersion: internal.acorn.io/v1
kind: AppInstance
Expand Down
35 changes: 35 additions & 0 deletions pkg/controller/appdefinition/testdata/job/basic/expected.golden
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,41 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
acorn.io/public-name: app-name.oneimage
name: oneimage-job
namespace: app-created-namespace
spec:
appName: app-name
appNamespace: app-namespace
container: oneimage
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
ports:
- port: 80
protocol: http
targetPort: 81
- port: 90
protocol: tcp
targetPort: 91
status: {}

---
apiVersion: internal.acorn.io/v1
kind: AppInstance
Expand Down
43 changes: 43 additions & 0 deletions pkg/controller/appdefinition/testdata/job/labels/expected.golden
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,49 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job1
acorn.io/managed: "true"
acorn.io/public-name: app-name.job1
name: job1-job
namespace: app-created-namespace
spec:
annotations:
alljobsa: value
global2a: value
globala: value
job1a: value
job3a: value
appName: app-name
appNamespace: app-namespace
container: job1
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: job1
acorn.io/managed: "true"
alljobs: value
global: value
global2: value
job1: value
job3: value
ports:
- port: 80
protocol: http
targetPort: 81
status: {}

---
apiVersion: internal.acorn.io/v1
kind: AppInstance
Expand Down
35 changes: 35 additions & 0 deletions pkg/controller/appdefinition/testdata/memory/job/expected.golden
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,41 @@ spec:
name: acorn-job-output-helper
status: {}

---
apiVersion: internal.acorn.io/v1
kind: ServiceInstance
metadata:
annotations:
acorn.io/app-generation: "0"
acorn.io/config-hash: ""
creationTimestamp: null
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
acorn.io/public-name: app-name.oneimage
name: oneimage-job
namespace: app-created-namespace
spec:
appName: app-name
appNamespace: app-namespace
container: oneimage
default: false
labels:
acorn.io/app-name: app-name
acorn.io/app-namespace: app-namespace
acorn.io/job-name: oneimage
acorn.io/managed: "true"
ports:
- port: 80
protocol: http
targetPort: 81
- port: 90
protocol: tcp
targetPort: 91
status: {}

---
apiVersion: internal.acorn.io/v1
kind: AppInstance
Expand Down
Loading

0 comments on commit 1849371

Please sign in to comment.