Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ kind-create: kind ## 🐋 Create kind cluster with rig dependencies
kind-load: kind docker ## 🐋 Load docker image into kind cluster
$(KIND) load docker-image ghcr.io/rigdev/rig-operator:$(TAG) -n rig

.PHONY: kind-load-platform
kind-load-platform: kind docker ## 🐋 Load docker image into kind cluster
$(KIND) load docker-image ghcr.io/rigdev/rig-platform:$(TAG) -n rig

.PHONY: kind-deploy
kind-deploy: kind kind-load deploy-operator ## 🐋 Deploy rig to kind cluster
$(KUBECTL) rollout restart deployment -n rig-system rig-operator
Expand Down
2 changes: 1 addition & 1 deletion cmd/rig/cmd/capsule/instance/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func (c Cmd) get(cmd *cobra.Command, args []string) error {
ctx := c.Ctx
resp, err := c.Rig.Capsule().ListInstanceStatuses(ctx, connect.NewRequest(&capsule.ListInstanceStatusesRequest{
resp, err := c.Rig.Capsule().ListAllCurrentInstanceStatuses(ctx, connect.NewRequest(&capsule.ListAllCurrentInstanceStatusesRequest{
CapsuleId: cmd_capsule.CapsuleID,
Pagination: &model.Pagination{
Offset: uint32(offset),
Expand Down
3 changes: 2 additions & 1 deletion cmd/rig/cmd/dev/kind/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ func (c Cmd) deploy(cmd *cobra.Command, args []string) error {
"--set", "postgres.enabled=true",
"--set", "rig.cluster.dev_registry.host=localhost:30000",
"--set", "rig.cluster.dev_registry.cluster_host=registry:5000",
"--set", "service.type=NodePort"},
"--set", "service.type=NodePort",
"--set", "rig-operator.enabled=false"},
}); err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions deploy/charts/rig-operator/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
properties:
configMap:
description: FileContentRef defines the name of a config resource
and the key which from which to retrieve the contents
and the key from which to retrieve the contents
properties:
key:
type: string
Expand All @@ -69,7 +69,7 @@ spec:
type: string
secret:
description: FileContentRef defines the name of a config resource
and the key which from which to retrieve the contents
and the key from which to retrieve the contents
properties:
key:
type: string
Expand Down Expand Up @@ -150,6 +150,9 @@ spec:
description: CapsuleInterfaceLoadBalancer defines that the
interface should be exposed as a L4 loadbalancer
properties:
nodePort:
format: int32
type: integer
port:
format: int32
maximum: 65535
Expand Down Expand Up @@ -215,6 +218,8 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
serviceAccountName:
type: string
required:
- image
type: object
Expand Down
39 changes: 39 additions & 0 deletions deploy/charts/rig-platform/templates/capsule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: rig.dev/v1alpha1
kind: Capsule
metadata:
name: rig-platform
spec:
horizontalScale:
{{- if .Values.autoscaling.enabled }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
cpuTarget:
averageUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- else }}
minReplicas: {{ .Values.replicaCount }}
maxReplicas: {{ .Values.replicaCount }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
interfaces:
- name: http
port: {{ .Values.service.port }}
public:
loadBalancer:
port: {{ .Values.service.port }}
nodePort: {{ .Values.service.nodePort }}
{{- if .Values.ingress.enabled }}
name: http-ingress
port: {{ $.Values.service.port }}
public:
ingress:
host: .Values.ingress.host
{{- end}}
files:
- path: /etc/rig/server-config.yaml
secret:
name: {{ include "rig-platform.fullname" . }}
key: server-config.yaml
{{- with .Values.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
serviceAccountName: rig-platform
11 changes: 11 additions & 0 deletions deploy/charts/rig-platform/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: rig-platform
data:
{{- if .Values.postgres.enabled }}
RIG_CLIENT_POSTGRES_HOST: rig-platform-postgres:5432
{{- end }}
{{- if .Values.mongodb.enabled }}
RIG_CLIENT_MONGO_HOST: rig-platform-mongodb:27017
{{- end }}
89 changes: 0 additions & 89 deletions deploy/charts/rig-platform/templates/deployment.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions deploy/charts/rig-platform/templates/hpa.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions deploy/charts/rig-platform/templates/ingress.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions deploy/charts/rig-platform/templates/service.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/charts/rig-platform/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mongodb:
size: 10Gi

postgres:
enabled: false
enabled: true
image:
repository: postgres
tag: 16
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/google/go-containerregistry v0.16.1
github.com/jedib0t/go-pretty/v6 v6.4.6
github.com/lithammer/fuzzysearch v1.1.8
github.com/rigdev/rig-go-api v0.0.0-20231002140905-118e2e6c7793
github.com/rigdev/rig-go-api v0.0.0-20231010072119-250879c71e03
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11
github.com/rodaine/table v1.1.0
sigs.k8s.io/controller-runtime v0.16.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
github.com/rigdev/rig-go-api v0.0.0-20231002140905-118e2e6c7793 h1:2wK9WwBAj1M+51GslB30+1vB7nrgEXL15cCTsEYQLVM=
github.com/rigdev/rig-go-api v0.0.0-20231002140905-118e2e6c7793/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-api v0.0.0-20231010072119-250879c71e03 h1:m1bR2Qvy+aasKlOab1octBaUGHSS6gF4BKVnImuykaY=
github.com/rigdev/rig-go-api v0.0.0-20231010072119-250879c71e03/go.mod h1:fraLUk9ekeQvvu5bOmUmpNAsBqG2QzqWU9wzGbPwB/w=
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11 h1:cdW4OYPgzr+iMzsqPCLDTRa37rpTRD2OUxhbPApzHss=
github.com/rigdev/rig-go-sdk v0.0.0-20230918110956-2301fcd9da11/go.mod h1:CtN3BUZJfONEGNuVnoewrKHGSHF/XS5OsHxzkA9ToI4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down
22 changes: 12 additions & 10 deletions pkg/api/v1alpha1/capsule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ type CapsuleSpec struct {
Replicas *int32 `json:"replicas,omitempty"`
Image string `json:"image"`

Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Interfaces []CapsuleInterface `json:"interfaces,omitempty"`
Files []File `json:"files,omitempty"`
Resources *v1.ResourceRequirements `json:"resources,omitempty"`
ImagePullSecret *v1.LocalObjectReference `json:"imagePullSecret,omitempty"`
HorizontalScale HorizontalScale `json:"horizontalScale,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Interfaces []CapsuleInterface `json:"interfaces,omitempty"`
Files []File `json:"files,omitempty"`
Resources *v1.ResourceRequirements `json:"resources,omitempty"`
ImagePullSecret *v1.LocalObjectReference `json:"imagePullSecret,omitempty"`
HorizontalScale HorizontalScale `json:"horizontalScale,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

// CapsuleInterface defines an interface for a capsule
Expand Down Expand Up @@ -46,7 +47,8 @@ type CapsuleInterfaceIngress struct {
type CapsuleInterfaceLoadBalancer struct {
//+kubebuilder:validation:Minimum=1
//+kubebuilder:validation:Maximum=65535
Port int32 `json:"port"`
Port int32 `json:"port"`
NodePort int32 `json:"nodePort,omitempty"`
}

// File defines a mounted file and where to retrieve the contents from
Expand All @@ -56,8 +58,8 @@ type File struct {
Secret *FileContentRef `json:"secret,omitempty"`
}

// FileContentRef defines the name of a config resource and the key which from
// which to retrieve the contents
// FileContentRef defines the name of a config resource and the key from which
// to retrieve the contents
type FileContentRef struct {
Name string `json:"name"`
Key string `json:"key"`
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/v1alpha1/capsule_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ func (r *Capsule) validateInterfaces() (admission.Warnings, field.ErrorList) {
if public.Ingress != nil && public.Ingress.Host == "" {
errs = append(errs, field.Required(publicPath.Child("ingress").Child("host"), ""))
}
if public.LoadBalancer != nil {
p := public.LoadBalancer.NodePort
if p > 0 && (p < 30000 || p > 32767) {
errs = append(errs, field.Invalid(publicPath.Child("loadBalancer").Child("nodePort"), p, "nodePort must be in the range [30,000; 32,767]"))
}
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/controller/capsule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func createDeployment(
Ports: ports,
},
},
Volumes: volumes,
ServiceAccountName: capsule.Spec.ServiceAccountName,
Volumes: volumes,
},
},
},
Expand Down Expand Up @@ -684,6 +685,7 @@ func createLoadBalancer(
Name: inf.Name,
Port: inf.Public.LoadBalancer.Port,
TargetPort: intstr.FromString(inf.Name),
NodePort: inf.Public.LoadBalancer.NodePort,
})
}
}
Expand Down
Loading