forked from cyclops-ui/cyclops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
149765f
commit a10bdce
Showing
71 changed files
with
2,388 additions
and
303 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
start: | ||
go run -tags musl ./cmd/main | ||
|
||
# DO NOT RUN | ||
build-push-dpl: | ||
docker build --tag "petarcvit223/cicops:latest" . | ||
docker push petarcvit223/cicops | ||
kubectl apply -f k8s/deployment.yaml | ||
|
||
local-redis: | ||
docker-compose up --detach | ||
|
||
stop: | ||
docker-compose down |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"gitops/internal/api/server" | ||
"gitops/internal/workflow/cyclops" | ||
) | ||
|
||
func main() { | ||
workflowRunner, err := cyclops.NewWorkflowRunner() | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
apiServer, err := server.New(workflowRunner) | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
if err = apiServer.Start(); err != nil { | ||
fmt.Println(err) | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module gitops | ||
|
||
go 1.17 | ||
|
||
require ( | ||
github.com/gin-gonic/gin v1.7.7 | ||
github.com/go-redis/redis/v8 v8.11.4 | ||
github.com/joho/godotenv v1.4.0 | ||
golang.org/x/net v0.0.0-20211209124913-491a49abca63 | ||
gopkg.in/yaml.v2 v2.4.0 | ||
k8s.io/api v0.23.4 | ||
k8s.io/apimachinery v0.23.4 | ||
k8s.io/client-go v0.23.4 | ||
) | ||
|
||
require ( | ||
github.com/cespare/xxhash/v2 v2.1.2 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect | ||
github.com/gin-contrib/sse v0.1.0 // indirect | ||
github.com/go-logr/logr v1.2.0 // indirect | ||
github.com/go-playground/locales v0.13.0 // indirect | ||
github.com/go-playground/universal-translator v0.17.0 // indirect | ||
github.com/go-playground/validator/v10 v10.4.1 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/google/go-cmp v0.5.6 // indirect | ||
github.com/google/gofuzz v1.1.0 // indirect | ||
github.com/googleapis/gnostic v0.5.5 // indirect | ||
github.com/imdario/mergo v0.3.5 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/leodido/go-urn v1.2.0 // indirect | ||
github.com/mattn/go-isatty v0.0.12 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/ugorji/go/codec v1.1.7 // indirect | ||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect | ||
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect | ||
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e // indirect | ||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.27.1 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect | ||
k8s.io/klog/v2 v2.30.0 // indirect | ||
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect | ||
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect | ||
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect | ||
sigs.k8s.io/yaml v1.2.0 // indirect | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 54 additions & 0 deletions
54
cyclops-ctrl-deprecated/internal/models/crd/v1alpha1/deepcopy.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package v1alpha1 | ||
|
||
import "k8s.io/apimachinery/pkg/runtime" | ||
|
||
func DeepCopyValues(values []ModuleValue) []ModuleValue { | ||
out := make([]ModuleValue, 0, len(values)) | ||
|
||
for _, value := range values { | ||
out = append(out, ModuleValue{ | ||
Name: value.Name, | ||
Value: value.Value, | ||
}) | ||
} | ||
|
||
return out | ||
} | ||
|
||
// DeepCopyInto copies all properties of this object into another object of the | ||
// same type that is provided as a pointer. | ||
func (in *Module) DeepCopyInto(out *Module) { | ||
out.TypeMeta = in.TypeMeta | ||
out.ObjectMeta = in.ObjectMeta | ||
out.Spec = ModuleSpec{ | ||
TemplateRef: TemplateRef{ | ||
Name: in.Spec.TemplateRef.Name, | ||
Version: in.Spec.TemplateRef.Version, | ||
}, | ||
Values: DeepCopyValues(in.Spec.Values), | ||
} | ||
} | ||
|
||
// DeepCopyObject returns a generically typed copy of an object | ||
func (in *Module) DeepCopyObject() runtime.Object { | ||
out := Module{} | ||
in.DeepCopyInto(&out) | ||
|
||
return &out | ||
} | ||
|
||
// DeepCopyObject returns a generically typed copy of an object | ||
func (in *ModuleList) DeepCopyObject() runtime.Object { | ||
out := ModuleList{} | ||
out.TypeMeta = in.TypeMeta | ||
out.ListMeta = in.ListMeta | ||
|
||
if in.Items != nil { | ||
out.Items = make([]Module, len(in.Items)) | ||
for i := range in.Items { | ||
in.Items[i].DeepCopyInto(&out.Items[i]) | ||
} | ||
} | ||
|
||
return &out | ||
} |
48 changes: 48 additions & 0 deletions
48
cyclops-ctrl-deprecated/internal/models/crd/v1alpha1/module.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
type ModuleValue struct { | ||
Name string `json:"name"` | ||
Value string `json:"value"` | ||
} | ||
|
||
type TemplateRef struct { | ||
Name string `json:"name"` | ||
Version string `json:"version"` | ||
} | ||
|
||
type ModuleSpec struct { | ||
TemplateRef TemplateRef `json:"template"` | ||
Values []ModuleValue `json:"values"` | ||
} | ||
|
||
type Resource struct { | ||
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` | ||
Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` | ||
Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"` | ||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"` | ||
Name string `json:"name,omitempty" protobuf:"bytes,5,opt,name=name"` | ||
Status string `json:"status,omitempty" protobuf:"bytes,6,opt,name=status"` | ||
Health string `json:"health,omitempty" protobuf:"bytes,7,opt,name=health"` | ||
} | ||
|
||
type ModuleStatus struct { | ||
Resources []Resource `json:"resources,omitempty"` | ||
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` | ||
} | ||
|
||
type Module struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ModuleSpec `json:"spec"` | ||
Status ModuleStatus `json:"status,omitempty"` | ||
} | ||
|
||
type ModuleList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []Module `json:"items"` | ||
} |
27 changes: 27 additions & 0 deletions
27
cyclops-ctrl-deprecated/internal/models/crd/v1alpha1/register.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
const GroupName = "cyclops.com" | ||
const GroupVersion = "v1alpha1" | ||
|
||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} | ||
|
||
var ( | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&Module{}, | ||
&ModuleList{}, | ||
) | ||
|
||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package dto | ||
|
||
type Container struct { | ||
Name string `json:"name"` | ||
Image string `json:"image"` | ||
Env map[string]string `json:"env"` | ||
Status ContainerStatus `json:"status"` | ||
} | ||
|
||
type ContainerStatus struct { | ||
Status string `json:"status"` | ||
Message string `json:"message"` | ||
Running bool `json:"running"` | ||
} | ||
|
||
type Pod struct { | ||
Name string `json:"name"` | ||
Containers []Container `json:"containers"` | ||
Node string `json:"node"` | ||
PodPhase string `json:"podPhase"` | ||
} | ||
|
||
type Deployment struct { | ||
Kind string `json:"kind"` | ||
Name string `json:"name"` | ||
Namespace string `json:"namespace"` | ||
Replicas int `json:"replicas"` | ||
Manifest string `json:"manifest"` | ||
Pods []Pod `json:"pods"` | ||
Status bool `json:"status"` | ||
} | ||
|
||
type Service struct { | ||
Kind string `json:"kind"` | ||
Name string `json:"name"` | ||
Namespace string `json:"namespace"` | ||
Port int `json:"port"` | ||
TargetPort int `json:"targetPort"` | ||
Manifest string `json:"manifest"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dto | ||
|
||
type CreateModuleRequest struct { | ||
Name string `json:"name"` | ||
Template string `json:"template"` | ||
Values map[string]interface{} `json:"values"` | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,2 @@ | ||
start: | ||
go run -tags musl ./cmd/main | ||
|
||
# DO NOT RUN | ||
build-push-dpl: | ||
docker build --tag "petarcvit223/cicops:latest" . | ||
docker push petarcvit223/cicops | ||
kubectl apply -f k8s/deployment.yaml | ||
|
||
local-redis: | ||
docker-compose up --detach | ||
|
||
stop: | ||
docker-compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"gitops/internal/api/server" | ||
"gitops/internal/workflow/cyclops" | ||
) | ||
import "github.com/cyclops-ui/cycops-ctrl/internal/handler" | ||
|
||
func main() { | ||
workflowRunner, err := cyclops.NewWorkflowRunner() | ||
handler, err := handler.New() | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
apiServer, err := server.New(workflowRunner) | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
if err = apiServer.Start(); err != nil { | ||
fmt.Println(err) | ||
panic(err) | ||
} | ||
|
||
handler.Start() | ||
} |
Oops, something went wrong.