-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Application crd #1633
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
b266e06
added the ability to have different types of applications under proto…
bd43f98
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
8224884
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
5485f16
snapshot
2bf305d
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
571bba0
added deployment, service, compositecontroller
141ee28
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
642c9ae
added README and changed prototype to kubeflow-app
4daaaff
update README.md and move to under prototypes
695bf52
change projectNamespace to deploymentNamespace
0da460b
merge params for components so params can be overwritten in application
5707cbd
jfmt errors
f831205
now kubeflow-app params.components can be empty (all components) or a…
2c0ba78
update README.md
02a942c
snapshot
d7ee374
/retest
845014a
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
da5a16f
minor fixes related to the CRD
a57c782
use kubeflow-app
b111b04
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
d236b7c
/retest
a622784
/retest
54bd8e2
fmt errors
1483109
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
3be7805
assemblyPhase, installed updates
72ee02d
added tests for sort, setDiff
01ed67a
/retest
c81a789
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
6386220
/retest
a5997e8
/retest
61d217d
format
3996729
/retest
8526490
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
1315aed
adding labels
24ff586
adding labels
45abdbe
/retest
bb97de0
remove kubebuilder label
9e19d7c
/retest
acdfdfe
rebase from upstream master
083118f
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
52fbb98
"first pass at separating cluster resources from namespace scoped res…
a88480e
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
e8024d4
remove unnecessary mods, deploy in 2 passes: cluster wide, namespace …
87143b9
remove owner param
b4744ad
update on README.md
19dd33d
update README and schema
bfe346f
jfmt fix
fe6214a
remove namespace from ClusterRole
05455b0
re-adding components as an option
3621bc3
re-add components option to allow for a subset of components to be de…
49bfa8a
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
07799de
only emit applicationCRD (optional) and application
ae1bb9c
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
2a84fb6
/retest
23cd24c
/retest
f167d4a
/retest
de068db
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
7e650ae
/retest
3a2a64c
/retest
aedbab4
/retest
afbd9f9
/retest
f50c496
/retest
880f207
/retest
241b57f
Merge branch 'master' of github.com:kubeflow/kubeflow into applicatio…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,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) = { | ||
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), | ||
}, | ||
} |
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,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" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does the list of components in the application change based on whether bootstrap is enabled or not?
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.
no - it's the same list - just filtered. The bootstrap=true parameter will return resources that do not have a namespace.