Skip to content

Commit

Permalink
Use Region Controller (#79)
Browse files Browse the repository at this point in the history
Separate out the region and provider related stuff so that it can be
resued by other services, for example a baremetal service for those with
time to burn.
  • Loading branch information
spjmurray authored Jun 11, 2024
1 parent 31953f2 commit fa8db40
Show file tree
Hide file tree
Showing 41 changed files with 526 additions and 3,590 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ helm repo add jetstack https://charts.jetstack.io
helm repo add nginx https://helm.nginx.com/stable
helm repo update
helm install cert-manager jetstack/cert-manager -v v1.10.1 -n cert-manager --create-namespace
helm install nginx-ingress nginx/nginx-ingress -v 0.16.1 -n nginx-ingress --create-namespace
helm install nginx-ingress nginx/nginx-ingress -v 0.16.1 -n nginx-ingress --create-namespace --set controller.ingressClassResource.default=true
```
</details>

Expand Down
21 changes: 10 additions & 11 deletions charts/unikorn/crds/unikorn-cloud.org_kubernetesclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ spec:
overrides the default ephemeral disk size defined in the flavor.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
flavor:
flavorId:
description: Flavor is the OpenStack Nova flavor to deploy with.
type: string
image:
imageId:
description: Image is the OpenStack Glance image to deploy with.
type: string
replicas:
Expand All @@ -302,8 +302,8 @@ spec:
on a per machine deployment basis.
type: string
required:
- flavor
- image
- flavorId
- imageId
type: object
features:
description: Features defines add-on features that can be enabled
Expand Down Expand Up @@ -394,12 +394,11 @@ spec:
required:
- cloud
- cloudConfig
- externalNetworkId
type: object
pause:
description: Pause, if true, will inhibit reconciliation.
type: boolean
region:
regionId:
description: Region to provision the cluster in.
type: string
version:
Expand Down Expand Up @@ -521,11 +520,11 @@ spec:
- path
type: object
type: array
flavor:
flavorId:
description: Flavor is the OpenStack Nova flavor to deploy
with.
type: string
image:
imageId:
description: Image is the OpenStack Glance image to deploy
with.
type: string
Expand Down Expand Up @@ -555,8 +554,8 @@ spec:
on a per machine deployment basis.
type: string
required:
- flavor
- image
- flavorId
- imageId
- name
type: object
type: array
Expand All @@ -567,7 +566,7 @@ spec:
- controlPlane
- network
- openstack
- region
- regionId
- version
- workloadPools
type: object
Expand Down
7 changes: 1 addition & 6 deletions charts/unikorn/templates/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,7 @@ spec:
tags:
- infrastructure
versions:
- version: v0.3.27
repo: https://unikorn-cloud.github.io/helm-cluster-api
chart: cluster-api-cluster-openstack
createNamespace: true
interface: 1.0.0
- version: v0.4.0
- version: v0.4.3
repo: https://unikorn-cloud.github.io/helm-cluster-api
chart: cluster-api-cluster-openstack
createNamespace: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
reference:
kind: HelmApplication
name: {{ include "resource.id" "cluster-openstack" }}
version: v0.4.0
version: v0.4.3
- name: cilium
reference:
kind: HelmApplication
Expand Down
10 changes: 0 additions & 10 deletions charts/unikorn/templates/server/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,11 @@ rules:
verbs:
- list
- watch
# Get secrets, ugh, for kubeconfigs.
- apiGroups:
- ""
resources:
- secrets
- services
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- get
- list
- watch
10 changes: 9 additions & 1 deletion charts/unikorn/templates/server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ spec:
{{- with $oidc := .Values.server.oidc }}
- --oidc-issuer={{ $oidc.issuer }}
{{- if $oidc.issuerCA }}
{{ printf "- --oidc-issuer-ca=%s" $oidc.issuerCA | nindent 8 }}
{{ printf "- --oidc-issuer-ca=%s" $oidc.issuerCA | nindent 8 }}
{{- end }}
{{- end }}
{{- with $region := .Values.server.region }}
{{- if $region.host }}
{{ printf "- --region-host=%s" $region.host | nindent 8 }}
{{- end }}
{{- if $region.ca }}
{{ printf "- --region-ca=%s" $region.ca | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.server.otlpEndpoint }}
Expand Down
12 changes: 9 additions & 3 deletions charts/unikorn/templates/server/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ metadata:
{{- else }}
cert-manager.io/issuer: unikorn-server-ingress
{{- end }}
{{- if .Values.server.ingress.externalDns }}
external-dns.alpha.kubernetes.io/hostname: {{ .Values.server.ingress.host }}
{{- with $ingress := .Values.server.ingress }}
{{- if $ingress.externalDns }}
external-dns.alpha.kubernetes.io/hostname: {{ .ingress.host }}
{{- end }}
{{- end }}
spec:
ingressClassName: {{ .Values.server.ingress.class }}
{{- with $ingress := .Values.server.ingress }}
{{- if $ingress.class }}
ingressClassName: {{ $ingress.class }}
{{- end }}
{{- end }}
# For development you will want to add these names to /etc/hosts for the ingress
# endpoint address.
tls:
Expand Down
8 changes: 7 additions & 1 deletion charts/unikorn/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ server:

ingress:
# Sets the ingress class to use.
class: nginx
# class: nginx

# Sets the DNS hosts/X.509 Certs.
host: unikorn.unikorn-cloud.org
Expand Down Expand Up @@ -116,6 +116,12 @@ server:
# This is a base64 encoded PEM file.
# issuerCA:

region:
# Region controller URL.
host: https://region.unikorn-cloud.org
# CA file if using self signed/private certificates.
# This is a base64 encoded PEM file.
# ca:
# Sets the OTLP endpoint for shipping spans.
# otlpEndpoint: jaeger-collector.default:4318

Expand Down
7 changes: 0 additions & 7 deletions cmd/unikorn-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
unikornv1 "github.com/unikorn-cloud/unikorn/pkg/apis/unikorn/v1alpha1"
"github.com/unikorn-cloud/unikorn/pkg/constants"
"github.com/unikorn-cloud/unikorn/pkg/server"
"github.com/unikorn-cloud/unikorn/pkg/server/reaper"

"sigs.k8s.io/controller-runtime/pkg/log"
)
Expand Down Expand Up @@ -78,12 +77,6 @@ func start() {
return
}

if err := reaper.New(client).Run(ctx); err != nil {
logger.Error(err, "failed to setup 'The Reaper'")

return
}

// Register a signal handler to trigger a graceful shutdown.
stop := make(chan os.Signal, 1)

Expand Down
43 changes: 21 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ require (
github.com/go-chi/chi/v5 v5.0.12
github.com/go-logr/logr v1.4.1
github.com/google/uuid v1.6.0
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.2
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56
github.com/oapi-codegen/runtime v1.1.1
github.com/prometheus/client_golang v1.19.0
github.com/spdx/tools-golang v0.5.3
github.com/spf13/pflag v1.0.5
github.com/unikorn-cloud/core v0.1.43
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
github.com/unikorn-cloud/core v0.1.46
github.com/unikorn-cloud/region v0.1.3
go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0
go.opentelemetry.io/otel/sdk v1.27.0
gopkg.in/ini.v1 v1.67.0
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
Expand Down Expand Up @@ -60,7 +59,7 @@ require (
github.com/gophercloud/gophercloud v1.3.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -85,27 +84,27 @@ require (
github.com/spf13/cobra v1.8.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
go.opentelemetry.io/otel/trace v1.27.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
go.starlark.net v0.0.0-20240314022150-ee8ed142361c // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/evanphx/json-patch.v5 v5.9.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit fa8db40

Please sign in to comment.