-
Notifications
You must be signed in to change notification settings - Fork 8
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
Common api #37
Common api #37
Changes from 17 commits
95c118c
074de20
7e6bd3c
5b19c83
c239c7d
0fd1f6e
a2369fb
d214e1f
ba396a7
876d656
23f49ef
f286600
9a6ac68
a86753a
b99bad4
cd8b31a
929389a
d716b30
76e9a93
129570e
f1c8e6a
e8ff527
bd45bd1
d639c5d
9e8e5e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
syntax = "proto3"; | ||
|
||
package core.skv2.solo.io; | ||
|
||
option go_package = "github.com/solo-io/skv2/pkg/api/core.skv2.solo.io/v1alpha1"; | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
import "gogoproto/gogo.proto"; | ||
option (gogoproto.equal_all) = true; | ||
import "extproto/ext.proto"; | ||
option (extproto.hash_all) = true; | ||
|
||
// Resource reference for an object | ||
message ObjectRef { | ||
|
||
// (optional) api group of the resource being referenced | ||
google.protobuf.StringValue api_group = 1; | ||
|
||
// (optional) kind of the resource being referenced | ||
google.protobuf.StringValue kind = 2; | ||
|
||
// name of the resource being referenced | ||
string name = 3; | ||
|
||
// namespace of the resource being referenced | ||
string namespace = 4; | ||
} | ||
|
||
// A generic status | ||
message Status { | ||
|
||
// The State of a reconciled object | ||
enum State { | ||
// Waiting to be processed. | ||
PENDING = 0; | ||
|
||
// Currently processing. | ||
PROCESSING = 1; | ||
|
||
// Invalid parameters supplied, will not continue. | ||
INVALID = 2; | ||
|
||
// Failed during processing. | ||
FAILED = 3; | ||
|
||
// Finished processing successfully. | ||
ACCEPTED = 4; | ||
} | ||
|
||
// The current state of the resource | ||
State state = 1; | ||
|
||
// A human readable message about the current state of the object | ||
string message = 2; | ||
|
||
// The most recently observed generation of the resource. This value corresponds to the `metadata.generation` of | ||
// a kubernetes resource | ||
int64 observed_generation = 3; | ||
|
||
// The time at which this status was recorded | ||
google.protobuf.Timestamp processing_time = 4; | ||
|
||
// (optional) The owner of the status, this value can be used to identify the entity which wrote this status. | ||
// This is useful in situations where a given resource may have multiple owners. | ||
google.protobuf.StringValue owner = 5; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package main | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we already have some code generation in skv2 for multicluster; maybe this belongs alongside that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have templates to generate multi cluster reconcilers, but I don't think we have code to specifically generate code in this repo to be consumed by other repos, I may be wrong though. |
||
|
||
import ( | ||
"log" | ||
|
||
"github.com/solo-io/skv2/codegen" | ||
"github.com/solo-io/skv2/codegen/model" | ||
"github.com/solo-io/solo-kit/pkg/code-generator/sk_anyvendor" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
//go:generate go run generate.go | ||
|
||
func main() { | ||
log.Println("starting kube client generation") | ||
|
||
skv2Imports := sk_anyvendor.CreateDefaultMatchOptions([]string{ | ||
"api/**/*.proto", | ||
}) | ||
|
||
skv2Cmd := codegen.Command{ | ||
Groups: []model.Group{ | ||
{ | ||
GroupVersion: schema.GroupVersion{ | ||
Group: "multicluster.solo.io", | ||
Version: "v1alpha1", | ||
}, | ||
Module: "github.com/solo-io/skv2", | ||
Resources: []model.Resource{ | ||
{ | ||
Kind: "KubernetesCluster", | ||
Spec: model.Field{ | ||
Type: model.Type{ | ||
Name: "KubernetesClusterSpec", | ||
}, | ||
}, | ||
Status: &model.Field{ | ||
Type: model.Type{ | ||
Name: "KubernetesClusterStatus", | ||
}, | ||
}, | ||
}, | ||
}, | ||
RenderManifests: true, | ||
RenderController: true, | ||
RenderProtos: true, | ||
RenderClients: true, | ||
RenderTypes: true, | ||
ApiRoot: "pkg/api", | ||
}, | ||
}, | ||
AnyVendorConfig: skv2Imports, | ||
} | ||
if err := skv2Cmd.Execute(); err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Printf("Finished generating kube clients\n") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
syntax = "proto3"; | ||
package multicluster.solo.io; | ||
|
||
import "gogoproto/gogo.proto"; | ||
option (gogoproto.equal_all) = true; | ||
import "extproto/ext.proto"; | ||
option (extproto.hash_all) = true; | ||
|
||
option go_package = "github.com/solo-io/skv2/pkg/api/multicluster.solo.io/v1alpha1"; | ||
|
||
import "skv2/api/core/v1alpha1/core.proto"; | ||
|
||
/* | ||
Representation of a Kubernetes cluster that has been registered. | ||
*/ | ||
message KubernetesClusterSpec { | ||
// name of the secret which contains the kubeconfig with information to connect to the remote cluster. | ||
core.skv2.solo.io.ObjectRef secret = 1; | ||
} | ||
|
||
message KubernetesClusterStatus { | ||
// List of statuses about the kubernetes cluster. | ||
// This list allows for multiple applications/pods to record their connection status. | ||
repeated core.skv2.solo.io.Status status = 1; | ||
|
||
// version of kubernetes | ||
string version = 2; | ||
|
||
// cloud provider, empty if unknown | ||
string cloud = 3; | ||
|
||
// Discovered information can be found here: https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/ | ||
// Geographic location in which a kubernetes cluster resides | ||
string region = 4; | ||
|
||
// The specific zone within a region in which a the cluster resides | ||
string zone = 5; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
changelog: | ||
- type: NEW_FEATURE | ||
issueLink: https://github.com/solo-io/skv2/issues/15 | ||
resolvesIssue: false | ||
description: Add kubernetes cluster resource to skv2, along with a couple smaller core API pieces. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Code generated by skv2. DO NOT EDIT. | ||
|
||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
labels: | ||
app: "" | ||
app.kubernetes.io/name: "" | ||
name: kubernetesclusters.multicluster.solo.io | ||
spec: | ||
group: multicluster.solo.io | ||
names: | ||
kind: KubernetesCluster | ||
listKind: KubernetesClusterList | ||
plural: kubernetesclusters | ||
singular: kubernetescluster | ||
scope: Namespaced | ||
subresources: | ||
status: {} | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
storage: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(comments)