Skip to content

Commit

Permalink
add network to component model
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsgstrabo committed Sep 25, 2024
1 parent cd1c04e commit 2702622
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/deployments/models/component_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type componentBuilder struct {
resources *radixv1.ResourceRequirements
runtime *radixv1.Runtime
replicasOverride *int
network *Network
}

func (b *componentBuilder) WithStatus(status ComponentStatus) ComponentBuilder {
Expand Down Expand Up @@ -265,6 +266,7 @@ func (b *componentBuilder) BuildComponent() (*Component, error) {
CommitID: variables[defaults.RadixCommitHashEnvironmentVariable],
GitTags: variables[defaults.RadixGitTagsEnvironmentVariable],
Runtime: b.buildRuntimeModel(),
Network: b.network,
}
if b.resources != nil && (len(b.resources.Limits) > 0 || len(b.resources.Requests) > 0) {
component.Resources = pointers.Ptr(ConvertRadixResourceRequirements(*b.resources))
Expand Down
32 changes: 32 additions & 0 deletions api/deployments/models/component_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,38 @@ type Component struct {

// Runtime requirements for the component or job
Runtime *Runtime `json:"runtime,omitempty"`

// Network configuration for the component
//
// required: false
Network *Network `json:"network,omitempty"`
}

// Network describes network configuration for a component
// swagger:model Network
type Network struct {
// Ingress configuration
//
// required: false
Ingress *Ingress `json:"ingress,omitempty"`
}

// Ingress describes ingress configuration for a component
// swagger:model Ingress
type Ingress struct {
// Public ingress configuration
//
// required: false
Public *IngressPublic `json:"public,omitempty"`
}

// IngressPublic describes public ingress configuration for a component
// swagger:model IngressPublic
type IngressPublic struct {
// List of allowed IP addresses or CIDRs. All traffic is allowed if list is empty.
//
// required: true
Allow []string `json:"allow"`
}

// ExternalDNS describes an external DNS entry for a component
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/cert-manager/cert-manager v1.15.0
github.com/equinor/radix-common v1.9.5
github.com/equinor/radix-job-scheduler v1.11.0
github.com/equinor/radix-operator v1.59.1
github.com/equinor/radix-operator v1.61.0
github.com/evanphx/json-patch/v5 v5.9.0
github.com/felixge/httpsnoop v1.0.4
github.com/golang-jwt/jwt/v5 v5.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ github.com/equinor/radix-common v1.9.5 h1:p1xldkYUoavwIMguoxxOyVkOXLPA6K8qMsgzez
github.com/equinor/radix-common v1.9.5/go.mod h1:+g0Wj0D40zz29DjNkYKVmCVeYy4OsFWKI7Qi9rA6kpY=
github.com/equinor/radix-job-scheduler v1.11.0 h1:8wCmXOVl/1cto8q2WJQEE06Cw68/QmfoifYVR49vzkY=
github.com/equinor/radix-job-scheduler v1.11.0/go.mod h1:yPXn3kDcMY0Z3kBkosjuefsdY1x2g0NlBeybMmHz5hc=
github.com/equinor/radix-operator v1.59.1 h1:wzb2tF4MWtGDWmyYuIv3oh17G5Bx8ztW9O+WgnI3QFc=
github.com/equinor/radix-operator v1.59.1/go.mod h1:uRW9SgVZ94hkpq87npVv2YVviRuXNJ1zgCleya1uvr8=
github.com/equinor/radix-operator v1.61.0 h1:kHWHn5p9S+wKqOTSKtju2URW5FKgAFng1p6RLRnaTmE=
github.com/equinor/radix-operator v1.61.0/go.mod h1:uRW9SgVZ94hkpq87npVv2YVviRuXNJ1zgCleya1uvr8=
github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls=
github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
Expand Down
41 changes: 41 additions & 0 deletions swaggerui/html/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5747,6 +5747,9 @@
"x-go-name": "Name",
"example": "server"
},
"network": {
"$ref": "#/definitions/Network"
},
"notifications": {
"$ref": "#/definitions/Notifications"
},
Expand Down Expand Up @@ -6629,6 +6632,34 @@
},
"x-go-package": "github.com/equinor/radix-api/api/privateimagehubs/models"
},
"Ingress": {
"description": "Ingress describes ingress configuration for a component",
"type": "object",
"properties": {
"public": {
"$ref": "#/definitions/IngressPublic"
}
},
"x-go-package": "github.com/equinor/radix-api/api/deployments/models"
},
"IngressPublic": {
"description": "IngressPublic describes public ingress configuration for a component",
"type": "object",
"required": [
"allow"
],
"properties": {
"allow": {
"description": "List of allowed IP addresses or CIDRs. All traffic is allowed if list is empty.",
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "Allow"
}
},
"x-go-package": "github.com/equinor/radix-api/api/deployments/models"
},
"Job": {
"description": "Job holds general information about job",
"type": "object",
Expand Down Expand Up @@ -6887,6 +6918,16 @@
},
"x-go-package": "github.com/equinor/radix-api/api/jobs/models"
},
"Network": {
"description": "Network describes network configuration for a component",
"type": "object",
"properties": {
"ingress": {
"$ref": "#/definitions/Ingress"
}
},
"x-go-package": "github.com/equinor/radix-api/api/deployments/models"
},
"Node": {
"description": "Node Defines node attributes, where pod should be scheduled",
"type": "object",
Expand Down

0 comments on commit 2702622

Please sign in to comment.