Skip to content

Commit

Permalink
Make Provisioning Work (#13)
Browse files Browse the repository at this point in the history
Simply a case of taking our scheduled application order and constructing
a provisioner out of it.
  • Loading branch information
spjmurray authored Nov 22, 2024
1 parent 45bc185 commit 67362a8
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ spec:
description: |-
ApplicationSet defines a set of applications.
It works like a normal package manager, installing a package will automatically
install any dependencies and recommended packages. Removeing a package will also
remove any dependencies and recoomended packages unless they are kept alive by
install any dependencies and recommended packages. Removing a package will also
remove any dependencies and recommended packages unless they are kept alive by
another package in the set.
properties:
apiVersion:
Expand Down Expand Up @@ -126,4 +126,5 @@ spec:
type: object
served: true
storage: true
subresources: {}
subresources:
status: {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@ metadata:
rules:
# Manage applicationsets (my job).
- apiGroups:
- unikorn-cloud.org
- application.unikorn-cloud.org
resources:
- applicationsets
verbs:
- list
- watch
- update
# Manage applicationsets (my job).
- apiGroups:
- unikorn-cloud.org
- application.unikorn-cloud.org
resources:
- applicationsets/status
verbs:
- update
# Get Kubernetes clusters so we can provision applications on it.
- apiGroups:
- unikorn-cloud.org
resources:
- helmapplications
- kubernetesclusters
- clustermanagers
verbs:
- list
- watch
# ArgoCD integration.
- apiGroups:
- argoproj.io
Expand All @@ -40,6 +51,3 @@ rules:
verbs:
- list
- watch
- create
- patch
- delete
7 changes: 7 additions & 0 deletions charts/application/templates/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
repo: https://charts.jetstack.io
chart: cert-manager
release: cert-manager
namespace: cert-manager
createNamespace: true
parameters:
- name: installCRDs
Expand Down Expand Up @@ -55,6 +56,7 @@ spec:
- version: 1.0.0
repo: https://unikorn-cloud.github.io/helm-addons
chart: cert-manager-issuers
namespace: cert-manager
dependencies:
- name: cert-manager
---
Expand All @@ -79,6 +81,7 @@ spec:
- version: 4.8.0
repo: https://kubernetes.github.io/ingress-nginx
chart: ingress-nginx
namespace: ingress-nginx
createNamespace: true
parameters:
- name: controller.kind
Expand Down Expand Up @@ -110,6 +113,8 @@ spec:
- version: 6.0.8
repo: https://kubernetes.github.io/dashboard
chart: kubernetes-dashboard
namespace: kubernetes-dashboard
createNamespace: true
interface: 1.0.0
dependencies:
- name: cert-manager
Expand Down Expand Up @@ -139,6 +144,7 @@ spec:
- version: 1.5.3
repo: https://charts.longhorn.io
chart: longhorn
namespace: longhorn
createNamespace: true
parameters:
- name: defaultSettings.kubernetesClusterAutoscalerEnabled
Expand Down Expand Up @@ -172,6 +178,7 @@ spec:
- version: 50.2.0
repo: https://prometheus-community.github.io/helm-charts
chart: kube-prometheus-stack
namespace: prometheus
createNamespace: true
serverSideApply: true
parameters:
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spjmurray/go-sat v0.3.1
github.com/stretchr/testify v1.9.0
github.com/unikorn-cloud/core v0.1.80
github.com/unikorn-cloud/core v0.1.82
github.com/unikorn-cloud/identity v0.2.44
github.com/unikorn-cloud/kubernetes v0.2.47
go.opentelemetry.io/otel/sdk v1.31.0
Expand Down Expand Up @@ -86,7 +86,6 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/unikorn-cloud/core v0.1.80 h1:Xkk8QV+8a4kOfJge9teCzwZjGtAz7pE+cJvCXULtEVw=
github.com/unikorn-cloud/core v0.1.80/go.mod h1:wEKzCwAnIyTbo27l++Wl+gK95TAxMsFS3y3jbFB03aw=
github.com/unikorn-cloud/core v0.1.82 h1:MoDkQeHrjlyvjExYk/V8LeXO2T8pLYkaijpwSy6D/Ys=
github.com/unikorn-cloud/core v0.1.82/go.mod h1:wEKzCwAnIyTbo27l++Wl+gK95TAxMsFS3y3jbFB03aw=
github.com/unikorn-cloud/identity v0.2.44 h1:tXV/qsJ77Dkx8ba8gnBFXHWUgBNsJ2oo/5TjnyhkH7U=
github.com/unikorn-cloud/identity v0.2.44/go.mod h1:JMbS6iTYzt0OVt5AkqZys3WVnpLabGvUl8kGWcxzFZI=
github.com/unikorn-cloud/kubernetes v0.2.47 h1:dc2V0RWabhZ6hUwrRkdWVMI48eNq5oZbgAGS3RC1r+I=
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/unikorn/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (c *ApplicationSet) ResourceLabels() (labels.Set, error) {
}

labels := labels.Set{
constants.KindLabel: "unikorn-cloud.org/applicationset",
constants.KindLabel: "applicationset",
constants.OrganizationLabel: organization,
constants.ProjectLabel: project,
constants.KubernetesClusterLabel: cluster,
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/unikorn/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ type ApplicationSetList struct {

// ApplicationSet defines a set of applications.
// It works like a normal package manager, installing a package will automatically
// install any dependencies and recommended packages. Removeing a package will also
// remove any dependencies and recoomended packages unless they are kept alive by
// install any dependencies and recommended packages. Removing a package will also
// remove any dependencies and recommended packages unless they are kept alive by
// another package in the set.
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:scope=Namespaced,categories=unikorn
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="display name",type="string",JSONPath=".metadata.labels['unikorn-cloud\\.org/name']"
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
type ApplicationSet struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/managers/application/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
coreclient "github.com/unikorn-cloud/core/pkg/client"
coremanager "github.com/unikorn-cloud/core/pkg/manager"
"github.com/unikorn-cloud/core/pkg/manager/options"
kubernetesunikornv1 "github.com/unikorn-cloud/kubernetes/pkg/apis/unikorn/v1alpha1"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
Expand Down Expand Up @@ -75,5 +76,6 @@ func (*Factory) Upgrade(_ client.Client) error {
func (*Factory) Schemes() []coreclient.SchemeAdder {
return []coreclient.SchemeAdder{
unikornv1.AddToScheme,
kubernetesunikornv1.AddToScheme,
}
}
Loading

0 comments on commit 67362a8

Please sign in to comment.