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

Application crd #1633

Merged
merged 65 commits into from
Oct 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
286924f
generates the application CR and the components with annotations
Sep 11, 2018
b266e06
added the ability to have different types of applications under proto…
Sep 13, 2018
bd43f98
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Sep 18, 2018
8224884
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Sep 19, 2018
5485f16
snapshot
Sep 20, 2018
2bf305d
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Sep 23, 2018
571bba0
added deployment, service, compositecontroller
Sep 24, 2018
141ee28
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Sep 26, 2018
642c9ae
added README and changed prototype to kubeflow-app
Sep 26, 2018
4daaaff
update README.md and move to under prototypes
Sep 26, 2018
695bf52
change projectNamespace to deploymentNamespace
Sep 26, 2018
0da460b
merge params for components so params can be overwritten in application
Sep 26, 2018
5707cbd
jfmt errors
Sep 26, 2018
f831205
now kubeflow-app params.components can be empty (all components) or a…
Sep 27, 2018
2c0ba78
update README.md
Sep 27, 2018
02a942c
snapshot
Sep 27, 2018
d7ee374
/retest
Sep 27, 2018
845014a
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Sep 29, 2018
da5a16f
minor fixes related to the CRD
Sep 30, 2018
a57c782
use kubeflow-app
Oct 1, 2018
b111b04
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 1, 2018
d236b7c
/retest
Oct 1, 2018
a622784
/retest
Oct 2, 2018
54bd8e2
fmt errors
Oct 2, 2018
1483109
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 2, 2018
3be7805
assemblyPhase, installed updates
Oct 4, 2018
72ee02d
added tests for sort, setDiff
Oct 5, 2018
01ed67a
/retest
Oct 5, 2018
c81a789
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 5, 2018
6386220
/retest
Oct 6, 2018
a5997e8
/retest
Oct 7, 2018
61d217d
format
Oct 8, 2018
3996729
/retest
Oct 9, 2018
8526490
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 9, 2018
1315aed
adding labels
Oct 9, 2018
24ff586
adding labels
Oct 9, 2018
45abdbe
/retest
Oct 9, 2018
bb97de0
remove kubebuilder label
Oct 10, 2018
9e19d7c
/retest
Oct 11, 2018
acdfdfe
rebase from upstream master
Oct 13, 2018
083118f
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 16, 2018
52fbb98
"first pass at separating cluster resources from namespace scoped res…
Oct 17, 2018
a88480e
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 17, 2018
e8024d4
remove unnecessary mods, deploy in 2 passes: cluster wide, namespace …
Oct 17, 2018
87143b9
remove owner param
Oct 17, 2018
b4744ad
update on README.md
Oct 18, 2018
19dd33d
update README and schema
Oct 18, 2018
bfe346f
jfmt fix
Oct 18, 2018
fe6214a
remove namespace from ClusterRole
Oct 18, 2018
05455b0
re-adding components as an option
Oct 18, 2018
3621bc3
re-add components option to allow for a subset of components to be de…
Oct 18, 2018
49bfa8a
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 18, 2018
07799de
only emit applicationCRD (optional) and application
Oct 18, 2018
ae1bb9c
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 18, 2018
2a84fb6
/retest
Oct 19, 2018
23cd24c
/retest
Oct 19, 2018
f167d4a
/retest
Oct 19, 2018
de068db
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 19, 2018
7e650ae
/retest
Oct 19, 2018
3a2a64c
/retest
Oct 19, 2018
aedbab4
/retest
Oct 19, 2018
afbd9f9
/retest
Oct 19, 2018
f50c496
/retest
Oct 19, 2018
880f207
/retest
Oct 19, 2018
241b57f
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
Oct 19, 2018
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
259 changes: 259 additions & 0 deletions kubeflow/application/application.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
{
// Implements [Kubernetes Application API draft-20180115](https://github.com/kow3ns/community/blob/8cb87419883197032f4e5cce8d5518c9c5792f6c/keps/sig-apps/0003-kubernetes-application-api.md)
local k8s = import "k8s.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
local crd = k8s.apiextensions.v1beta1.customResourceDefinition,

new(_env, _params):: {
local params = _env + _params {
labels: {
app: _params.name,
},
emitCRD: util.toBool(_params.emitCRD),
},

// see [API](https://github.com/kow3ns/community/blob/8cb87419883197032f4e5cce8d5518c9c5792f6c/keps/sig-apps/0003-kubernetes-application-api.md#api)
local openApiV3Schema = {
properties: {
apiVersion: {
type: "string",
},
kind: {
type: "string",
},
metadata: {
type: "object",
},
spec: {
type: "object",
properties: {
type: {
type: "string",
},
components: {
type: "array",
items: {
type: "object",
},
},
dependencies: {
type: "array",
items: {
type: "string",
},
},
selector: {
type: "object",
},
healthCheck: {
type: "string",
},
version: {
type: "string",
},
description: {
type: "string",
},
maintainers: {
type: "array",
items: {
type: "string",
},
},
owners: {
type: "array",
items: {
type: "string",
},
},
keywords: {
type: "array",
items: {
type: "string",
},
},
links: {
type: "array",
items: {
type: "object",
},
},
info: {
type: "array",
items: {
type: "object",
},
},
},
},
status: {
properties: {
observedGeneration: {
type: "string",
format: "int64",
},
installed: {
items: {
type: "string",
},
type: "array",
},
ready: {
type: "string",
},
},
type: "object",
},
},
},

local applicationCRD = {
apiVersion: "apiextensions.k8s.io/v1beta1",
kind: "CustomResourceDefinition",
metadata: {
name: "applications.app.k8s.io",
labels: {
api: "default",
},
},
spec: {
group: "app.k8s.io",
version: "v1beta1",
scope: "Namespaced",
names: {
plural: "applications",
singular: "application",
kind: "Application",
},
validation: {
openAPIV3Schema: openApiV3Schema,
},
},
},
applicationCRD:: applicationCRD,

local application = {
apiVersion: "app.k8s.io/v1beta1",
kind: "Application",
metadata: {
name: params.name,
labels: {
app: params.name,
"app.kubernetes.io/name": params.name,
},
namespace: params.namespace,
},
spec: {
type: params.type,
components+: std.map(byComponent, tuples),
dependencies: [],
selector: {
matchLabels: {
"app.kubernetes.io/name": params.name,
},
},
healthCheck: "",
version: params.version,
description: "",
maintainers: [],
owners: [],
keywords: [],
links: [],
info: [],
},
},
application:: application,

local generateComponentTuples(resource) = {
local name =
if std.objectHas(resource.metadata, "name") then
resource.metadata.name
else null,
local gname = std.split(resource.apiVersion, "/")[0],
local groupKindAndResource = {
tuple: [
{ name: name },
if gname != "v1" then {
group: gname,
kind: resource.kind,
} else {
kind: resource.kind,
},
resource,
],
},
return:: groupKindAndResource,
}.return,

local perComponent(name) = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the list of components in the application change based on whether bootstrap is enabled or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no - it's the same list - just filtered. The bootstrap=true parameter will return resources that do not have a namespace.

local list = std.extVar("__ksonnet/components"),
return::
if std.objectHas(list, name) &&
std.objectHas(list[name], "items") &&
std.type(list[name].items) == "array" then
std.map(generateComponentTuples, list[name].items)
else
[],
}.return,

local byResource(wrapper) = {
local tuple = wrapper.tuple,
local resource = tuple[2],
return:: resource {
metadata+: {
annotations+: {
"kubernetes.io/application": params.name,
},
labels+: {
"app.kubernetes.io/name": params.name,
"app.kubernetes.io/component": resource.metadata.name,
app: params.name,
component: resource.metadata.name,
},
},
},
}.return,

local byComponent(wrapper) = {
local tuple = wrapper.tuple,
local name = tuple[0].name,
local groupKind = tuple[1],
local component = {
[name]: groupKind,
},
return:: component,
}.return,

local getComponents = {
local isEmpty =
if std.length(params.components) == 0 then
true
else
false,
local exclude(name) = {
return::
if name == params.name then
false
else
true,
}.return,
return::
if isEmpty then
std.filter(exclude, std.objectFields(std.extVar("__ksonnet/components")))
else
params.components,
}.return,

local tuples = std.flattenArrays(std.map(perComponent, getComponents)),
local components = std.map(byResource, tuples),

parts:: self,
all:: [
if params.emitCRD then
self.applicationCRD,
self.application,
],

list(obj=self.all):: util.list(obj),
},
}
39 changes: 39 additions & 0 deletions kubeflow/application/parts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "application",
"apiVersion": "0.0.1",
"kind": "ksonnet.io/parts",
"description": "Prototypes for Application CR.\n",
"author": "kubeflow team <kubeflow-team@google.com>",
"contributors": [
{
"name": "Jeremy Lewi",
"email": "jlewi@google.com"
},
{
"name": "Kam Kasravi",
"email": "kamkasravi@gmail.com"
}
],
"repository": {
"type": "git",
"url": "https://github.com/kubeflow/kubeflow"
},
"bugs": {
"url": "https://github.com/kubeflow/kubeflow/issues"
},
"keywords": [
"kubeflow",
"application",
"workflows"
],
"quickStart": {
"prototype": "io.ksonnet.pkg.application",
"componentName": "application",
"flags": {
"name": "application",
"namespace": "",
},
"comment": "Deploy Application"
},
"license": "Apache 2.0"
}
Loading