Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new fields for appwrapper and clusterinfo #46

Open
wants to merge 10 commits into
base: multicluster
Choose a base branch
from
Open
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
Binary file added .DS_Store
Binary file not shown.
Binary file added api/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions api/v1beta1/appwrapper_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ type ClusterReference struct {
}

type SustainableSpec struct {
RunTime int64 `json:"runTime"`
Deadline metav1.Time `json:"deadline"`
// TODO
}

Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/clusterinfo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ import (

// ClusterInfoSpec defines the desired state of ClusterInfo
type ClusterInfoSpec struct {
Geolocation string `json:"geolocation,omitempty"`
PowerIdle string `json:"poweridle,omitempty"`
PowerPeak string `json:"powerpeak,omitempty"`
Carbon [24]string `json:"carbon,omitempty"`
}

// ClusterInfoStatus defines the observed state of ClusterInfo
type ClusterInfoStatus struct {
// Capacity available on the cluster
Capacity v1.ResourceList `json:"capacity,omitempty"`
Usage v1.ResourceList `json:"usage,omitempty"`

// When last updated
Time metav1.Time `json:"time,omitempty"`
Expand Down
12 changes: 10 additions & 2 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

mcadv1beta1 "github.com/tardieu/mcad/api/v1beta1"
"github.com/tardieu/mcad/internal/controller"
mcadv1beta1 "github.com/tayebehbahreini/mcad/api/v1beta1"
"github.com/tayebehbahreini/mcad/internal/controller"
//+kubebuilder:scaffold:imports
)

Expand All @@ -60,6 +60,9 @@ func main() {
var namespace string
var name string
var context string
var geolocation string
var powerIdle string
var powerPeak string
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
Expand All @@ -72,6 +75,9 @@ func main() {
flag.StringVar(&namespace, "clusterinfo-namespace", "default", "The namespace of the ClusterInfo object")
flag.StringVar(&name, "clusterinfo-name", controller.DefaultClusterName, "The name of the ClusterInfo object.")
flag.StringVar(&context, "kube-context", "", "The Kubernetes context.")
flag.StringVar(&geolocation, "geolocation", "US-NY-NYIS", "The geolocation of cluster.")
flag.StringVar(&powerIdle, "power-idle", "300", "idle power.")
flag.StringVar(&powerPeak, "power-peak", "200", "peak power.")
opts.BindFlags(flag.CommandLine)
flag.Parse()

Expand Down Expand Up @@ -123,10 +129,13 @@ func main() {
os.Exit(1)
}
if err = (&controller.ClusterInfoReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Namespace: namespace,
Name: name,
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Namespace: namespace,
Name: name,
Geolocation: geolocation,
PowerPeak: powerPeak,
PowerIdle: powerIdle,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create ClusterInfo controller")
os.Exit(1)
Expand Down
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: workload.codeflare.dev/v1beta1
kind: ClusterInfo
metadata:
namespace: default
name: self
10 changes: 10 additions & 0 deletions config/crd/bases/workload.codeflare.dev_appwrappers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ spec:
type: object
sustainable:
description: Sustainable specification
properties:
deadline:
format: date-time
type: string
runTime:
format: int64
type: integer
required:
- deadline
- runTime
type: object
required:
- resources
Expand Down
20 changes: 20 additions & 0 deletions config/crd/bases/workload.codeflare.dev_clusterinfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ spec:
type: object
spec:
description: ClusterInfoSpec defines the desired state of ClusterInfo
properties:
carbon:
items:
type: string
type: array
geolocation:
type: string
poweridle:
type: string
powerpeak:
type: string
type: object
status:
description: ClusterInfoStatus defines the observed state of ClusterInfo
Expand All @@ -50,6 +61,15 @@ spec:
description: When last updated
format: date-time
type: string
usage:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: ResourceList is a set of (resource name, quantity) pairs.
type: object
type: object
type: object
served: true
Expand Down
60 changes: 30 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module github.com/tardieu/mcad
module github.com/tayebehbahreini/mcad

go 1.20
go 1.21.0

require (
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
github.com/onsi/ginkgo/v2 v2.13.1
github.com/onsi/gomega v1.30.0

gopkg.in/inf.v0 v0.9.1
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
k8s.io/api v0.28.3
k8s.io/apimachinery v0.28.3
k8s.io/client-go v0.28.3
sigs.k8s.io/controller-runtime v0.15.0
)

Expand All @@ -19,18 +20,18 @@ require (
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
Expand All @@ -42,31 +43,30 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
golang.org/x/tools v0.14.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
k8s.io/component-base v0.27.2 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
k8s.io/apiextensions-apiserver v0.28.3 // indirect
k8s.io/component-base v0.28.3 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Expand Down
Loading