diff --git a/.gitignore b/.gitignore index 3620b1437..c50d073d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ # pkg and bin directories currently contain build artifacts # only so we exclude them. bin/ -vendor/ .vscode/ diff --git a/.pylintrc b/.pylintrc index 273ebae9e..fc691ce3d 100644 --- a/.pylintrc +++ b/.pylintrc @@ -401,4 +401,4 @@ exclude-protected=_asdict,_fields,_replace,_source,_make # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception \ No newline at end of file +overgeneral-exceptions=Exception diff --git a/dev-kubeflow-org/ks-app/.ksonnet/registries/kubeflow/fe9fc2aa3cceba6266ced46ee828ba21ee0152bd.yaml b/dev-kubeflow-org/ks-app/.ksonnet/registries/kubeflow/0f0cb1c9deeb8b05965dd870bf9b4625b7666d92.yaml similarity index 90% rename from dev-kubeflow-org/ks-app/.ksonnet/registries/kubeflow/fe9fc2aa3cceba6266ced46ee828ba21ee0152bd.yaml rename to dev-kubeflow-org/ks-app/.ksonnet/registries/kubeflow/0f0cb1c9deeb8b05965dd870bf9b4625b7666d92.yaml index c3eebe3c7..1e9268309 100644 --- a/dev-kubeflow-org/ks-app/.ksonnet/registries/kubeflow/fe9fc2aa3cceba6266ced46ee828ba21ee0152bd.yaml +++ b/dev-kubeflow-org/ks-app/.ksonnet/registries/kubeflow/0f0cb1c9deeb8b05965dd870bf9b4625b7666d92.yaml @@ -1,6 +1,6 @@ apiVersion: 0.1.0 gitVersion: - commitSha: fe9fc2aa3cceba6266ced46ee828ba21ee0152bd + commitSha: 0f0cb1c9deeb8b05965dd870bf9b4625b7666d92 refSpec: master kind: ksonnet.io/registry libraries: diff --git a/dev-kubeflow-org/ks-app/app.yaml b/dev-kubeflow-org/ks-app/app.yaml index cf1d82328..29245b158 100644 --- a/dev-kubeflow-org/ks-app/app.yaml +++ b/dev-kubeflow-org/ks-app/app.yaml @@ -10,25 +10,25 @@ kind: ksonnet.io/app libraries: core: gitVersion: - commitSha: fe9fc2aa3cceba6266ced46ee828ba21ee0152bd + commitSha: 0f0cb1c9deeb8b05965dd870bf9b4625b7666d92 refSpec: master name: core registry: kubeflow seldon: gitVersion: - commitSha: fe9fc2aa3cceba6266ced46ee828ba21ee0152bd + commitSha: 0f0cb1c9deeb8b05965dd870bf9b4625b7666d92 refSpec: master name: seldon registry: kubeflow tf-job: gitVersion: - commitSha: fe9fc2aa3cceba6266ced46ee828ba21ee0152bd + commitSha: 0f0cb1c9deeb8b05965dd870bf9b4625b7666d92 refSpec: master name: tf-job registry: kubeflow tf-serving: gitVersion: - commitSha: fe9fc2aa3cceba6266ced46ee828ba21ee0152bd + commitSha: 0f0cb1c9deeb8b05965dd870bf9b4625b7666d92 refSpec: master name: tf-serving registry: kubeflow @@ -42,7 +42,7 @@ registries: uri: github.com/ksonnet/parts/tree/master/incubator kubeflow: gitVersion: - commitSha: fe9fc2aa3cceba6266ced46ee828ba21ee0152bd + commitSha: 0f0cb1c9deeb8b05965dd870bf9b4625b7666d92 refSpec: master protocol: github uri: github.com/kubeflow/kubeflow/tree/master/kubeflow diff --git a/dev-kubeflow-org/ks-app/components/issue-summarization.jsonnet b/dev-kubeflow-org/ks-app/components/issue-summarization.jsonnet index affd5b7f2..fdc5d8750 100644 --- a/dev-kubeflow-org/ks-app/components/issue-summarization.jsonnet +++ b/dev-kubeflow-org/ks-app/components/issue-summarization.jsonnet @@ -14,5 +14,6 @@ local image = params.image; local namespace = updatedParams.namespace; local replicas = params.replicas; local endpoint = params.endpoint; +local pvcName = params.pvcName; -k.core.v1.list.new(serve.parts(namespace).serve(name, image, replicas, endpoint)) +k.core.v1.list.new(serve.parts(namespace).serve(name, image, replicas, endpoint, pvcName)) diff --git a/dev-kubeflow-org/ks-app/components/params.libsonnet b/dev-kubeflow-org/ks-app/components/params.libsonnet index 0c29244b3..338ccdb71 100644 --- a/dev-kubeflow-org/ks-app/components/params.libsonnet +++ b/dev-kubeflow-org/ks-app/components/params.libsonnet @@ -12,7 +12,7 @@ jupyterHubAuthenticator: "iap", jupyterHubImage: "gcr.io/kubeflow/jupyterhub-k8s:1.0.1", jupyterHubServiceType: "ClusterIP", - jupyterNotebookPVCMount: "null", + jupyterNotebookPVCMount: "/home/jovyan", name: "kubeflow-core", namespace: "null", reportUsage: "true", @@ -20,6 +20,7 @@ tfDefaultImage: "null", tfJobImage: "gcr.io/kubeflow-images-public/tf_operator:v20180329-a7511ff", tfJobUiServiceType: "ClusterIP", + tfJobVersion: "v1alpha1", usageId: "f85740a3-5f60-4146-91b6-2ab7089cf01c", }, "cert-manager": { @@ -56,6 +57,7 @@ image: "gcr.io/kubeflow-images-public/issue-summarization:0.1", name: "issue-summarization", namespace: "kubeflow", + pvcName: "github-issues-data", replicas: 1, }, "issue-summarization-ui": { diff --git a/dev-kubeflow-org/ks-app/lib/v1.7.0/k8s.libsonnet b/dev-kubeflow-org/ks-app/lib/v1.7.0/k8s.libsonnet index 4e4945777..1dd142385 100644 --- a/dev-kubeflow-org/ks-app/lib/v1.7.0/k8s.libsonnet +++ b/dev-kubeflow-org/ks-app/lib/v1.7.0/k8s.libsonnet @@ -10,7 +10,7 @@ // ExternalAdmissionHookConfiguration describes the configuration of initializers. externalAdmissionHookConfiguration:: { local kind = { kind: "ExternalAdmissionHookConfiguration" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // ExternalAdmissionHooks is a list of external admission webhooks and the affected resources and operations. withExternalAdmissionHooks(externalAdmissionHooks):: self + if std.type(externalAdmissionHooks) == "array" then { externalAdmissionHooks: externalAdmissionHooks } else { externalAdmissionHooks: [externalAdmissionHooks] }, // ExternalAdmissionHooks is a list of external admission webhooks and the affected resources and operations. @@ -100,7 +100,7 @@ // ExternalAdmissionHookConfigurationList is a list of ExternalAdmissionHookConfiguration. externalAdmissionHookConfigurationList:: { local kind = { kind: "ExternalAdmissionHookConfigurationList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // List of ExternalAdmissionHookConfiguration. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of ExternalAdmissionHookConfiguration. @@ -122,7 +122,7 @@ // InitializerConfiguration describes the configuration of initializers. initializerConfiguration:: { local kind = { kind: "InitializerConfiguration" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Initializers is a list of resources and their default initializers Order-sensitive. When merging multiple InitializerConfigurations, we sort the initializers from different InitializerConfigurations by the name of the InitializerConfigurations; the order of the initializers from the same InitializerConfiguration is preserved. withInitializers(initializers):: self + if std.type(initializers) == "array" then { initializers: initializers } else { initializers: [initializers] }, // Initializers is a list of resources and their default initializers Order-sensitive. When merging multiple InitializerConfigurations, we sort the initializers from different InitializerConfigurations by the name of the InitializerConfigurations; the order of the initializers from the same InitializerConfiguration is preserved. @@ -212,7 +212,7 @@ // InitializerConfigurationList is a list of InitializerConfiguration. initializerConfigurationList:: { local kind = { kind: "InitializerConfigurationList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // List of InitializerConfiguration. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of InitializerConfiguration. @@ -239,7 +239,7 @@ // ControllerRevision implements an immutable snapshot of state data. Clients are responsible for serializing and deserializing the objects that contain their internal state. Once a ControllerRevision has been successfully created, it can not be updated. The API Server will fail validation of all requests that attempt to mutate the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, it may be subject to name and representation changes in future releases, and clients should not depend on its stability. It is primarily for internal use by controllers. controllerRevision:: { local kind = { kind: "ControllerRevision" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Revision indicates the revision of the state represented by Data. withRevision(revision):: self + { revision: revision }, mixin:: { @@ -326,7 +326,7 @@ // ControllerRevisionList is a resource containing a list of ControllerRevision objects. controllerRevisionList:: { local kind = { kind: "ControllerRevisionList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is the list of ControllerRevisions withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of ControllerRevisions @@ -348,7 +348,7 @@ // Deployment enables declarative updates for Pods and ReplicaSets. deployment:: { local kind = { kind: "Deployment" }, - new(name, replicas, containers, podLabels={ app: name }):: kind + apiVersion + self.mixin.metadata.withName(name) + self.mixin.spec.withReplicas(replicas) + self.mixin.spec.template.spec.withContainers(containers) + self.mixin.spec.template.metadata.withLabels(podLabels), + new(name, replicas, containers, podLabels={ app: name }):: apiVersion + kind + self.mixin.metadata.withName(name) + self.mixin.spec.withReplicas(replicas) + self.mixin.spec.template.spec.withContainers(containers) + self.mixin.spec.template.metadata.withLabels(podLabels), mixin:: { // Standard object metadata. metadata:: { @@ -736,7 +736,7 @@ // DeploymentList is a list of Deployments. deploymentList:: { local kind = { kind: "DeploymentList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is the list of Deployments. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of Deployments. @@ -748,7 +748,7 @@ // DeploymentRollback stores the information required to rollback a deployment. deploymentRollback:: { local kind = { kind: "DeploymentRollback" }, - new(name):: kind + apiVersion + self.withName(name), + new(name):: apiVersion + kind + self.withName(name), // Required: This must match the Name of a deployment. withName(name):: self + { name: name }, // The annotations to be updated to a deployment @@ -769,7 +769,7 @@ // Scale represents a scaling request for a resource. scale:: { local kind = { kind: "Scale" }, - new(replicas):: kind + apiVersion + self.mixin.spec.withReplicas(replicas), + new(replicas):: apiVersion + kind + self.mixin.spec.withReplicas(replicas), mixin:: { // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata. metadata:: { @@ -865,7 +865,7 @@ // The StatefulSet guarantees that a given network identity will always map to the same storage identity. statefulSet:: { local kind = { kind: "StatefulSet" }, - new(name, replicas, containers, volumeClaims, podLabels={ app: name }):: kind + apiVersion + self.mixin.metadata.withName(name) + self.mixin.spec.withReplicas(replicas) + self.mixin.spec.template.spec.withContainers(containers) + self.mixin.spec.withVolumeClaimTemplates(volumeClaims) + self.mixin.spec.template.metadata.withLabels(podLabels), + new(name, replicas, containers, volumeClaims, podLabels={ app: name }):: apiVersion + kind + self.mixin.metadata.withName(name) + self.mixin.spec.withReplicas(replicas) + self.mixin.spec.template.spec.withContainers(containers) + self.mixin.spec.withVolumeClaimTemplates(volumeClaims) + self.mixin.spec.template.metadata.withLabels(podLabels), mixin:: { // metadata:: { @@ -1246,7 +1246,7 @@ // StatefulSetList is a collection of StatefulSets. statefulSetList:: { local kind = { kind: "StatefulSetList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // @@ -1263,7 +1263,7 @@ // TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver. tokenReview:: { local kind = { kind: "TokenReview" }, - new(token):: kind + apiVersion + self.mixin.spec.withToken(token), + new(token):: apiVersion + kind + self.mixin.spec.withToken(token), mixin:: { // metadata:: { @@ -1359,7 +1359,7 @@ // TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver. tokenReview:: { local kind = { kind: "TokenReview" }, - new(token):: kind + apiVersion + self.mixin.spec.withToken(token), + new(token):: apiVersion + kind + self.mixin.spec.withToken(token), mixin:: { // metadata:: { @@ -1457,7 +1457,7 @@ // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking. localSubjectAccessReview:: { local kind = { kind: "LocalSubjectAccessReview" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -1588,7 +1588,7 @@ // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means "in all namespaces". Self is a special case, because users should always be able to check whether they can perform an action selfSubjectAccessReview:: { local kind = { kind: "SelfSubjectAccessReview" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -1709,7 +1709,7 @@ // SubjectAccessReview checks whether or not a user or group can perform an action. subjectAccessReview:: { local kind = { kind: "SubjectAccessReview" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -1843,7 +1843,7 @@ // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking. localSubjectAccessReview:: { local kind = { kind: "LocalSubjectAccessReview" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -1974,7 +1974,7 @@ // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means "in all namespaces". Self is a special case, because users should always be able to check whether they can perform an action selfSubjectAccessReview:: { local kind = { kind: "SelfSubjectAccessReview" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -2095,7 +2095,7 @@ // SubjectAccessReview checks whether or not a user or group can perform an action. subjectAccessReview:: { local kind = { kind: "SubjectAccessReview" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -2231,7 +2231,7 @@ // configuration of a horizontal pod autoscaler. horizontalPodAutoscaler:: { local kind = { kind: "HorizontalPodAutoscaler" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -2336,7 +2336,7 @@ // list of horizontal pod autoscaler objects. horizontalPodAutoscalerList:: { local kind = { kind: "HorizontalPodAutoscalerList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // list of horizontal pod autoscaler objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // list of horizontal pod autoscaler objects. @@ -2348,7 +2348,7 @@ // Scale represents a scaling request for a resource. scale:: { local kind = { kind: "Scale" }, - new(replicas):: kind + apiVersion + self.mixin.spec.withReplicas(replicas), + new(replicas):: apiVersion + kind + self.mixin.spec.withReplicas(replicas), mixin:: { // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata. metadata:: { @@ -2444,7 +2444,7 @@ // HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified. horizontalPodAutoscaler:: { local kind = { kind: "HorizontalPodAutoscaler" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -2552,7 +2552,7 @@ // HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects. horizontalPodAutoscalerList:: { local kind = { kind: "HorizontalPodAutoscalerList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // items is the list of horizontal pod autoscaler objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // items is the list of horizontal pod autoscaler objects. @@ -2569,7 +2569,7 @@ // Job represents the configuration of a single job. job:: { local kind = { kind: "Job" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -2929,7 +2929,7 @@ // JobList is a collection of jobs. jobList:: { local kind = { kind: "JobList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // items is the list of Jobs. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // items is the list of Jobs. @@ -2944,7 +2944,7 @@ // CronJob represents the configuration of a single cron job. cronJob:: { local kind = { kind: "CronJob" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -3406,7 +3406,7 @@ // CronJobList is a collection of cron jobs. cronJobList:: { local kind = { kind: "CronJobList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // items is the list of CronJobs. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // items is the list of CronJobs. @@ -3423,7 +3423,7 @@ // Describes a certificate signing request certificateSigningRequest:: { local kind = { kind: "CertificateSigningRequest" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -3534,7 +3534,7 @@ // certificateSigningRequestList:: { local kind = { kind: "CertificateSigningRequestList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // @@ -3551,7 +3551,7 @@ // Binding ties one object to another; for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead. binding:: { local kind = { kind: "Binding" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -3652,7 +3652,7 @@ // ComponentStatus (and ComponentStatusList) holds the cluster validation info. componentStatus:: { local kind = { kind: "ComponentStatus" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // List of component conditions observed withConditions(conditions):: self + if std.type(conditions) == "array" then { conditions: conditions } else { conditions: [conditions] }, // List of component conditions observed @@ -3742,7 +3742,7 @@ // Status of all the conditions for the component as a list of ComponentStatus objects. componentStatusList:: { local kind = { kind: "ComponentStatusList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // List of ComponentStatus objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of ComponentStatus objects. @@ -3754,7 +3754,7 @@ // ConfigMap holds configuration data for pods to consume. configMap:: { local kind = { kind: "ConfigMap" }, - new(name, data):: kind + apiVersion + self.mixin.metadata.withName(name) + self.withData(data), + new(name, data):: apiVersion + kind + self.mixin.metadata.withName(name) + self.withData(data), // Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. withData(data):: self + { data: data }, // Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. @@ -3843,7 +3843,7 @@ // ConfigMapList is a resource containing a list of ConfigMap objects. configMapList:: { local kind = { kind: "ConfigMapList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is the list of ConfigMaps. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of ConfigMaps. @@ -3866,7 +3866,7 @@ // ] endpoints:: { local kind = { kind: "Endpoints" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service. withSubsets(subsets):: self + if std.type(subsets) == "array" then { subsets: subsets } else { subsets: [subsets] }, // The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service. @@ -3956,7 +3956,7 @@ // EndpointsList is a list of endpoints. endpointsList:: { local kind = { kind: "EndpointsList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of endpoints. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of endpoints. @@ -3968,7 +3968,7 @@ // Event is a report of an event somewhere in the cluster. event:: { local kind = { kind: "Event" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // The number of times this event has occurred. withCount(count):: self + { count: count }, // A human-readable description of the status of this operation. @@ -4099,7 +4099,7 @@ // EventList is a list of events. eventList:: { local kind = { kind: "EventList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of events withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of events @@ -4111,7 +4111,7 @@ // LimitRange sets resource usage limits for each kind of resource in a Namespace. limitRange:: { local kind = { kind: "LimitRange" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -4207,7 +4207,7 @@ // LimitRangeList is a list of LimitRange items. limitRangeList:: { local kind = { kind: "LimitRangeList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is a list of LimitRange objects. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_limit_range.md withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of LimitRange objects. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_limit_range.md @@ -4219,7 +4219,7 @@ // Namespace provides a scope for Names. Use of multiple namespaces is optional. namespace:: { local kind = { kind: "Namespace" }, - new(name):: kind + apiVersion + self.mixin.metadata.withName(name), + new(name):: apiVersion + kind + self.mixin.metadata.withName(name), mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -4314,7 +4314,7 @@ // NamespaceList is a list of Namespaces. namespaceList:: { local kind = { kind: "NamespaceList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is the list of Namespace objects in the list. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of Namespace objects in the list. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ @@ -4326,7 +4326,7 @@ // Node is a worker node in Kubernetes. Each node will have a unique identifier in the cache (i.e. in etcd). node:: { local kind = { kind: "Node" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -4430,7 +4430,7 @@ // NodeList is the whole list of all Nodes which have been registered with master. nodeList:: { local kind = { kind: "NodeList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of nodes withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of nodes @@ -4442,7 +4442,7 @@ // PersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes persistentVolume:: { local kind = { kind: "PersistentVolume" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -4923,7 +4923,7 @@ // PersistentVolumeClaim is a user's request for and claim to a persistent volume persistentVolumeClaim:: { local kind = { kind: "PersistentVolumeClaim" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -5051,7 +5051,7 @@ // PersistentVolumeClaimList is a list of PersistentVolumeClaim items. persistentVolumeClaimList:: { local kind = { kind: "PersistentVolumeClaimList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // A list of persistent volume claims. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // A list of persistent volume claims. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims @@ -5063,7 +5063,7 @@ // PersistentVolumeList is a list of PersistentVolume items. persistentVolumeList:: { local kind = { kind: "PersistentVolumeList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of persistent volumes. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of persistent volumes. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes @@ -5075,7 +5075,7 @@ // Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts. pod:: { local kind = { kind: "Pod" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -5322,7 +5322,7 @@ // PodList is a list of Pods. podList:: { local kind = { kind: "PodList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of pods. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of pods. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md @@ -5334,7 +5334,7 @@ // PodTemplate describes a template for creating copies of a predefined pod. podTemplate:: { local kind = { kind: "PodTemplate" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -5665,7 +5665,7 @@ // PodTemplateList is a list of PodTemplates. podTemplateList:: { local kind = { kind: "PodTemplateList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of pod templates withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of pod templates @@ -5677,7 +5677,7 @@ // ReplicationController represents the configuration of a replication controller. replicationController:: { local kind = { kind: "ReplicationController" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -6022,7 +6022,7 @@ // ReplicationControllerList is a collection of replication controllers. replicationControllerList:: { local kind = { kind: "ReplicationControllerList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of replication controllers. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of replication controllers. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller @@ -6034,7 +6034,7 @@ // ResourceQuota sets aggregate quota restrictions enforced per namespace resourceQuota:: { local kind = { kind: "ResourceQuota" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -6133,7 +6133,7 @@ // ResourceQuotaList is a list of ResourceQuota items. resourceQuotaList:: { local kind = { kind: "ResourceQuotaList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is a list of ResourceQuota objects. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_resource_quota.md withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of ResourceQuota objects. More info: https://git.k8s.io/community/contributors/design-proposals/admission_control_resource_quota.md @@ -6145,8 +6145,8 @@ // Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes. secret:: { local kind = { kind: "Secret" }, - new(name, data, type="Opaque"):: kind + apiVersion + self.mixin.metadata.withName(name) + self.withData(data) + self.withType(type), - fromString(name, stringData, type="Opaque"):: kind + apiVersion + self.mixin.metadata.withName(name) + self.withStringData(stringData) + self.withType(type), + new(name, data, type="Opaque"):: apiVersion + kind + self.mixin.metadata.withName(name) + self.withData(data) + self.withType(type), + fromString(name, stringData, type="Opaque"):: apiVersion + kind + self.mixin.metadata.withName(name) + self.withStringData(stringData) + self.withType(type), // Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 withData(data):: self + { data: data }, // Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 @@ -6241,7 +6241,7 @@ // SecretList is a list of Secret. secretList:: { local kind = { kind: "SecretList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is a list of secret objects. More info: https://kubernetes.io/docs/concepts/configuration/secret withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of secret objects. More info: https://kubernetes.io/docs/concepts/configuration/secret @@ -6253,7 +6253,7 @@ // Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy. service:: { local kind = { kind: "Service" }, - new(name, selector, ports):: kind + apiVersion + self.mixin.metadata.withName(name) + self.mixin.spec.withSelector(selector) + self.mixin.spec.withPorts(ports), + new(name, selector, ports):: apiVersion + kind + self.mixin.metadata.withName(name) + self.mixin.spec.withSelector(selector) + self.mixin.spec.withPorts(ports), mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -6375,7 +6375,7 @@ // ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets serviceAccount:: { local kind = { kind: "ServiceAccount" }, - new(name):: kind + apiVersion + self.mixin.metadata.withName(name), + new(name):: apiVersion + kind + self.mixin.metadata.withName(name), // AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level. withAutomountServiceAccountToken(automountServiceAccountToken):: self + { automountServiceAccountToken: automountServiceAccountToken }, // ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod @@ -6472,7 +6472,7 @@ // ServiceAccountList is a list of ServiceAccount objects serviceAccountList:: { local kind = { kind: "ServiceAccountList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of ServiceAccounts. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of ServiceAccounts. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ @@ -6484,7 +6484,7 @@ // ServiceList holds a list of services. serviceList:: { local kind = { kind: "ServiceList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // List of services withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of services @@ -6501,7 +6501,7 @@ // DaemonSet represents the configuration of a daemon set. daemonSet:: { local kind = { kind: "DaemonSet" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -6873,7 +6873,7 @@ // DaemonSetList is a collection of daemon sets. daemonSetList:: { local kind = { kind: "DaemonSetList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // A list of daemon sets. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // A list of daemon sets. @@ -6885,7 +6885,7 @@ // Deployment enables declarative updates for Pods and ReplicaSets. deployment:: { local kind = { kind: "Deployment" }, - new(name, replicas, containers, podLabels={ app: name }):: kind + apiVersion + self.mixin.metadata.withName(name) + self.mixin.spec.withReplicas(replicas) + self.mixin.spec.template.spec.withContainers(containers) + self.mixin.spec.template.metadata.withLabels(podLabels), + new(name, replicas, containers, podLabels={ app: name }):: apiVersion + kind + self.mixin.metadata.withName(name) + self.mixin.spec.withReplicas(replicas) + self.mixin.spec.template.spec.withContainers(containers) + self.mixin.spec.template.metadata.withLabels(podLabels), mixin:: { // Standard object metadata. metadata:: { @@ -7273,7 +7273,7 @@ // DeploymentList is a list of Deployments. deploymentList:: { local kind = { kind: "DeploymentList" }, - new(items):: kind + apiVersion + self.withItems(items), + new(items):: apiVersion + kind + self.withItems(items), // Items is the list of Deployments. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of Deployments. @@ -7285,7 +7285,7 @@ // DeploymentRollback stores the information required to rollback a deployment. deploymentRollback:: { local kind = { kind: "DeploymentRollback" }, - new(name):: kind + apiVersion + self.withName(name), + new(name):: apiVersion + kind + self.withName(name), // Required: This must match the Name of a deployment. withName(name):: self + { name: name }, // The annotations to be updated to a deployment @@ -7306,7 +7306,7 @@ // Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. ingress:: { local kind = { kind: "Ingress" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -7417,7 +7417,7 @@ // IngressList is a collection of Ingress. ingressList:: { local kind = { kind: "IngressList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is the list of Ingress. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of Ingress. @@ -7429,7 +7429,7 @@ // NetworkPolicy describes what network traffic is allowed for a set of Pods networkPolicy:: { local kind = { kind: "NetworkPolicy" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -7540,7 +7540,7 @@ // Network Policy List is a list of NetworkPolicy objects. networkPolicyList:: { local kind = { kind: "NetworkPolicyList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of schema objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of schema objects. @@ -7552,7 +7552,7 @@ // Pod Security Policy governs the ability to make requests that affect the Security Context that will be applied to a pod and container. podSecurityPolicy:: { local kind = { kind: "PodSecurityPolicy" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -7735,7 +7735,7 @@ // Pod Security Policy List is a list of PodSecurityPolicy objects. podSecurityPolicyList:: { local kind = { kind: "PodSecurityPolicyList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of schema objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of schema objects. @@ -7747,7 +7747,7 @@ // ReplicaSet represents the configuration of a ReplicaSet. replicaSet:: { local kind = { kind: "ReplicaSet" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // If the Labels of a ReplicaSet are empty, they are defaulted to be the same as the Pod(s) that the ReplicaSet manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -8103,7 +8103,7 @@ // ReplicaSetList is a collection of ReplicaSets. replicaSetList:: { local kind = { kind: "ReplicaSetList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // List of ReplicaSets. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // List of ReplicaSets. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller @@ -8115,7 +8115,7 @@ // represents a scaling request for a resource. scale:: { local kind = { kind: "Scale" }, - new(replicas):: kind + apiVersion + self.mixin.spec.withReplicas(replicas), + new(replicas):: apiVersion + kind + self.mixin.spec.withReplicas(replicas), mixin:: { // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata. metadata:: { @@ -8208,7 +8208,7 @@ // A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource types to the API. It consists of one or more Versions of the api. thirdPartyResource:: { local kind = { kind: "ThirdPartyResource" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Description is the description of this object. withDescription(description):: self + { description: description }, // Versions are versions for this third party object @@ -8300,7 +8300,7 @@ // ThirdPartyResourceList is a list of ThirdPartyResources. thirdPartyResourceList:: { local kind = { kind: "ThirdPartyResourceList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is the list of ThirdPartyResources. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of ThirdPartyResources. @@ -8317,7 +8317,7 @@ // NetworkPolicy describes what network traffic is allowed for a set of Pods networkPolicy:: { local kind = { kind: "NetworkPolicy" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata metadata:: { @@ -8428,7 +8428,7 @@ // NetworkPolicyList is a list of NetworkPolicy objects. networkPolicyList:: { local kind = { kind: "NetworkPolicyList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of schema objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of schema objects. @@ -8455,7 +8455,7 @@ // Eviction evicts a pod from its node subject to certain policies and safety constraints. This is a subresource of Pod. A request to cause such an eviction is created by POSTing to .../pods//evictions. eviction:: { local kind = { kind: "Eviction" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // DeleteOptions may be provided deleteOptions:: { @@ -8560,7 +8560,7 @@ // PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods podDisruptionBudget:: { local kind = { kind: "PodDisruptionBudget" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -8670,7 +8670,7 @@ // PodDisruptionBudgetList is a collection of PodDisruptionBudgets. podDisruptionBudgetList:: { local kind = { kind: "PodDisruptionBudgetList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // @@ -8687,7 +8687,7 @@ // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. clusterRole:: { local kind = { kind: "ClusterRole" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Rules holds all the PolicyRules for this ClusterRole withRules(rules):: self + if std.type(rules) == "array" then { rules: rules } else { rules: [rules] }, // Rules holds all the PolicyRules for this ClusterRole @@ -8777,7 +8777,7 @@ // ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject. clusterRoleBinding:: { local kind = { kind: "ClusterRoleBinding" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Subjects holds references to the objects the role applies to. withSubjects(subjects):: self + if std.type(subjects) == "array" then { subjects: subjects } else { subjects: [subjects] }, // Subjects holds references to the objects the role applies to. @@ -8877,7 +8877,7 @@ // ClusterRoleBindingList is a collection of ClusterRoleBindings clusterRoleBindingList:: { local kind = { kind: "ClusterRoleBindingList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of ClusterRoleBindings withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of ClusterRoleBindings @@ -8889,7 +8889,7 @@ // ClusterRoleList is a collection of ClusterRoles clusterRoleList:: { local kind = { kind: "ClusterRoleList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of ClusterRoles withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of ClusterRoles @@ -8901,7 +8901,7 @@ // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. role:: { local kind = { kind: "Role" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Rules holds all the PolicyRules for this Role withRules(rules):: self + if std.type(rules) == "array" then { rules: rules } else { rules: [rules] }, // Rules holds all the PolicyRules for this Role @@ -8991,7 +8991,7 @@ // RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. roleBinding:: { local kind = { kind: "RoleBinding" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Subjects holds references to the objects the role applies to. withSubjects(subjects):: self + if std.type(subjects) == "array" then { subjects: subjects } else { subjects: [subjects] }, // Subjects holds references to the objects the role applies to. @@ -9091,7 +9091,7 @@ // RoleBindingList is a collection of RoleBindings roleBindingList:: { local kind = { kind: "RoleBindingList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of RoleBindings withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of RoleBindings @@ -9103,7 +9103,7 @@ // RoleList is a collection of Roles roleList:: { local kind = { kind: "RoleList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of Roles withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of Roles @@ -9118,7 +9118,7 @@ // ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. clusterRole:: { local kind = { kind: "ClusterRole" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Rules holds all the PolicyRules for this ClusterRole withRules(rules):: self + if std.type(rules) == "array" then { rules: rules } else { rules: [rules] }, // Rules holds all the PolicyRules for this ClusterRole @@ -9208,7 +9208,7 @@ // ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject. clusterRoleBinding:: { local kind = { kind: "ClusterRoleBinding" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Subjects holds references to the objects the role applies to. withSubjects(subjects):: self + if std.type(subjects) == "array" then { subjects: subjects } else { subjects: [subjects] }, // Subjects holds references to the objects the role applies to. @@ -9308,7 +9308,7 @@ // ClusterRoleBindingList is a collection of ClusterRoleBindings clusterRoleBindingList:: { local kind = { kind: "ClusterRoleBindingList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of ClusterRoleBindings withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of ClusterRoleBindings @@ -9320,7 +9320,7 @@ // ClusterRoleList is a collection of ClusterRoles clusterRoleList:: { local kind = { kind: "ClusterRoleList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of ClusterRoles withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of ClusterRoles @@ -9332,7 +9332,7 @@ // Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. role:: { local kind = { kind: "Role" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Rules holds all the PolicyRules for this Role withRules(rules):: self + if std.type(rules) == "array" then { rules: rules } else { rules: [rules] }, // Rules holds all the PolicyRules for this Role @@ -9422,7 +9422,7 @@ // RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace. roleBinding:: { local kind = { kind: "RoleBinding" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Subjects holds references to the objects the role applies to. withSubjects(subjects):: self + if std.type(subjects) == "array" then { subjects: subjects } else { subjects: [subjects] }, // Subjects holds references to the objects the role applies to. @@ -9522,7 +9522,7 @@ // RoleBindingList is a collection of RoleBindings roleBindingList:: { local kind = { kind: "RoleBindingList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of RoleBindings withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of RoleBindings @@ -9534,7 +9534,7 @@ // RoleList is a collection of Roles roleList:: { local kind = { kind: "RoleList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of Roles withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of Roles @@ -9551,7 +9551,7 @@ // PodPreset is a policy resource that defines additional runtime requirements for a Pod. podPreset:: { local kind = { kind: "PodPreset" }, - new():: kind + apiVersion, + new():: apiVersion + kind, mixin:: { // metadata:: { @@ -9677,7 +9677,7 @@ // PodPresetList is a list of PodPreset objects. podPresetList:: { local kind = { kind: "PodPresetList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is a list of schema objects. withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is a list of schema objects. @@ -9696,7 +9696,7 @@ // StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name. storageClass:: { local kind = { kind: "StorageClass" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Parameters holds the parameters for the provisioner that should create volumes of this storage class. withParameters(parameters):: self + { parameters: parameters }, // Parameters holds the parameters for the provisioner that should create volumes of this storage class. @@ -9787,7 +9787,7 @@ // StorageClassList is a collection of storage classes. storageClassList:: { local kind = { kind: "StorageClassList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is the list of StorageClasses withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of StorageClasses @@ -9804,7 +9804,7 @@ // StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name. storageClass:: { local kind = { kind: "StorageClass" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Parameters holds the parameters for the provisioner that should create volumes of this storage class. withParameters(parameters):: self + { parameters: parameters }, // Parameters holds the parameters for the provisioner that should create volumes of this storage class. @@ -9895,7 +9895,7 @@ // StorageClassList is a collection of storage classes. storageClassList:: { local kind = { kind: "StorageClassList" }, - new():: kind + apiVersion, + new():: apiVersion + kind, // Items is the list of StorageClasses withItems(items):: self + if std.type(items) == "array" then { items: items } else { items: [items] }, // Items is the list of StorageClasses diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/README.md b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/README.md new file mode 100644 index 000000000..cd329bfdc --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/README.md @@ -0,0 +1,72 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [core](#core) + - [Quickstart](#quickstart) + - [Using the library](#using-the-library) + - [io.ksonnet.pkg.kubeflow-core](#ioksonnetpkgkubeflow-core) + - [Example](#example) + - [Parameters](#parameters) + + + +# core + +> Core components of Kubeflow. + + +* [Quickstart](#quickstart) +* [Using Prototypes](#using-prototypes) + * [io.ksonnet.pkg.kubeflow-core](#io.ksonnet.pkg.kubeflow-core) + +## Quickstart + +*The following commands use the `io.ksonnet.pkg.kubeflow` prototype to generate Kubernetes YAML for core, and then deploys it to your Kubernetes cluster.* + +First, create a cluster and install the ksonnet CLI (see root-level [README.md](rootReadme)). + +If you haven't yet created a [ksonnet application](linkToSomewhere), do so using `ks init `. + +Finally, in the ksonnet application directory, run the following: + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.kubeflow-core \ + --name core \ + --namespace default \ + --disks + +# Apply to server. +$ ks apply -f core.jsonnet +``` + +## Using the library + +The library files for core define a set of relevant *parts* (_e.g._, deployments, services, secrets, and so on) that can be combined to configure core for a wide variety of scenarios. For example, a database like Redis may need a secret to hold the user password, or it may have no password if it's acting as a cache. + +This library provides a set of pre-fabricated "flavors" (or "distributions") of core, each of which is configured for a different use case. These are captured as ksonnet *prototypes*, which allow users to interactively customize these distributions for their specific needs. + +These prototypes, as well as how to use them, are enumerated below. + +### io.ksonnet.pkg.kubeflow-core + +Kubeflow core components +#### Example + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.kubeflow-core core \ + --name YOUR_NAME_HERE +``` + +#### Parameters + +The available options to pass prototype are: + +* `--name=`: Name to give to each of the components [string] + + +[rootReadme]: https://github.com/ksonnet/mixins diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/all.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/all.libsonnet new file mode 100644 index 000000000..95d1747bc --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/all.libsonnet @@ -0,0 +1,19 @@ +{ + parts(params):: { + local ambassador = import "kubeflow/core/ambassador.libsonnet", + local jupyterhub = import "kubeflow/core/jupyterhub.libsonnet", + local nfs = import "kubeflow/core/nfs.libsonnet", + local tfjob = import "kubeflow/core/tf-job-operator.libsonnet", + local spartakus = import "kubeflow/core/spartakus.libsonnet", + local centraldashboard = import "kubeflow/core/centraldashboard.libsonnet", + local version = import "kubeflow/core/version.libsonnet", + + all:: jupyterhub.all(params) + + tfjob.all(params) + + ambassador.all(params) + + nfs.all(params) + + spartakus.all(params) + + centraldashboard.all(params) + + version.all(params), + }, +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/ambassador.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/ambassador.libsonnet new file mode 100644 index 000000000..e4af1163a --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/ambassador.libsonnet @@ -0,0 +1,267 @@ +{ + all(params):: [ + $.parts(params.namespace).service(params.tfAmbassadorServiceType), + $.parts(params.namespace).adminService, + $.parts(params.namespace).role, + $.parts(params.namespace).serviceAccount, + $.parts(params.namespace).roleBinding, + $.parts(params.namespace).deploy, + $.parts(params.namespace).k8sDashboard(params.cloud), + ], + + parts(namespace):: { + local ambassadorImage = "quay.io/datawire/ambassador:0.30.1", + service(serviceType):: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + service: "ambassador", + }, + name: "ambassador", + namespace: namespace, + }, + spec: { + ports: [ + { + name: "ambassador", + port: 80, + targetPort: 80, + }, + ], + selector: { + service: "ambassador", + }, + type: serviceType, + }, + }, // service + + adminService:: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + service: "ambassador-admin", + }, + name: "ambassador-admin", + namespace: namespace, + }, + spec: { + ports: [ + { + name: "ambassador-admin", + port: 8877, + targetPort: 8877, + }, + ], + selector: { + service: "ambassador", + }, + type: "ClusterIP", + }, + }, // adminService + + role:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "Role", + metadata: { + name: "ambassador", + namespace: namespace, + }, + rules: [ + { + apiGroups: [ + "", + ], + resources: [ + "services", + ], + verbs: [ + "get", + "list", + "watch", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "configmaps", + ], + verbs: [ + "create", + "update", + "patch", + "get", + "list", + "watch", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "secrets", + ], + verbs: [ + "get", + "list", + "watch", + ], + }, + ], + }, // role + + serviceAccount:: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "ambassador", + namespace: namespace, + }, + }, // serviceAccount + + roleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "RoleBinding", + metadata: { + name: "ambassador", + namespace: namespace, + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "Role", + name: "ambassador", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "ambassador", + namespace: namespace, + }, + ], + }, // roleBinding + + deploy:: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "ambassador", + namespace: namespace, + }, + spec: { + replicas: 3, + template: { + metadata: { + labels: { + service: "ambassador", + }, + namespace: namespace, + }, + spec: { + containers: [ + { + env: [ + { + name: "AMBASSADOR_NAMESPACE", + valueFrom: { + fieldRef: { + fieldPath: "metadata.namespace", + }, + }, + }, + { + name: "AMBASSADOR_SINGLE_NAMESPACE", + value: "true", + }, + ], + image: ambassadorImage, + livenessProbe: { + httpGet: { + path: "/ambassador/v0/check_alive", + port: 8877, + }, + initialDelaySeconds: 30, + periodSeconds: 30, + }, + name: "ambassador", + readinessProbe: { + httpGet: { + path: "/ambassador/v0/check_ready", + port: 8877, + }, + initialDelaySeconds: 30, + periodSeconds: 30, + }, + resources: { + limits: { + cpu: 1, + memory: "400Mi", + }, + requests: { + cpu: "200m", + memory: "100Mi", + }, + }, + }, + { + image: "quay.io/datawire/statsd:0.30.1", + name: "statsd", + }, + ], + restartPolicy: "Always", + serviceAccountName: "ambassador", + }, + }, + }, + }, // deploy + + isDashboardTls(cloud):: + if cloud == "acsengine" || cloud == "aks" then + "false" + else + "true", + // This service adds a rule to our reverse proxy for accessing the K8s dashboard. + k8sDashboard(cloud):: { + apiVersion: "v1", + kind: "Service", + metadata: { + name: "k8s-dashboard", + namespace: namespace, + + annotations: { + "getambassador.io/config": + std.join("\n", [ + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: k8s-dashboard-ui-mapping", + "prefix: /k8s/ui/", + "rewrite: /", + "tls: " + $.parts(namespace).isDashboardTls(cloud), + // We redirect to the K8s service created for the dashboard + // in namespace kube-system. We don't use the k8s-dashboard service + // because that isn't in the kube-system namespace and I don't think + // it can select pods in a different namespace. + "service: kubernetes-dashboard.kube-system", + ]), + }, //annotations + }, + spec: { + ports: [ + { + port: 443, + targetPort: 8443, + }, + ], + selector: { + "k8s-app": "kubernetes-dashboard", + }, + type: "ClusterIP", + }, + }, // k8sDashboard + + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/centraldashboard.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/centraldashboard.libsonnet new file mode 100644 index 000000000..b3fbf6899 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/centraldashboard.libsonnet @@ -0,0 +1,159 @@ +{ + // TODO(https://github.com/ksonnet/ksonnet/issues/222): Taking namespace as an argument is a work around for the fact that ksonnet + // doesn't support automatically piping in the namespace from the environment to prototypes. + + // TODO(https://github.com/kubeflow/kubeflow/issues/527): The central UI is currently using a personal docker image: swiftdiaries/centraldashboard:0.3 + // We need to build and publish a docker image as part of our release process. + + all(params):: [ + $.parts(params.namespace).deployUi, + $.parts(params.namespace).uiService, + $.parts(params.namespace).uiServiceAccount, + $.parts(params.namespace).uiRole, + $.parts(params.namespace).uiRoleBinding, + ], + + parts(namespace):: { + + deployUi:: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: namespace, + }, + spec: { + template: { + metadata: { + labels: { + app: "centraldashboard", + }, + }, + spec: { + containers: [ + { + image: "swiftdiaries/centraldashboard:0.3", + name: "centraldashboard", + ports: [ + { + containerPort: 8082, + }, + ], + }, + ], + serviceAccountName: "centraldashboard", + }, + }, + }, + }, // deployUi + + uiService:: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: namespace, + annotations: { + "getambassador.io/config": + std.join("\n", [ + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: centralui-mapping", + "prefix: /", + "rewrite: /", + "service: centraldashboard." + namespace, + ]), + }, //annotations + }, + spec: { + ports: [ + { + port: 80, + targetPort: 8082, + }, + ], + selector: { + app: "centraldashboard", + }, + sessionAffinity: "None", + type: "ClusterIP", + }, + }, //service + + uiServiceAccount:: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "centraldashboard", + namespace: namespace, + }, + }, // service account + + uiRole:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: namespace, + }, + rules: [ + { + apiGroups: [""], + resources: [ + "pods", + "pods/exec", + "pods/log", + ], + verbs: [ + "get", + "list", + "watch", + ], + }, + { + apiGroups: [""], + resources: [ + "secrets", + ], + verbs: [ + "get", + ], + }, + ], + }, // operator-role + + uiRoleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: namespace, + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "centraldashboard", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "centraldashboard", + namespace: namespace, + }, + ], + }, // role binding + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/cert-manager.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/cert-manager.libsonnet new file mode 100644 index 000000000..ab099d866 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/cert-manager.libsonnet @@ -0,0 +1,182 @@ +{ + parts(namespace):: { + local k = import "k.libsonnet", + local certManagerImage = "quay.io/jetstack/cert-manager-controller:v0.2.4", + local certManagerIngressShimImage = "quay.io/jetstack/cert-manager-ingress-shim:v0.2.4", + + // Note, not using std.prune to preserve required empty http01 map in the Issuer spec. + certManagerParts(acmeEmail, acmeUrl):: k.core.v1.list.new([ + $.parts(namespace).certificateCRD, + $.parts(namespace).clusterIssuerCRD, + $.parts(namespace).issuerCRD, + $.parts(namespace).serviceAccount, + $.parts(namespace).clusterRole, + $.parts(namespace).clusterRoleBinding, + $.parts(namespace).deploy, + $.parts(namespace).issuerLEProd(acmeEmail, acmeUrl), + ]), + + certificateCRD:: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "certificates.certmanager.k8s.io", + }, + spec: { + group: "certmanager.k8s.io", + version: "v1alpha1", + names: { + kind: "Certificate", + plural: "certificates", + }, + scope: "Namespaced", + }, + }, + + clusterIssuerCRD:: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "clusterissuers.certmanager.k8s.io", + }, + + spec: { + group: "certmanager.k8s.io", + version: "v1alpha1", + names: { + kind: "ClusterIssuer", + plural: "clusterissuers", + }, + scope: "Cluster", + }, + }, + + issuerCRD:: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "issuers.certmanager.k8s.io", + }, + spec: { + group: "certmanager.k8s.io", + version: "v1alpha1", + names: { + kind: "Issuer", + plural: "issuers", + }, + scope: "Namespaced", + }, + }, + + serviceAccount:: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "cert-manager", + namespace: namespace, + }, + }, + + clusterRole:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + name: "cert-manager", + }, + rules: [ + { + apiGroups: ["certmanager.k8s.io"], + resources: ["certificates", "issuers", "clusterissuers"], + verbs: ["*"], + }, + { + apiGroups: [""], + resources: ["secrets", "events", "endpoints", "services", "pods"], + verbs: ["*"], + }, + { + apiGroups: ["extensions"], + resources: ["ingresses"], + verbs: ["*"], + }, + ], + }, + + clusterRoleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + name: "cert-manager", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "cert-manager", + }, + subjects: [ + { + name: "cert-manager", + namespace: namespace, + kind: "ServiceAccount", + }, + ], + }, + + deploy:: { + apiVersion: "apps/v1beta1", + kind: "Deployment", + metadata: { + name: "cert-manager", + namespace: namespace, + labels: { + app: "cert-manager", + }, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "cert-manager", + }, + }, + spec: { + serviceAccountName: "cert-manager", + containers: [ + { + name: "cert-manager", + image: certManagerImage, + imagePullPolicy: "IfNotPresent", + }, + { + name: "ingress-shim", + image: certManagerIngressShimImage, + imagePullPolicy: "IfNotPresent", + }, + ], + }, + }, + }, + }, + + issuerLEProd(acmeEmail, acmeUrl):: { + apiVersion: "certmanager.k8s.io/v1alpha1", + kind: "Issuer", + metadata: { + name: "letsencrypt-prod", + namespace: namespace, + }, + spec: { + acme: { + server: acmeUrl, + email: acmeEmail, + privateKeySecretRef: { + name: "letsencrypt-prod-secret", + }, + http01: { + }, + }, + }, + }, + }, +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/cloud-endpoints.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/cloud-endpoints.libsonnet new file mode 100644 index 000000000..9ab768c03 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/cloud-endpoints.libsonnet @@ -0,0 +1,332 @@ +{ + parts(namespace):: { + local k = import "k.libsonnet", + local cloudEndpointsImage = "gcr.io/cloud-solutions-group/cloud-endpoints-controller:0.1.1", + local metacontrollerImage = "gcr.io/enisoc-kubernetes/metacontroller@sha256:18561c63e1c5380ac5bbaabefa933e484bdb499f10b61071506f9a0070bc65f6", + + cloudEndpointsParts(secretName, secretKey):: k.core.v1.list.new([ + $.parts(namespace).metaServiceAccount, + $.parts(namespace).metaClusterRole, + $.parts(namespace).metaClusterRoleBinding, + $.parts(namespace).metaInitializerCRD, + $.parts(namespace).metaLambdaCRD, + $.parts(namespace).metaDeployment, + $.parts(namespace).endpointsCRD, + $.parts(namespace).endpointsService, + $.parts(namespace).endpointsServiceAccount, + $.parts(namespace).endpointsClusterRole, + $.parts(namespace).endpointsClusterRoleBinding, + $.parts(namespace).endpointsDeploy(secretName, secretKey), + $.parts(namespace).endpointsLambdaController, + ]), + + metaServiceAccount:: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "kube-metacontroller", + namespace: namespace, + }, + }, // metaServiceAccount + + metaClusterRole:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + name: "kube-metacontroller", + }, + rules: [ + { + apiGroups: ["*"], + resources: ["*"], + verbs: ["*"], + }, + ], + }, // metaClusterRole + + metaClusterRoleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + name: "kube-metacontroller", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "kube-metacontroller", + namespace: namespace, + }, + ], + roleRef: { + kind: "ClusterRole", + name: "kube-metacontroller", + apiGroup: "rbac.authorization.k8s.io", + }, + }, // metaClusterRoleBinding + + metaInitializerCRD:: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "initializercontrollers.metacontroller.k8s.io", + }, + spec: { + group: "metacontroller.k8s.io", + version: "v1alpha1", + scope: "Cluster", + names: { + plural: "initializercontrollers", + singular: "initializercontroller", + kind: "InitializerController", + shortNames: [ + "ic", + "ictl", + ], + }, + }, + }, // metaInitializerCRD + + metaLambdaCRD:: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "lambdacontrollers.metacontroller.k8s.io", + }, + spec: { + group: "metacontroller.k8s.io", + version: "v1alpha1", + scope: "Cluster", + names: { + plural: "lambdacontrollers", + singular: "lambdacontroller", + kind: "LambdaController", + shortNames: [ + "lc", + "lctl", + ], + }, + }, + }, // metaLambdaCRD + + metaDeployment:: { + apiVersion: "apps/v1beta1", + kind: "Deployment", + metadata: { + name: "kube-metacontroller", + namespace: namespace, + labels: { + app: "kube-metacontroller", + }, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "kube-metacontroller", + }, + }, + spec: { + serviceAccountName: "kube-metacontroller", + containers: [ + { + name: "kube-metacontroller", + image: metacontrollerImage, + command: [ + "/usr/bin/metacontroller", + ], + args: [ + "--logtostderr", + ], + imagePullPolicy: "Always", + }, + ], + }, + }, + }, + }, // metaDeployment + + endpointsCRD:: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "cloudendpoints.ctl.isla.solutions", + }, + spec: { + group: "ctl.isla.solutions", + version: "v1", + scope: "Namespaced", + names: { + plural: "cloudendpoints", + singular: "cloudendpoint", + kind: "CloudEndpoint", + shortNames: [ + "cloudep", + "ce", + ], + }, + }, + }, // endpointsCRD + + endpointsService:: { + apiVersion: "v1", + kind: "Service", + metadata: { + name: "cloud-endpoints-controller", + namespace: namespace, + }, + spec: { + type: "ClusterIP", + ports: [ + { + name: "http", + port: 80, + }, + ], + selector: { + app: "cloud-endpoints-controller", + }, + }, + }, // endpointsService + + endpointsLambdaController:: { + apiVersion: "metacontroller.k8s.io/v1alpha1", + kind: "LambdaController", + metadata: { + name: "cloud-endpoints-controller", + }, + spec: { + parentResource: { + apiVersion: "ctl.isla.solutions/v1", + resource: "cloudendpoints", + }, + childResources: [], + clientConfig: { + service: { + name: "cloud-endpoints-controller", + namespace: namespace, + caBundle: "...", + }, + }, + hooks: { + sync: { + path: "/sync", + }, + }, + generateSelector: true, + }, + }, // endpointsLambdaController + + endpointsServiceAccount:: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "cloud-endpoints-controller", + namespace: namespace, + }, + }, // endpointsServiceAccount + + endpointsClusterRole:: { + kind: "ClusterRole", + apiVersion: "rbac.authorization.k8s.io/v1beta1", + metadata: { + name: "cloud-endpoints-controller", + namespace: namespace, + }, + rules: [ + { + apiGroups: [""], + resources: ["services"], + verbs: ["get", "list"], + }, + { + apiGroups: ["extensions"], + resources: ["ingresses"], + verbs: ["get", "list"], + }, + ], + }, // endpointsClusterRole + + endpointsClusterRoleBinding:: { + kind: "ClusterRoleBinding", + apiVersion: "rbac.authorization.k8s.io/v1beta1", + metadata: { + name: "cloud-endpoints-controller", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "cloud-endpoints-controller", + namespace: namespace, + }, + ], + roleRef: { + kind: "ClusterRole", + name: "cloud-endpoints-controller", + apiGroup: "rbac.authorization.k8s.io", + }, + }, // endpointsClusterRoleBinding + + endpointsDeploy(secretName, secretKey):: { + apiVersion: "apps/v1beta1", + kind: "Deployment", + metadata: { + name: "cloud-endpoints-controller", + namespace: namespace, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "cloud-endpoints-controller", + }, + }, + spec: { + serviceAccountName: "cloud-endpoints-controller", + terminationGracePeriodSeconds: 5, + containers: [ + { + name: "cloud-endpoints-controller", + image: cloudEndpointsImage, + imagePullPolicy: "Always", + env: [ + { + name: "GOOGLE_APPLICATION_CREDENTIALS", + value: "/var/run/secrets/sa/" + secretKey, + }, + ], + volumeMounts: [ + { + name: "sa-key", + readOnly: true, + mountPath: "/var/run/secrets/sa", + }, + ], + readinessProbe: { + httpGet: { + path: "/healthz", + port: 80, + scheme: "HTTP", + periodSeconds: 5, + timeoutSeconds: 5, + successThreshold: 1, + failureThreshold: 2, + }, + }, + }, + ], + volumes: [ + { + name: "sa-key", + secret: { + secretName: secretName, + }, + }, + ], + }, + }, + }, + }, // endpointsDeploy + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/iap.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/iap.libsonnet new file mode 100644 index 000000000..cda4618bd --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/iap.libsonnet @@ -0,0 +1,796 @@ +{ + parts(namespace):: { + local k = import "k.libsonnet", + + // Test if the given hostname is in the form of: "NAME.endpoints.PROJECT.cloud.goog" + local isCloudEndpoint = function(str) { + local toks = std.split(str, "."), + result:: + (std.length(toks) == 5 && toks[1] == "endpoints" && toks[3] == "cloud" && toks[4] == "goog"), + }.result, + + // Creates map of parameters from a given hostname in the form of: "NAME.endpoints.PROJECT.cloud.goog" + local makeEndpointParams = function(str) { + local toks = std.split(str, "."), + result:: { + name: toks[0], + project: toks[2], + }, + }.result, + + ingressParts(secretName, ipName, hostname, issuer, envoyImage, disableJwt, oauthSecretName):: std.prune(k.core.v1.list.new([ + $.parts(namespace).service, + $.parts(namespace).ingress(secretName, ipName, hostname), + $.parts(namespace).certificate(secretName, hostname, issuer), + $.parts(namespace).initServiceAcount, + $.parts(namespace).initClusterRoleBinding, + $.parts(namespace).initClusterRole, + $.parts(namespace).deploy(envoyImage, oauthSecretName), + $.parts(namespace).configMap(disableJwt), + $.parts(namespace).whoamiService, + $.parts(namespace).whoamiApp, + (if isCloudEndpoint(hostname) then $.parts(namespace).cloudEndpoint(makeEndpointParams(hostname))), + ])), + + service:: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + service: "envoy", + }, + name: "envoy", + namespace: namespace, + }, + spec: { + ports: [ + { + name: "envoy", + port: envoyPort, + targetPort: envoyPort, + }, + ], + selector: { + service: "envoy", + }, + // NodePort because this will be the backend for our ingress. + type: "NodePort", + }, + }, // service + + initServiceAcount:: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "envoy", + namespace: namespace, + }, + }, // initServiceAccount + + initClusterRoleBinding:: { + kind: "ClusterRoleBinding", + apiVersion: "rbac.authorization.k8s.io/v1beta1", + metadata: { + name: "envoy", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "envoy", + namespace: namespace, + }, + ], + roleRef: { + kind: "ClusterRole", + name: "envoy", + apiGroup: "rbac.authorization.k8s.io", + }, + }, // initClusterRoleBinding + + initClusterRole:: { + kind: "ClusterRole", + apiVersion: "rbac.authorization.k8s.io/v1beta1", + metadata: { + name: "envoy", + namespace: namespace, + }, + rules: [ + { + apiGroups: [""], + resources: ["services", "configmaps"], + verbs: ["get", "list", "patch", "update"], + }, + ], + }, // initClusterRoleBinding + + envoyContainer(params):: { + image: params.image, + command: [ + "/usr/local/bin/envoy", + "-c", + params.configPath, + "--log-level", + "info", + // Since we are running multiple instances of envoy on the same host we need to set a unique baseId + "--base-id", + params.baseId, + ], + imagePullPolicy: "Always", + name: params.name, + livenessProbe: { + httpGet: { + path: params.healthPath, + port: params.healthPort, + }, + initialDelaySeconds: 30, + periodSeconds: 30, + }, + readinessProbe: { + httpGet: { + path: params.healthPath, + port: params.healthPort, + }, + initialDelaySeconds: 30, + periodSeconds: 30, + }, + ports: std.map(function(p) + { + containerPort: p, + } + , params.ports), + resources: { + limits: { + cpu: 1, + memory: "400Mi", + }, + requests: { + cpu: "200m", + memory: "100Mi", + }, + }, + volumeMounts: [ + { + mountPath: "/etc/envoy", + name: "shared", + }, + ], + }, // envoyContainer + + deploy(image, oauthSecretName):: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "envoy", + namespace: namespace, + }, + spec: { + replicas: 3, + template: { + metadata: { + labels: { + service: "envoy", + }, + }, + spec: { + serviceAccountName: "envoy", + containers: [ + $.parts(namespace).envoyContainer({ + image: image, + name: "envoy", + // We use the admin port for the health, readiness check because the main port will require a valid JWT. + // healthPath: "/server_info", + healthPath: "/healthz", + healthPort: envoyPort, + configPath: "/etc/envoy/envoy-config.json", + baseId: "27000", + ports: [envoyPort, envoyAdminPort, envoyStatsPort], + }), + { + name: "iap", + image: "google/cloud-sdk:alpine", + command: [ + "sh", + "/var/envoy-config/iap-init.sh", + ], + env: [ + { + name: "NAMESPACE", + value: namespace, + }, + { + name: "CLIENT_ID", + valueFrom: { + secretKeyRef: { + name: oauthSecretName, + key: "CLIENT_ID", + }, + }, + }, + { + name: "CLIENT_SECRET", + valueFrom: { + secretKeyRef: { + name: oauthSecretName, + key: "CLIENT_SECRET", + }, + }, + }, + { + name: "SERVICE", + value: "envoy", + }, + { + name: "ENVOY_ADMIN", + value: "http://localhost:" + envoyAdminPort, + }, + ], + volumeMounts: [ + { + mountPath: "/var/envoy-config/", + name: "config-volume", + }, + { + mountPath: "/var/shared/", + name: "shared", + }, + ], + }, + ], + restartPolicy: "Always", + volumes: [ + { + configMap: { + name: "envoy-config", + }, + name: "config-volume", + }, + { + emptyDir: { + medium: "Memory", + }, + name: "shared", + }, + ], + }, + }, + }, + }, // deploy + + configMap(disableJwt):: { + apiVersion: "v1", + kind: "ConfigMap", + metadata: { + name: "envoy-config", + namespace: namespace, + }, + data: { + "envoy-config.json": std.manifestJson($.parts(namespace).envoyConfig(disableJwt)), + // Script executed by the iap container to configure IAP. When finished, the envoy config is created with the JWT audience. + "iap-init.sh": ||| + [ -z ${CLIENT_ID} ] && echo Error CLIENT_ID must be set && exit 1 + [ -z ${CLIENT_SECRET} ] && echo Error CLIENT_SECRET must be set && exit 1 + [ -z ${NAMESPACE} ] && echo Error NAMESPACE must be set && exit 1 + [ -z ${SERVICE} ] && echo Error SERVICE must be set && exit 1 + + apk add --update jq + curl https://storage.googleapis.com/kubernetes-release/release/v1.9.4/bin/linux/amd64/kubectl > /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl + + # Stagger init of replicas when acquiring lock + sleep $(( $RANDOM % 5 + 1 )) + + kubectl get svc ${SERVICE} -o json > service.json + LOCK=$(jq -r ".metadata.annotations.iaplock" service.json) + + NOW=$(date -u +'%s') + if [[ -z "${LOCK}" || "${LOCK}" == "null" ]]; then + LOCK_T=$NOW + else + LOCK_T=$(echo "${LOCK}" | cut -d' ' -f2) + fi + LOCK_AGE=$(( $NOW - $LOCK_T )) + LOCK_TTL=120 + if [[ -z "${LOCK}" || "${LOCK}" == "null" || "${LOCK_AGE}" -gt "${LOCK_TTL}" ]]; then + jq -r ".metadata.annotations.iaplock=\"$(hostname -s) ${NOW}\"" service.json > service_lock.json + kubectl apply -f service_lock.json 2>/dev/null + if [[ $? -eq 0 ]]; then + echo "Acquired lock on service annotation to update IAP." + else + echo "WARN: Failed to acquire lock on service annotation." + exit 1 + fi + else + echo "WARN: Lock on service annotation already acquired by: $LOCK, age: $LOCK_AGE, TTL: $LOCK_TTL" + sleep 20 + exit 1 + fi + + PROJECT=$(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/project/project-id) + if [ -z ${PROJECT} ]; then + echo Error unable to fetch PROJECT from compute metadata + exit 1 + fi + + PROJECT_NUM=$(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/project/numeric-project-id) + if [ -z ${PROJECT_NUM} ]; then + echo Error unable to fetch PROJECT_NUM from compute metadata + exit 1 + fi + + NODE_PORT=$(kubectl --namespace=${NAMESPACE} get svc ${SERVICE} -o jsonpath='{.spec.ports[0].nodePort}') + while [[ -z ${BACKEND_ID} ]]; + do BACKEND_ID=$(gcloud compute --project=${PROJECT} backend-services list --filter=name~k8s-be-${NODE_PORT}- --format='value(id)'); + echo "Waiting for backend id PROJECT=${PROJECT} NAMESPACE=${NAMESPACE} SERVICE=${SERVICE}..."; + sleep 2; + done + echo BACKEND_ID=${BACKEND_ID} + + NODE_PORT=$(kubectl --namespace=${NAMESPACE} get svc ${SERVICE} -o jsonpath='{.spec.ports[0].nodePort}') + BACKEND_SERVICE=$(gcloud --project=${PROJECT} compute backend-services list --filter=name~k8s-be-${NODE_PORT}- --uri) + # Enable IAP on the backend service: + gcloud --project=${PROJECT} compute backend-services update ${BACKEND_SERVICE} \ + --global \ + --iap=enabled,oauth2-client-id=${CLIENT_ID},oauth2-client-secret=${CLIENT_SECRET} + + while [[ -z ${HEALTH_CHECK_URI} ]]; + do HEALTH_CHECK_URI=$(gcloud compute --project=${PROJECT} health-checks list --filter=name~k8s-be-${NODE_PORT}- --uri); + echo "Waiting for the healthcheck resource PROJECT=${PROJECT} NODEPORT=${NODE_PORT} SERVICE=${SERVICE}..."; + sleep 2; + done + + # Since we create the envoy-ingress ingress object before creating the envoy + # deployment object, healthcheck will not be configured correctly in the GCP + # load balancer. It will default the healthcheck request path to a value of + # / instead of the intended /healthz. + # Manually update the healthcheck request path to /healthz + gcloud --project=${PROJECT} compute health-checks update http ${HEALTH_CHECK_URI} --request-path=/healthz + + # Since JupyterHub uses websockets we want to increase the backend timeout + echo Increasing backend timeout for JupyterHub + gcloud --project=${PROJECT} compute backend-services update --global ${BACKEND_SERVICE} --timeout=3600 + + JWT_AUDIENCE="/projects/${PROJECT_NUM}/global/backendServices/${BACKEND_ID}" + + # For healthcheck compare. + echo "JWT_AUDIENCE=${JWT_AUDIENCE}" > /var/shared/healthz.env + echo "NODE_PORT=${NODE_PORT}" >> /var/shared/healthz.env + echo "BACKEND_ID=${BACKEND_ID}" >> /var/shared/healthz.env + + kubectl get configmap -n ${NAMESPACE} envoy-config -o jsonpath='{.data.envoy-config\.json}' | \ + sed -e "s|{{JWT_AUDIENCE}}|${JWT_AUDIENCE}|g" > /var/shared/envoy-config.json + + echo "Restarting envoy" + curl -s ${ENVOY_ADMIN}/quitquitquit + + echo "Clearing lock on service annotation" + kubectl patch svc "${SERVICE}" -p "{\"metadata\": { \"annotations\": {\"iaplock\": \"\" }}}" + + function checkIAP() { + # created by init container. + . /var/shared/healthz.env + + # If node port or backend id change, so does the JWT audience. + CURR_NODE_PORT=$(kubectl --namespace=${NAMESPACE} get svc ${SERVICE} -o jsonpath='{.spec.ports[0].nodePort}') + CURR_BACKEND_ID=$(gcloud compute --project=${PROJECT} backend-services list --filter=name~k8s-be-${CURR_NODE_PORT}- --format='value(id)') + [ "$BACKEND_ID" == "$CURR_BACKEND_ID" ] + } + + # Verify IAP every 10 seconds. + while true; do + if ! checkIAP; then + echo "$(date) WARN: IAP check failed, restarting container." + exit 1 + fi + sleep 10 + done + |||, + }, + }, + + local envoyPort = 8080, + local envoyAdminPort = 8001, + local envoyStatsPort = 8025, + + // This is the config for the secondary envoy proxy which does JWT verification + // and actually routes requests to the appropriate backend. + envoyConfig(disableJwt):: { + listeners: [ + { + address: "tcp://0.0.0.0:" + envoyPort, + filters: [ + { + type: "read", + name: "http_connection_manager", + config: { + codec_type: "auto", + stat_prefix: "ingress_http", + access_log: [ + { + format: 'ACCESS [%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n', + path: "/dev/fd/1", + }, + ], + route_config: { + virtual_hosts: [ + { + name: "backend", + domains: ["*"], + routes: [ + // First route that matches is picked. + { + timeout_ms: 10000, + path: "/healthz", + prefix_rewrite: "/server_info", + weighted_clusters: { + clusters: [ + + { name: "cluster_healthz", weight: 100.0 }, + + ], + }, + }, + // Provide access to the whoami app skipping JWT verification. + // this is useful for debugging. + { + timeout_ms: 10000, + prefix: "/noiap/whoami", + prefix_rewrite: "/", + weighted_clusters: { + clusters: [ + { + name: "cluster_iap_app", + weight: 100.0, + }, + ], + }, + }, + { + timeout_ms: 10000, + prefix: "/whoami", + prefix_rewrite: "/", + weighted_clusters: { + clusters: [ + { + name: "cluster_iap_app", + weight: 100.0, + }, + ], + }, + }, + // Jupyter uses the prefixes /hub & /user + { + // JupyterHub requires the prefix /hub + // Use a 10 minute timeout because downloading + // images for jupyter notebook can take a while + timeout_ms: 600000, + prefix: "/hub", + prefix_rewrite: "/hub", + use_websocket: true, + weighted_clusters: { + clusters: [ + { + name: "cluster_jupyterhub", + weight: 100.0, + }, + ], + }, + }, + { + // JupyterHub requires the prefix /user + // Use a 10 minute timeout because downloading + // images for jupyter notebook can take a while + timeout_ms: 600000, + prefix: "/user", + prefix_rewrite: "/user", + use_websocket: true, + weighted_clusters: { + clusters: [ + { + name: "cluster_jupyterhub", + weight: 100.0, + }, + ], + }, + }, + { + // Route remaining traffic to Ambassador which supports dynamically adding + // routes based on service annotations. + timeout_ms: 10000, + prefix: "/", + prefix_rewrite: "/", + use_websocket: true, + weighted_clusters: { + clusters: [ + { + name: "cluster_ambassador", + weight: 100.0, + }, + ], + }, + }, + ], + }, + ], + }, + local authFilter = if disableJwt then + [] + else [{ + type: "decoder", + name: "jwt-auth", + config: { + jwts: [ + { + issuer: "https://cloud.google.com/iap", + audiences: "{{JWT_AUDIENCE}}", + jwks_uri: "https://www.gstatic.com/iap/verify/public_key-jwk", + jwks_uri_envoy_cluster: "iap_issuer", + jwt_headers: ["x-goog-iap-jwt-assertion"], + }, + ], + bypass_jwt: [ + { + http_method: "GET", + path_exact: "/healthz", + }, + { + http_method: "GET", + path_exact: "/noiap/whoami", + }, + ], + }, + }], + filters: + authFilter + + [ + { + type: "decoder", + name: "router", + config: {}, + }, + ], + }, + }, + ], + }, + ], + admin: { + // We use 0.0.0.0 and not 127.0.0.1 because we want the admin server to be available on all devices + // so that it can be used for health checking. + address: "tcp://0.0.0.0:" + envoyAdminPort, + access_log_path: "/tmp/admin_access_log", + }, + cluster_manager: { + clusters: [ + { + name: "cluster_healthz", + connect_timeout_ms: 3000, + type: "strict_dns", + lb_type: "round_robin", + hosts: [ + { + // We just use the admin server for the health check + url: "tcp://127.0.0.1:" + envoyAdminPort, + }, + + ], + }, + { + name: "iap_issuer", + connect_timeout_ms: 5000, + type: "strict_dns", + circuit_breakers: { + default: { + max_pending_requests: 10000, + max_requests: 10000, + }, + }, + lb_type: "round_robin", + hosts: [ + { + url: "tcp://www.gstatic.com:80", + }, + ], + }, + { + name: "cluster_iap_app", + connect_timeout_ms: 3000, + type: "strict_dns", + lb_type: "round_robin", + hosts: [ + { + url: "tcp://whoami-app." + namespace + ":80", + }, + ], + }, + { + name: "cluster_jupyterhub", + connect_timeout_ms: 3000, + type: "strict_dns", + lb_type: "round_robin", + hosts: [ + { + url: "tcp://tf-hub-lb." + namespace + ":80", + }, + + ], + }, + { + name: "cluster_ambassador", + connect_timeout_ms: 3000, + type: "strict_dns", + lb_type: "round_robin", + hosts: [ + { + url: "tcp://ambassador." + namespace + ":80", + }, + + ], + }, + ], + }, + statsd_udp_ip_address: "127.0.0.1:" + envoyStatsPort, + stats_flush_interval_ms: 1000, + }, // envoyConfig + + whoamiService:: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "whoami", + }, + name: "whoami-app", + namespace: namespace, + }, + spec: { + ports: [ + { + port: 80, + targetPort: 8081, + }, + ], + selector: { + app: "whoami", + }, + type: "ClusterIP", + }, + }, // whoamiService + + whoamiApp:: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "whoami-app", + namespace: namespace, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "whoami", + }, + }, + spec: { + containers: [ + { + env: [ + { + name: "PORT", + value: "8081", + }, + ], + image: "gcr.io/cloud-solutions-group/esp-sample-app:1.0.0", + name: "app", + ports: [ + { + containerPort: 8081, + }, + ], + readinessProbe: { + failureThreshold: 2, + httpGet: { + path: "/healthz", + port: 8081, + scheme: "HTTP", + }, + periodSeconds: 10, + successThreshold: 1, + timeoutSeconds: 5, + }, + }, + ], + }, + }, + }, + }, + + ingress(secretName, ipName, hostname):: { + apiVersion: "extensions/v1beta1", + kind: "Ingress", + metadata: { + name: "envoy-ingress", + namespace: namespace, + annotations: { + "kubernetes.io/tls-acme": "true", + "ingress.kubernetes.io/ssl-redirect": "true", + "kubernetes.io/ingress.global-static-ip-name": ipName, + }, + }, + spec: { + rules: [ + { + [if hostname != "null" then "host"]: hostname, + http: { + paths: [ + { + backend: { + // Due to https://github.com/kubernetes/contrib/blob/master/ingress/controllers/gce/examples/health_checks/README.md#limitations + // Keep port the servicePort the same as the port we are targetting on the backend so that servicePort will be the same as targetPort for the purpose of + // health checking. + serviceName: "envoy", + servicePort: envoyPort, + }, + path: "/*", + }, + ], + }, + }, + ], + tls: [ + { + secretName: secretName, + }, + ], + }, + }, // iapIngress + + certificate(secretName, hostname, issuer):: { + apiVersion: "certmanager.k8s.io/v1alpha1", + kind: "Certificate", + metadata: { + name: secretName, + namespace: namespace, + }, + + spec: { + secretName: secretName, + issuerRef: { + name: issuer, + }, + commonName: hostname, + dnsNames: [ + hostname, + ], + acme: { + config: [ + { + http01: { + ingress: "envoy-ingress", + }, + domains: [ + hostname, + ], + }, + ], + }, + }, + }, // certificate + + cloudEndpoint(params):: { + apiVersion: "ctl.isla.solutions/v1", + kind: "CloudEndpoint", + metadata: { + name: params.name, + namespace: namespace, + }, + spec: { + project: params.project, + targetIngress: { + name: "envoy-ingress", + namespace: namespace, + }, + }, + }, // cloudEndpoint + + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/jupyterhub.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/jupyterhub.libsonnet new file mode 100644 index 000000000..90cf88e89 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/jupyterhub.libsonnet @@ -0,0 +1,266 @@ +{ + all(params):: [ + $.parts(params.namespace).jupyterHubConfigMap(params.jupyterHubAuthenticator, params.disks), + $.parts(params.namespace).jupyterHubService, + $.parts(params.namespace).jupyterHubLoadBalancer(params.jupyterHubServiceType), + $.parts(params.namespace).jupyterHub(params.jupyterHubImage, params.jupyterNotebookPVCMount, params.cloud), + $.parts(params.namespace).jupyterHubRole, + $.parts(params.namespace).jupyterHubServiceAccount, + $.parts(params.namespace).jupyterHubRoleBinding, + ], + + parts(namespace):: { + jupyterHubConfigMap(jupyterHubAuthenticator, disks): { + local util = import "kubeflow/core/util.libsonnet", + local diskNames = util.toArray(disks), + local kubeSpawner = $.parts(namespace).kubeSpawner(jupyterHubAuthenticator, diskNames), + result:: $.parts(namespace).jupyterHubConfigMapWithSpawner(kubeSpawner), + }.result, + + kubeSpawner(authenticator, volumeClaims=[]): { + // TODO(jlewi): We should make whether we use PVC configurable. + local baseKubeConfigSpawner = importstr "kubeform_spawner.py", + + authenticatorOptions:: { + + //## Authenticator Options + local kubeConfigDummyAuthenticator = "c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'", + + // This configuration allows us to use the id provided by IAP. + local kubeConfigIAPAuthenticator = @"c.JupyterHub.authenticator_class ='jhub_remote_user_authenticator.remote_user_auth.RemoteUserAuthenticator' +c.RemoteUserAuthenticator.header_name = 'x-goog-authenticated-user-email'", + + options:: std.join("\n", std.prune([ + "######## Authenticator ######", + if authenticator == "iap" then + kubeConfigIAPAuthenticator else + kubeConfigDummyAuthenticator, + ])), + }.options, // authenticatorOptions + + volumeOptions:: { + local volumes = std.map(function(v) + { + name: v, + persistentVolumeClaim: { + claimName: v, + }, + }, volumeClaims), + + + local volumeMounts = std.map(function(v) + { + mountPath: "/mnt/" + v, + name: v, + }, volumeClaims), + + options:: + if std.length(volumeClaims) > 0 then + std.join("\n", + [ + "###### Volumes #######", + "c.KubeSpawner.volumes = " + std.manifestPython(volumes), + "c.KubeSpawner.volume_mounts = " + std.manifestPython(volumeMounts), + ]) + else "", + + }.options, // volumeOptions + + spawner:: std.join("\n", std.prune([baseKubeConfigSpawner, self.authenticatorOptions, self.volumeOptions])), + }.spawner, // kubeSpawner + + local baseJupyterHubConfigMap = { + apiVersion: "v1", + kind: "ConfigMap", + metadata: { + name: "jupyterhub-config", + namespace: namespace, + }, + }, + + jupyterHubConfigMapWithSpawner(spawner): baseJupyterHubConfigMap { + data: { + "jupyterhub_config.py": spawner, + }, + }, + + jupyterHubService: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "tf-hub", + }, + name: "tf-hub-0", + namespace: namespace, + }, + spec: { + // We want a headless service so we set the ClusterIP to be None. + // This headless server is used by individual Jupyter pods to connect back to the Hub. + clusterIP: "None", + ports: [ + { + name: "hub", + port: 8000, + }, + ], + selector: { + app: "tf-hub", + }, + }, + }, + + jupyterHubLoadBalancer(serviceType): { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "tf-hub-lb", + }, + name: "tf-hub-lb", + namespace: namespace, + }, + spec: { + ports: [ + { + name: "hub", + port: 80, + targetPort: 8000, + }, + ], + selector: { + app: "tf-hub", + }, + type: serviceType, + }, + }, + + // image: Image for JupyterHub + jupyterHub(image, notebookPVCMount, cloud): { + apiVersion: "apps/v1beta1", + kind: "StatefulSet", + metadata: { + name: "tf-hub", + namespace: namespace, + }, + spec: { + replicas: 1, + serviceName: "", + template: { + metadata: { + labels: { + app: "tf-hub", + }, + }, + spec: { + containers: [ + { + command: [ + "jupyterhub", + "-f", + "/etc/config/jupyterhub_config.py", + ], + image: image, + name: "tf-hub", + volumeMounts: [ + { + mountPath: "/etc/config", + name: "config-volume", + }, + ], + ports: [ + // Port 8000 is used by the hub to accept incoming requests. + { + containerPort: 8000, + }, + // Port 8081 accepts callbacks from the individual Jupyter pods. + { + containerPort: 8081, + }, + ], + env: [ + { + name: "NOTEBOOK_PVC_MOUNT", + value: notebookPVCMount, + }, + { + name: "CLOUD_NAME", + value: cloud, + }, + ], + }, // jupyterHub container + ], + serviceAccountName: "jupyter-hub", + volumes: [ + { + configMap: { + name: "jupyterhub-config", + }, + name: "config-volume", + }, + ], + }, + }, + updateStrategy: { + type: "RollingUpdate", + }, + }, + }, + + jupyterHubRole: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "Role", + metadata: { + name: "jupyter-role", + namespace: namespace, + }, + rules: [ + { + apiGroups: [ + "*", + ], + // TODO(jlewi): This is very permissive so we may want to lock this down. + resources: [ + "*", + ], + verbs: [ + "*", + ], + }, + ], + }, + + jupyterHubServiceAccount: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "jupyter-hub", + }, + name: "jupyter-hub", + namespace: namespace, + }, + }, + + jupyterHubRoleBinding: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "RoleBinding", + metadata: { + name: "jupyter-role", + namespace: namespace, + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "Role", + name: "jupyter-role", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "jupyter-hub", + namespace: namespace, + }, + ], + }, + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/kubeform_spawner.py b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/kubeform_spawner.py new file mode 100644 index 000000000..fb7efcf20 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/kubeform_spawner.py @@ -0,0 +1,156 @@ +#pylint: skip-file +import json +import os +from kubespawner.spawner import KubeSpawner +from jhub_remote_user_authenticator.remote_user_auth import RemoteUserAuthenticator +from oauthenticator.github import GitHubOAuthenticator + + +class KubeFormSpawner(KubeSpawner): + + # relies on HTML5 for image datalist + def _options_form_default(self): + return ''' +       + + + +

+ +       + +

+ +       + +

+ +       + +

+ ''' + + def options_from_form(self, formdata): + options = {} + options['image'] = formdata.get('image', [''])[0].strip() + options['cpu_guarantee'] = formdata.get( + 'cpu_guarantee', [''])[0].strip() + options['mem_guarantee'] = formdata.get( + 'mem_guarantee', [''])[0].strip() + options['extra_resource_limits'] = formdata.get( + 'extra_resource_limits', [''])[0].strip() + return options + + @property + def singleuser_image_spec(self): + image = 'gcr.io/kubeflow/tensorflow-notebook-cpu' + if self.user_options.get('image'): + image = self.user_options['image'] + return image + + @property + def cpu_guarantee(self): + cpu = '500m' + if self.user_options.get('cpu_guarantee'): + cpu = self.user_options['cpu_guarantee'] + return cpu + + @property + def mem_guarantee(self): + mem = '1Gi' + if self.user_options.get('mem_guarantee'): + mem = self.user_options['mem_guarantee'] + return mem + + @property + def extra_resource_limits(self): + extra = '' + if self.user_options.get('extra_resource_limits'): + extra = json.loads(self.user_options['extra_resource_limits']) + return extra + + +################################################### +# JupyterHub Options +################################################### +c.JupyterHub.ip = '0.0.0.0' +c.JupyterHub.hub_ip = '0.0.0.0' +# Don't try to cleanup servers on exit - since in general for k8s, we want +# the hub to be able to restart without losing user containers +c.JupyterHub.cleanup_servers = False +################################################### + +################################################### +# Spawner Options +################################################### +c.JupyterHub.spawner_class = KubeFormSpawner +c.KubeSpawner.singleuser_image_spec = 'gcr.io/kubeflow/tensorflow-notebook' +c.KubeSpawner.cmd = 'start-singleuser.sh' +c.KubeSpawner.args = ['--allow-root'] +# gpu images are very large ~15GB. need a large timeout. +c.KubeSpawner.start_timeout = 60 * 30 +# Increase timeout to 5 minutes to avoid HTTP 500 errors on JupyterHub +c.KubeSpawner.http_timeout = 60 * 5 + +# Volume setup +c.KubeSpawner.singleuser_uid = 1000 +c.KubeSpawner.singleuser_fs_gid = 100 +c.KubeSpawner.singleuser_working_dir = '/home/jovyan' +volumes = [] +volume_mounts = [] +################################################### +# Persistent volume options +################################################### +# Using persistent storage requires a default storage class. +# TODO(jlewi): Verify this works on minikube. +# see https://github.com/kubeflow/kubeflow/pull/22#issuecomment-350500944 +pvc_mount = os.environ.get('NOTEBOOK_PVC_MOUNT') +if pvc_mount and pvc_mount != 'null': + c.KubeSpawner.user_storage_pvc_ensure = True + # How much disk space do we want? + c.KubeSpawner.user_storage_capacity = '10Gi' + c.KubeSpawner.pvc_name_template = 'claim-{username}{servername}' + volumes.append( + { + 'name': 'volume-{username}{servername}', + 'persistentVolumeClaim': { + 'claimName': 'claim-{username}{servername}' + } + } + ) + volume_mounts.append( + { + 'mountPath': pvc_mount, + 'name': 'volume-{username}{servername}' + } + ) + +# ################################################### +# ### Extra volumes for NVIDIA drivers (Azure) +# ################################################### +# # Temporary fix: +# # AKS / acs-engine doesn't yet use device plugin so we have to mount the drivers to use GPU +# # TODO(wbuchwalter): Remove once device plugin is merged +cloud = os.environ.get('CLOUD_NAME') +if cloud == 'aks' or cloud == 'acsengine': + volumes.append({ + 'name': 'nvidia', + 'hostPath': { + 'path': '/usr/local/nvidia' + } + }) + volume_mounts.append({ + 'name': 'nvidia', + 'mountPath': '/usr/local/nvidia' + }) + +c.KubeSpawner.volumes = volumes +c.KubeSpawner.volume_mounts = volume_mounts diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/nfs.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/nfs.libsonnet new file mode 100644 index 000000000..63e3dedb7 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/nfs.libsonnet @@ -0,0 +1,302 @@ +// A ksonnet prototype/component for using NFS. + +{ + // TODO(https://github.com/ksonnet/ksonnet/issues/222): Taking namespace as an argument is a work around for the fact that ksonnet + // doesn't support automatically piping in the namespace from the environment to prototypes. + // + // Return a list of components needed if you want to mount some disks using NFS. + // diskNames should be a list of PDs. + all(params):: { + local namespace = params.namespace, + local name = params.name, + local disks = params.disks, + + // Create a list of the resources needed for a particular disk + local diskToList = function(diskName) [ + $.parts(namespace, name,).diskResources(diskName).storageClass, + $.parts(namespace, name,).diskResources(diskName).volumeClaim, + $.parts(namespace, name,).diskResources(diskName).service, + $.parts(namespace, name,).diskResources(diskName).provisioner, + ], + local util = import "kubeflow/core/util.libsonnet", + local allDisks = std.flattenArrays(std.map(diskToList, util.toArray(disks))), + + items:: + if std.length(allDisks) > 0 then + [ + $.parts(namespace, name).serviceAccount, + $.parts(namespace, name).role, + $.parts(namespace, name).roleBinding, + $.parts(namespace, name).clusterRoleBinding, + ] + allDisks + else + [], + + }.items, + + // Create a provisioner with the specified name. + // disks should be a list GCP persistent disk names; these disks should be in the + // same zone as your cluster. + // TODO(jlewi): + parts(namespace, name):: { + + local serviceAccountName = name, + local serviceAccountRoleName = name, + + + // Create the resources for a specific disk. + // Each NFS Provisioner can only manage 1 PD so we need to create one for each disk. + diskResources(diskName): { + + local storageClassName = diskName + "-nfs", + local provisionerName = diskName + "-provisioner", + local storageClassProvisioner = diskName + "/nfs", + local serviceName = diskName + "-service", + + volumeClaim: { + apiVersion: "v1", + kind: "PersistentVolumeClaim", + metadata: { + annotations: { + "volume.beta.kubernetes.io/storage-class": storageClassName, + }, + name: diskName, + namespace: namespace, + }, + spec: { + accessModes: [ + "ReadWriteMany", + ], + resources: { + requests: { + storage: "1Mi", + }, + }, + }, + }, + + // TODO(jlewi): Is storageClass actually name space scoped? Seems to show up in default namespace as well. + // TODO(jlewi): Could we just use the default cluster storage class? + storageClass: { + apiVersion: "storage.k8s.io/v1beta1", + kind: "StorageClass", + metadata: { + name: storageClassName, + namespace: namespace, + }, + // This value must be the same as passed as argument --provisioner to the provisioner + provisioner: storageClassProvisioner, + }, + + service: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: provisionerName, + }, + name: serviceName, + namespace: namespace, + }, + spec: { + ports: [ + { + name: "nfs", + port: 2049, + }, + { + name: "mountd", + port: 20048, + }, + { + name: "rpcbind", + port: 111, + }, + { + name: "rpcbind-udp", + port: 111, + protocol: "UDP", + }, + ], + selector: { + app: provisionerName, + }, + }, + }, + + provisioner: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: provisionerName, + namespace: namespace, + }, + spec: { + replicas: 1, + strategy: { + type: "Recreate", + }, + template: { + metadata: { + labels: { + app: provisionerName, + }, + }, + spec: { + containers: [ + { + args: [ + "-provisioner=" + storageClassProvisioner, + ], + env: [ + { + name: "POD_IP", + valueFrom: { + fieldRef: { + fieldPath: "status.podIP", + }, + }, + }, + { + name: "SERVICE_NAME", + value: serviceName, + }, + { + name: "POD_NAMESPACE", + valueFrom: { + fieldRef: { + fieldPath: "metadata.namespace", + }, + }, + }, + ], + image: "quay.io/kubernetes_incubator/nfs-provisioner:v1.0.8", + imagePullPolicy: "IfNotPresent", + name: "nfs-provisioner", + ports: [ + { + containerPort: 2049, + name: "nfs", + }, + { + containerPort: 20048, + name: "mountd", + }, + { + containerPort: 111, + name: "rpcbind", + }, + { + containerPort: 111, + name: "rpcbind-udp", + protocol: "UDP", + }, + ], + securityContext: { + capabilities: { + add: [ + "DAC_READ_SEARCH", + ], + }, + }, + volumeMounts: [{ + // Needs to be mounted under /export because /export is what is exported for NFS. + // https://github.com/kubernetes-incubator/external-storage/tree/master/nfs#quickstart + mountPath: "/export", + name: diskName, + }], + }, + ], + volumes: [{ + name: diskName, + gcePersistentDisk: { + pdName: diskName, + }, + }], + serviceAccountName: serviceAccountName, + }, + }, + }, + }, // provisioner + }, + + serviceAccount: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: name + "nfs-provisioner", + }, + name: serviceAccountName, + namespace: namespace, + }, + }, + + role: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "Role", + metadata: { + name: serviceAccountRoleName, + namespace: namespace, + }, + rules: [ + { + apiGroups: [ + "*", + ], + // TODO(jlewi): This is very permissive so we may want to lock this down. + resources: [ + "*", + ], + verbs: [ + "*", + ], + }, + ], + }, + + roleBinding: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "RoleBinding", + metadata: { + name: name + "-nfs-role", + namespace: namespace, + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "Role", + name: serviceAccountName, + }, + subjects: [ + { + kind: "ServiceAccount", + name: serviceAccountRoleName, + namespace: namespace, + }, + ], + }, + + // see https://github.com/kubernetes-incubator/external-storage/tree/master/docs#authorizing-provisioners-for-rbac-or-openshift + clusterRoleBinding: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + name: name + "-nfs-role", + namespace: namespace, + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "system:persistent-volume-provisioner", + }, + subjects: [ + { + kind: "ServiceAccount", + name: serviceAccountRoleName, + namespace: namespace, + }, + ], + }, + + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/parts.yaml b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/parts.yaml new file mode 100644 index 000000000..b2e5f7be9 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/parts.yaml @@ -0,0 +1,35 @@ +{ + "name": "core", + "apiVersion": "0.0.1", + "kind": "ksonnet.io/parts", + "description": "Core components of Kubeflow.\n", + "author": "kubeflow team ", + "contributors": [ + { + "name": "Jeremy Lewi", + "email": "jlewi@google.com" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/kubeflow/kubeflow" + }, + "bugs": { + "url": "https://github.com/kubeflow/kubeflow/issues" + }, + "keywords": [ + "kubeflow", + "tensorflow" + ], + "quickStart": { + "prototype": "io.ksonnet.pkg.kubeflow", + "componentName": "core", + "flags": { + "name": "core", + "namespace": "default", + "disks": "" + }, + "comment": "Core Kubeflow components." + }, + "license": "Apache 2.0" +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/all.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/all.jsonnet new file mode 100644 index 000000000..191f26e25 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/all.jsonnet @@ -0,0 +1,30 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.kubeflow-core +// @description Kubeflow core components +// @shortDescription Kubeflow core components. This currently includes JupyterHub and the TfJob controller. +// @param name string Name to give to each of the components +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam disks string null Comma separated list of Google persistent disks to attach to jupyter environments. +// @optionalParam cloud string null String identifying the cloud to customize the deployment for. +// @optionalParam tfAmbassadorServiceType string ClusterIP The service type for the API Gateway. +// @optionalParam tfJobImage string gcr.io/kubeflow-images-public/tf_operator:v20180522-77375baf The image for the TfJob controller. +// @optionalParam tfDefaultImage string null The default image to use for TensorFlow. +// @optionalParam tfJobUiServiceType string ClusterIP The service type for the UI. +// @optionalParam jupyterHubServiceType string ClusterIP The service type for Jupyterhub. +// @optionalParam jupyterHubImage string gcr.io/kubeflow/jupyterhub-k8s:1.0.1 The image to use for JupyterHub. +// @optionalParam jupyterHubAuthenticator string null The authenticator to use +// @optionalParam jupyterNotebookPVCMount string null Mount path for PVC. Set empty to disable PVC +// @optionalParam reportUsage string false Whether or not to report Kubeflow usage to kubeflow.org. +// @optionalParam usageId string unknown_cluster Optional id to use when reporting usage to kubeflow.org +// @optionalParam tfJobVersion string v1alpha1 which version of the TFJob operator to use + +local k = import "k.libsonnet"; +local all = import "kubeflow/core/all.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +std.prune(k.core.v1.list.new(all.parts(updatedParams).all)) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/cert-manager.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/cert-manager.jsonnet new file mode 100644 index 000000000..d019ae1e1 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/cert-manager.jsonnet @@ -0,0 +1,19 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.cert-manager +// @description Provides cert-manager prototypes for generating SSL certificates. +// @shortDescription Certificate generation on GKE. +// @param name string Name for the component +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @param acmeEmail string The Lets Encrypt account email address +// @optionalParam acmeUrl string https://acme-v01.api.letsencrypt.org/directory The ACME server URL, set to https://acme-staging.api.letsencrypt.org/directory for staging API. + +local k = import "k.libsonnet"; +local certManager = import "kubeflow/core/cert-manager.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +certManager.parts(updatedParams.namespace).certManagerParts(params.acmeEmail, params.acmeUrl) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/cloud-endpoints.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/cloud-endpoints.jsonnet new file mode 100644 index 000000000..edb627d6e --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/cloud-endpoints.jsonnet @@ -0,0 +1,19 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.cloud-endpoints +// @description Provides cloud-endpoints prototypes for creating Cloud Endpoints services and DNS records. +// @shortDescription Cloud Endpoint domain creation. +// @param name string Name for the component +// @param secretName string Name of secret containing the json service account key. +// @optionalParam secretKey string cloudep-sa.json Name of the key in the secret containing the JSON service account key. +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. + +local k = import "k.libsonnet"; +local cloudEndpoints = import "kubeflow/core/cloud-endpoints.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +cloudEndpoints.parts(updatedParams.namespace).cloudEndpointsParts(params.secretName, params.secretKey) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/iap-ingress.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/iap-ingress.jsonnet new file mode 100644 index 000000000..758e0d92c --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/iap-ingress.jsonnet @@ -0,0 +1,28 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.iap-ingress +// @description Provides ingress prototypes for setting up IAP on GKE. +// @shortDescription Ingress for IAP on GKE. +// @param name string Name for the component +// @param ipName string The name of the global ip address to use. +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam secretName string envoy-ingress-tls The name of the secret containing the SSL certificates. +// @optionalParam hostname string null The hostname associated with this ingress. Eg: mykubeflow.example.com +// @optionalParam issuer string letsencrypt-prod The cert-manager issuer name. +// @optionalParam envoyImage string gcr.io/kubeflow-images-public/envoy:v20180309-0fb4886b463698702b6a08955045731903a18738 The image for envoy. +// @optionalParam disableJwtChecking string false Disable JWT checking. +// @optionalParam oauthSecretName string kubeflow-oauth The name of the secret containing the OAuth CLIENT_ID and CLIENT_SECRET. + +local k = import "k.libsonnet"; +local iap = import "kubeflow/core/iap.libsonnet"; +local util = import "kubeflow/core/util.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +local namespace = updatedParams.namespace; +local disableJwtChecking = util.toBool(params.disableJwtChecking); + +iap.parts(namespace).ingressParts(params.secretName, params.ipName, params.hostname, params.issuer, params.envoyImage, disableJwtChecking, params.oauthSecretName) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/tensorboard.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/tensorboard.jsonnet new file mode 100644 index 000000000..9e529acf4 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/tensorboard.jsonnet @@ -0,0 +1,26 @@ +// @apiVersion 1 +// @name io.ksonnet.pkg.tensorboard +// @description Tensorboard components +// @shortDescription ksonnet components for Tensorboard +// @param name string Name to give to each of the components + +local k = import "k.libsonnet"; +local tensorboard = import "kubeflow/core/tensorboard.libsonnet"; + +local name = import "param://name"; + +// updatedParams includes the namespace from env by default. +// We can override namespace in params if needed +local updatedParams = env + params; + +local logDir = updatedParams.logDir; + +local tb = tensorboard { + params+: updatedParams { + name: name, + }, +}; + + +//std.assertEqual(true, std.length(logDir) > 0) +std.prune(k.core.v1.list.new(tb.components)) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/tf-job-operator.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/tf-job-operator.jsonnet new file mode 100644 index 000000000..7fcf56c93 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/prototypes/tf-job-operator.jsonnet @@ -0,0 +1,27 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.tf-job-operator +// @description A TensorFlow job operator CRD +// @shortDescription A TensorFlow job operator. +// @param name string Name to give to each of the components +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam cloud string null String identifying the cloud to customize the deployment for. +// @optionalParam tfAmbassadorServiceType string ClusterIP The service type for the API Gateway. +// @optionalParam tfJobImage string gcr.io/kubeflow-images-public/tf_operator:v20180522-77375baf The image for the TfJob controller. +// @optionalParam tfDefaultImage string null The default image to use for TensorFlow. +// @optionalParam tfJobUiServiceType string ClusterIP The service type for the UI. +// @optionalParam tfJobVersion string v1alpha1 which version of the TFJob operator to use + +// TODO(https://github.com/ksonnet/ksonnet/issues/235): ks param set args won't work if the arg starts with "--". + +local env = std.extVar("__ksonnet/environments"); +local params = std.extVar("__ksonnet/params").components["tf-job-operator"]; +local k = import "k.libsonnet"; +local tfjob = import "kubeflow/core/tf-job-operator.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +std.prune(k.core.v1.list.new(tfjob.all(updatedParams))) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/spartakus.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/spartakus.libsonnet new file mode 100644 index 000000000..5924beb39 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/spartakus.libsonnet @@ -0,0 +1,113 @@ +{ + local util = import "kubeflow/core/util.libsonnet", + + all(params):: { + local reportUsageBool = util.toBool(params.reportUsage), + result:: if reportUsageBool then + [ + $.parts(params.namespace).role, + $.parts(params.namespace).roleBinding, + $.parts(params.namespace).serviceAccount, + $.parts(params.namespace).deployment(params.usageId), + ] + else [], + }.result, + + parts(namespace):: { + + // Spartakus needs to be able to get information about the cluster in order to create a report. + role: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "spartakus", + }, + name: "spartakus", + }, + rules: [ + { + apiGroups: [ + "", + ], + resources: [ + "nodes", + ], + verbs: [ + "get", + "list", + ], + }, + ], + }, // role + + roleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "spartakus", + }, + name: "spartakus", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "spartakus", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "spartakus", + namespace: namespace, + }, + ], + }, // operator-role binding + + + serviceAccount: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "spartakus", + }, + name: "spartakus", + namespace: namespace, + }, + }, + + deployment(usageId):: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "spartakus-volunteer", + namespace: namespace, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "spartakus-volunteer", + }, + }, + spec: { + containers: [ + { + image: "gcr.io/google_containers/spartakus-amd64:v1.0.0", + name: "volunteer", + args: [ + "volunteer", + "--cluster-id=" + usageId, + "--database=https://stats-collector.kubeflow.org", + ], + }, + ], + serviceAccountName: "spartakus", + }, // spec + }, + }, + }, // deployment + }, +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tensorboard.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tensorboard.libsonnet new file mode 100644 index 000000000..2be40fa0c --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tensorboard.libsonnet @@ -0,0 +1,247 @@ +{ + // Parameters are intended to be late bound. + params:: { + name: null, + labels: { + app: $.params.name, + }, + + serviceType: "ClusterIP", + + logDir: "", + + defaultTbImage: "gcr.io/tensorflow/tensorflow:latest", + + + // Whether or not to enable s3 parameters + s3Enable:: false, + + // Which cloud to use + cloud:: null, + }, + + // Parametes specific to GCP. + gcpParams:: { + gcpCredentialSecretName: "", + } + $.params, + + // Parameters that control S3 access + // params overrides s3params because params can be overwritten by the user to override the defaults. + s3params:: { + // Name of the k8s secrets containing S3 credentials + s3SecretName: "", + // Name of the key in the k8s secret containing AWS_ACCESS_KEY_ID. + s3SecretAccesskeyidKeyName: "", + + // Name of the key in the k8s secret containing AWS_SECRET_ACCESS_KEY. + s3SecretSecretaccesskeyKeyName: "", + + // S3 region + s3AwsRegion: "us-west-1", + + // TODO(jlewi): We should use util.toBool to automatically conver to actual boolean values. + // The use of strings is left over from when they were prototype parameters which only supports string type. + + // true Whether or not to use https for S3 connections + s3UseHttps: "true", + + // Whether or not to verify https certificates for S3 connections + s3VerifySsl: "true", + + // URL for your s3-compatible endpoint. + s3Endpoint: "http://s3.us-west-1.amazonaws.com,", + } + $.params, + + + components:: { + + all:: + // TODO(jlewi): It would be better to structure s3 as a mixin. + // As an example it would be great to allow S3 and GCS parameters + // to be enabled simultaneously. This should be doable because + // each entails adding a set of environment variables and volumes + // to the containers. These volumes/environment variables shouldn't + // overlap so there's no reason we shouldn't be able to just add + // both modifications to the base container. + // I think we want to restructure things as mixins so they can just + // be added. + if $.params.s3Enable then + [ + $.s3parts.tb, + $.s3parts.tfDeployment, + ] + else if $.params.cloud == "gcp" then + [ + $.gcpParts.tb, + $.gcpParts.tfDeployment, + ] + else + [ + $.parts.tb, + $.parts.tfDeployment, + ], + }.all, + + parts:: { + // We define the containers one level beneath parts because combined with jsonnet late binding + // this makes it easy for users to override specific bits of the container. + tbContainer:: { + name: $.params.name, + image: $.params.defaultTbImage, + imagePullPolicy: "IfNotPresent", + args: [ + $.params.logDir, + "--port=9000", + ], + command: [ + "/usr/local/bin/tensorboard", + ], + ports: [ + { + containerPort: 9000, + }, + ], + + resources: { + requests: { + memory: "1Gi", + cpu: "1", + }, + limits: { + memory: "4Gi", + cpu: "4", + }, + }, + }, // tbContainer + + tfDeployment: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: $.params.name, + namespace: $.params.namespace, + labels: $.params.labels, + }, + spec: { + template: { + metadata: { + labels: $.params.labels, + }, + spec: { + containers: [ + $.parts.tbContainer, + ], + + }, + }, + }, + }, // tfDeployment + + tb: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: $.params.labels, + name: $.params.name, + namespace: $.params.namespace, + annotations: { + "getambassador.io/config": + std.join("\n", [ + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: tb-mapping-" + $.params.name + "-get", + "prefix: /tensorboard/ " + $.params.name + "/", + "rewrite: /", + "method: GET", + "service: " + $.params.name + "." + $.params.namespace + ":9000", + ]), + }, //annotations + }, + spec: { + ports: [ + { + name: "tb", + port: 9000, + targetPort: 9000, + }, + ], + selector: $.params.labels, + type: $.params.serviceType, + }, + }, // tb + + }, // parts + + // Parts specific to S3 + s3parts:: $.parts { + s3Env:: [ + { name: "AWS_ACCESS_KEY_ID", valueFrom: { secretKeyRef: { name: $.s3params.s3SecretName, key: $.s3params.s3SecretAccesskeyidKeyName } } }, + { name: "AWS_SECRET_ACCESS_KEY", valueFrom: { secretKeyRef: { name: $.s3params.s3SecretName, key: $.s3params.s3SecretSecretaccesskeyKeyName } } }, + { name: "AWS_REGION", value: $.s3params.s3AwsRegion }, + { name: "S3_REGION", value: $.s3params.s3AwsRegion }, + { name: "S3_USE_HTTPS", value: $.s3params.s3UseHttps }, + { name: "S3_VERIFY_SSL", value: $.s3params.s3VerifySsl }, + { name: "S3_ENDPOINT", value: $.s3params.s3Endpoint }, + ], + + tbContainer: $.parts.tbContainer { + env+: $.s3parts.s3Env, + }, + + tfDeployment: $.parts.tfDeployment { + spec: +{ + template: +{ + + spec: +{ + containers: [ + $.s3parts.tbContainer, + ], + }, + }, + }, + }, // tfDeployment + }, // s3parts + + // Parts specific to GCP + gcpParts:: $.parts { + gcpEnv:: [ + if $.gcpParams.gcpCredentialSecretName != "" then + { name: "GOOGLE_APPLICATION_CREDENTIALS", value: "/secret/gcp-credentials/key.json" }, + ], + + tbContainer: $.parts.tbContainer { + env+: $.gcpParts.gcpEnv, + volumeMounts+: [ + if $.gcpParams.gcpCredentialSecretName != "" then + { + name: "gcp-credentials", + mountPath: "/secret/gcp-credentials", + }, + ], + }, + + tfDeployment: $.parts.tfDeployment { + spec+: { + template+: { + + spec+: { + containers: [ + $.gcpParts.tbContainer, + ], + + volumes: [ + if $.gcpParams.gcpCredentialSecretName != "" then + { + name: "gcp-credentials", + secret: { + secretName: $.gcpParams.gcpCredentialSecretName, + }, + }, + ], + }, + }, + }, + }, // tfDeployment + }, // gcpParts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/ambassador_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/ambassador_test.jsonnet new file mode 100644 index 000000000..5c89a98ae --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/ambassador_test.jsonnet @@ -0,0 +1,257 @@ +local ambassador = import "../ambassador.libsonnet"; +local params = { + namespace:: "test-kf-001", + tfAmbassadorServiceType:: "ClusterIP", +}; + +std.assertEqual( + ambassador.parts(params.namespace).service(params.tfAmbassadorServiceType), + { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + service: "ambassador", + }, + name: "ambassador", + namespace: "test-kf-001", + }, + spec: { + ports: [ + { + name: "ambassador", + port: 80, + targetPort: 80, + }, + ], + selector: { + service: "ambassador", + }, + type: "ClusterIP", + }, + } +) && + +std.assertEqual( + ambassador.parts(params.namespace).adminService, + { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + service: "ambassador-admin", + }, + name: "ambassador-admin", + namespace: "test-kf-001", + }, + spec: { + ports: [ + { + name: "ambassador-admin", + port: 8877, + targetPort: 8877, + }, + ], + selector: { + service: "ambassador", + }, + type: "ClusterIP", + }, + } +) && + +std.assertEqual( + ambassador.parts(params.namespace).role, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "Role", + metadata: { + name: "ambassador", + namespace: "test-kf-001", + }, + rules: [ + { + apiGroups: [ + "", + ], + resources: [ + "services", + ], + verbs: [ + "get", + "list", + "watch", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "configmaps", + ], + verbs: [ + "create", + "update", + "patch", + "get", + "list", + "watch", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "secrets", + ], + verbs: [ + "get", + "list", + "watch", + ], + }, + ], + } +) && + +std.assertEqual( + ambassador.parts(params.namespace).serviceAccount, + { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "ambassador", + namespace: "test-kf-001", + }, + } +) && + +std.assertEqual( + ambassador.parts(params.namespace).roleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "RoleBinding", + metadata: { + name: "ambassador", + namespace: "test-kf-001", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "Role", + name: "ambassador", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "ambassador", + namespace: "test-kf-001", + }, + ], + } +) && + +std.assertEqual( + ambassador.parts(params.namespace).deploy, + { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "ambassador", + namespace: "test-kf-001", + }, + spec: { + replicas: 3, + template: { + metadata: { + labels: { + service: "ambassador", + }, + namespace: "test-kf-001", + }, + spec: { + containers: [ + { + env: [ + { + name: "AMBASSADOR_NAMESPACE", + valueFrom: { + fieldRef: { + fieldPath: "metadata.namespace", + }, + }, + }, + { + name: "AMBASSADOR_SINGLE_NAMESPACE", + value: "true", + }, + ], + image: "quay.io/datawire/ambassador:0.30.1", + livenessProbe: { + httpGet: { + path: "/ambassador/v0/check_alive", + port: 8877, + }, + initialDelaySeconds: 30, + periodSeconds: 30, + }, + name: "ambassador", + readinessProbe: { + httpGet: { + path: "/ambassador/v0/check_ready", + port: 8877, + }, + initialDelaySeconds: 30, + periodSeconds: 30, + }, + resources: { + limits: { + cpu: 1, + memory: "400Mi", + }, + requests: { + cpu: "200m", + memory: "100Mi", + }, + }, + }, + { + image: "quay.io/datawire/statsd:0.30.1", + name: "statsd", + }, + ], + restartPolicy: "Always", + serviceAccountName: "ambassador", + }, + }, + }, + } +) && + +std.assertEqual( + ambassador.parts(params.namespace).k8sDashboard("cloud"), + { + apiVersion: "v1", + kind: "Service", + metadata: { + annotations: { + "getambassador.io/config": "---\napiVersion: ambassador/v0\nkind: Mapping\nname: k8s-dashboard-ui-mapping\nprefix: /k8s/ui/\nrewrite: /\ntls: true\nservice: kubernetes-dashboard.kube-system", + }, + name: "k8s-dashboard", + namespace: "test-kf-001", + }, + spec: { + ports: [ + { + port: 443, + targetPort: 8443, + }, + ], + selector: { + "k8s-app": "kubernetes-dashboard", + }, + type: "ClusterIP", + }, + } +) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/centraldashboard_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/centraldashboard_test.jsonnet new file mode 100644 index 000000000..ea02cebe5 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/centraldashboard_test.jsonnet @@ -0,0 +1,161 @@ +local centraldashboard = import "../centraldashboard.libsonnet"; +local params = { + namespace:: "kubeflow", + cloud:: "gke", +}; + +std.assertEqual( + centraldashboard.parts(params.namespace).deployUi, + { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: "kubeflow", + }, + spec: { + template: { + metadata: { + labels: { + app: "centraldashboard", + }, + }, + spec: { + containers: [ + { + image: "swiftdiaries/centraldashboard:0.3", + name: "centraldashboard", + ports: [ + { + containerPort: 8082, + }, + ], + }, + ], + serviceAccountName: "centraldashboard", + }, + }, + }, + } +) && + +std.assertEqual( + centraldashboard.parts(params.namespace).uiService, + { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: "kubeflow", + annotations: { + "getambassador.io/config": + std.join("\n", [ + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: centralui-mapping", + "prefix: /", + "rewrite: /", + "service: centraldashboard." + "kubeflow", + ]), + }, + }, + spec: { + ports: [ + { + port: 80, + targetPort: 8082, + }, + ], + selector: { + app: "centraldashboard", + }, + sessionAffinity: "None", + type: "ClusterIP", + }, + }, +) && + +std.assertEqual( + centraldashboard.parts(params.namespace).uiServiceAccount, + { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + name: "centraldashboard", + namespace: "kubeflow", + }, + }, +) && + +std.assertEqual( + centraldashboard.parts(params.namespace).uiRole, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: "kubeflow", + }, + rules: [ + { + apiGroups: [""], + resources: [ + "pods", + "pods/exec", + "pods/log", + ], + verbs: [ + "get", + "list", + "watch", + ], + }, + { + apiGroups: [""], + resources: [ + "secrets", + ], + verbs: [ + "get", + ], + }, + ], + }, +) && + +std.assertEqual( + centraldashboard.parts(params.namespace).uiRoleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "centraldashboard", + }, + name: "centraldashboard", + namespace: "kubeflow", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "centraldashboard", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "centraldashboard", + namespace: "kubeflow", + }, + ], + } +) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/iap_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/iap_test.jsonnet new file mode 100644 index 000000000..bf5015d5a --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/iap_test.jsonnet @@ -0,0 +1,203 @@ +local iap = import "../iap.libsonnet"; + +std.assertEqual(iap.parts("namespace").service, { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + service: "envoy", + }, + name: "envoy", + namespace: "namespace", + }, + spec: { + ports: [ + { + name: "envoy", + port: 8080, + targetPort: 8080, + }, + ], + selector: { + service: "envoy", + }, + type: "NodePort", + }, +}) && + +std.assertEqual(iap.parts("namespace").ingress("secretName", "ipName", "hostname"), { + apiVersion: "extensions/v1beta1", + kind: "Ingress", + metadata: { + name: "envoy-ingress", + namespace: "namespace", + annotations: { + "kubernetes.io/tls-acme": "true", + "ingress.kubernetes.io/ssl-redirect": "true", + "kubernetes.io/ingress.global-static-ip-name": "ipName", + }, + }, + spec: { + rules: [ + { + host: "hostname", + http: { + paths: [ + { + backend: { + serviceName: "envoy", + servicePort: 8080, + }, + path: "/*", + }, + ], + }, + }, + ], + tls: [ + { + secretName: "secretName", + }, + ], + }, +}) && + +std.assertEqual(iap.parts("namespace").ingress("secretName", "ipName", "null"), { + apiVersion: "extensions/v1beta1", + kind: "Ingress", + metadata: { + name: "envoy-ingress", + namespace: "namespace", + annotations: { + "kubernetes.io/tls-acme": "true", + "ingress.kubernetes.io/ssl-redirect": "true", + "kubernetes.io/ingress.global-static-ip-name": "ipName", + }, + }, + spec: { + rules: [ + { + http: { + paths: [ + { + backend: { + serviceName: "envoy", + servicePort: 8080, + }, + path: "/*", + }, + ], + }, + }, + ], + tls: [ + { + secretName: "secretName", + }, + ], + }, +}) && + +std.assertEqual(iap.parts("namespace").certificate("secretName", "hostname", "issuer"), { + apiVersion: "certmanager.k8s.io/v1alpha1", + kind: "Certificate", + metadata: { + name: "secretName", + namespace: "namespace", + }, + spec: { + secretName: "secretName", + issuerRef: { + name: "issuer", + }, + commonName: "hostname", + dnsNames: [ + "hostname", + ], + acme: { + config: [ + { + http01: { + ingress: "envoy-ingress", + }, + domains: [ + "hostname", + ], + }, + ], + }, + }, +}) && + +std.assertEqual(iap.parts("namespace").whoamiApp, { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "whoami-app", + namespace: "namespace", + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "whoami", + }, + }, + spec: { + containers: [ + { + env: [ + { + name: "PORT", + value: "8081", + }, + ], + image: "gcr.io/cloud-solutions-group/esp-sample-app:1.0.0", + name: "app", + ports: [ + { + containerPort: 8081, + }, + ], + readinessProbe: { + failureThreshold: 2, + httpGet: { + path: "/healthz", + port: 8081, + scheme: "HTTP", + }, + periodSeconds: 10, + successThreshold: 1, + timeoutSeconds: 5, + }, + }, + ], + }, + }, + }, +}) && + +std.assertEqual(iap.parts("namespace").whoamiService, { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "whoami", + }, + name: "whoami-app", + namespace: "namespace", + }, + spec: { + ports: [ + { + port: 80, + targetPort: 8081, + }, + ], + selector: { + app: "whoami", + }, + type: "ClusterIP", + }, +}) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/jupyterhub_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/jupyterhub_test.jsonnet new file mode 100644 index 000000000..dcc1e8b00 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/jupyterhub_test.jsonnet @@ -0,0 +1,236 @@ +local jupyterhub = import "../jupyterhub.libsonnet"; +local params = { + namespace:: "test-kf-001", + disks:: "disk01,disk02", + jupyterHubAuthenticator:: null, + jupyterHubServiceType:: "ClusterIP", + jupyterHubImage: "gcr.io/kubeflow/jupyterhub-k8s:1.0.1", + jupyterNotebookPVCMount: "/home/jovyan", + cloud: null, +}; + +local baseSpawner = importstr "../kubeform_spawner.py"; + +// TODO(jlewi): We should be able to use std.startsWidth in later versions of jsonnet. +// +local config = jupyterhub.parts(params.namespace).jupyterHubConfigMap(params.jupyterHubAuthenticator, params.disks).data["jupyterhub_config.py"]; +local configPrefix = std.substr(config, 0, std.length(baseSpawner)); +local configSuffix = std.substr(config, std.length(baseSpawner), std.length(config) - std.length(baseSpawner)); +local configSuffixLines = std.split(configSuffix, "\n"); + +// This assertion varies the config map is the same after zeroing the actual data. +// The data will be compared in subsequent steps. +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHubConfigMap(params.jupyterHubAuthenticator, params.disks) + { + data: { + "jupyterhub_config.py": "", + }, +} + , { + apiVersion: "v1", + data: { + "jupyterhub_config.py": "", + }, + kind: "ConfigMap", + metadata: { + name: "jupyterhub-config", + namespace: "test-kf-001", + }, +}) && + +// This step verifies that the start of the spawner config is the raw file. +std.assertEqual(configPrefix, baseSpawner) + +&& + +// These step verifies the suffix. +// Verifying each line makes it much easier to debug test failures because if you just compare to a big blob +// of text its much harder to know where they differ. +std.assertEqual(configSuffixLines[1], "######## Authenticator ######") +&& +std.assertEqual(configSuffixLines[2], "c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'") +&& +std.assertEqual(configSuffixLines[3], "###### Volumes #######") +&& +std.assertEqual(configSuffixLines[4], 'c.KubeSpawner.volumes = [{"name": "disk01", "persistentVolumeClaim": {"claimName": "disk01"}}, {"name": "disk02", "persistentVolumeClaim": {"claimName": "disk02"}}]') +&& +std.assertEqual(configSuffixLines[5], 'c.KubeSpawner.volume_mounts = [{"mountPath": "/mnt/disk01", "name": "disk01"}, {"mountPath": "/mnt/disk02", "name": "disk02"}]') +&& + +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHubService, + { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "tf-hub", + }, + name: "tf-hub-0", + namespace: "test-kf-001", + }, + spec: { + clusterIP: "None", + ports: [ + { + name: "hub", + port: 8000, + }, + ], + selector: { + app: "tf-hub", + }, + }, + }) && + +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHubLoadBalancer(params.jupyterHubServiceType), + { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: { + app: "tf-hub-lb", + }, + name: "tf-hub-lb", + namespace: "test-kf-001", + }, + spec: { + ports: [ + { + name: "hub", + port: 80, + targetPort: 8000, + }, + ], + selector: { + app: "tf-hub", + }, + type: "ClusterIP", + }, + }) && + +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHub(params.jupyterHubImage, params.jupyterNotebookPVCMount, params.cloud), + { + apiVersion: "apps/v1beta1", + kind: "StatefulSet", + metadata: { + name: "tf-hub", + namespace: "test-kf-001", + }, + spec: { + replicas: 1, + serviceName: "", + template: { + metadata: { + labels: { + app: "tf-hub", + }, + }, + spec: { + containers: [ + { + command: [ + "jupyterhub", + "-f", + "/etc/config/jupyterhub_config.py", + ], + env: [ + { + name: "NOTEBOOK_PVC_MOUNT", + value: params.jupyterNotebookPVCMount, + }, + { + name: "CLOUD_NAME", + value: null, + }, + ], + image: "gcr.io/kubeflow/jupyterhub-k8s:1.0.1", + name: "tf-hub", + ports: [ + { + containerPort: 8000, + }, + { + containerPort: 8081, + }, + ], + volumeMounts: [ + { + mountPath: "/etc/config", + name: "config-volume", + }, + ], + }, + ], + serviceAccountName: "jupyter-hub", + volumes: [ + { + configMap: { + name: "jupyterhub-config", + }, + name: "config-volume", + }, + ], + }, + }, + updateStrategy: { + type: "RollingUpdate", + }, + }, + }) && + +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHubRole, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "Role", + metadata: { + name: "jupyter-role", + namespace: "test-kf-001", + }, + rules: [ + { + apiGroups: [ + "*", + ], + resources: [ + "*", + ], + verbs: [ + "*", + ], + }, + ], + }) && + +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHubServiceAccount, + { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "jupyter-hub", + }, + name: "jupyter-hub", + namespace: "test-kf-001", + }, + }) && + +std.assertEqual(jupyterhub.parts(params.namespace).jupyterHubRoleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "RoleBinding", + metadata: { + name: "jupyter-role", + namespace: "test-kf-001", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "Role", + name: "jupyter-role", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "jupyter-hub", + namespace: "test-kf-001", + }, + ], + }) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/nfs_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/nfs_test.jsonnet new file mode 100644 index 000000000..b3949fc97 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/nfs_test.jsonnet @@ -0,0 +1,93 @@ +local nfs = import "../nfs.libsonnet"; +local params = { + namespace:: "test-kf-001", + name:: "nfs", +}; + +std.assertEqual( + nfs.parts(params.namespace, params.name).serviceAccount, + { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "nfsnfs-provisioner", + }, + name: "nfs", + namespace: "test-kf-001", + }, + } +) && + +std.assertEqual( + nfs.parts(params.namespace, params.name).role, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "Role", + metadata: { + name: "nfs", + namespace: "test-kf-001", + }, + rules: [ + { + apiGroups: [ + "*", + ], + resources: [ + "*", + ], + verbs: [ + "*", + ], + }, + ], + } +) && + +std.assertEqual( + nfs.parts(params.namespace, params.name).roleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "RoleBinding", + metadata: { + name: "nfs-nfs-role", + namespace: "test-kf-001", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "Role", + name: "nfs", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "nfs", + namespace: "test-kf-001", + }, + ], + } +) && + +std.assertEqual( + nfs.parts(params.namespace, params.name).clusterRoleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + name: "nfs-nfs-role", + namespace: "test-kf-001", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "system:persistent-volume-provisioner", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "nfs", + namespace: "test-kf-001", + }, + ], + } +) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/spartakus_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/spartakus_test.jsonnet new file mode 100644 index 000000000..ceefcbed6 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/spartakus_test.jsonnet @@ -0,0 +1,110 @@ +local spartakus = import "../spartakus.libsonnet"; +local params = { + namespace:: "test-kf-001", + usageId:: "unknown_cluster", +}; + +std.assertEqual( + spartakus.parts(params.namespace).role, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "spartakus", + }, + name: "spartakus", + }, + rules: [ + { + apiGroups: [ + "", + ], + resources: [ + "nodes", + ], + verbs: [ + "get", + "list", + ], + }, + ], + } +) && + +std.assertEqual( + spartakus.parts(params.namespace).roleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "spartakus", + }, + name: "spartakus", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "spartakus", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "spartakus", + namespace: "test-kf-001", + }, + ], + } +) && + +std.assertEqual( + spartakus.parts(params.namespace).serviceAccount, + { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "spartakus", + }, + name: "spartakus", + namespace: "test-kf-001", + }, + } +) && + +std.assertEqual( + spartakus.parts(params.namespace).deployment(params.usageId), + { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "spartakus-volunteer", + namespace: "test-kf-001", + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + app: "spartakus-volunteer", + }, + }, + spec: { + containers: [ + { + args: [ + "volunteer", + "--cluster-id=unknown_cluster", + "--database=https://stats-collector.kubeflow.org", + ], + image: "gcr.io/google_containers/spartakus-amd64:v1.0.0", + name: "volunteer", + }, + ], + serviceAccountName: "spartakus", + }, + }, + }, + } +) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/tf-job_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/tf-job_test.jsonnet new file mode 100644 index 000000000..eea13d79b --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/tf-job_test.jsonnet @@ -0,0 +1,241 @@ +local tfjob = import "../tf-job-operator.libsonnet"; +local params = { + namespace:: "test-kf-001", + cloud:: "azure", + tfJobImage:: "gcr.io/kubeflow-images-public/tf_operator:v20180226-403", + tfDefaultImage:: "null", +}; + +std.assertEqual( + tfjob.parts(params.namespace).tfJobDeploy(params.tfJobImage), + { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "tf-job-operator", + namespace: "test-kf-001", + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + name: "tf-job-operator", + }, + }, + spec: { + containers: [ + { + command: [ + "/opt/mlkube/tf-operator", + "--controller-config-file=/etc/config/controller_config_file.yaml", + "--alsologtostderr", + "-v=1", + ], + env: [ + { + name: "MY_POD_NAMESPACE", + valueFrom: { + fieldRef: { + fieldPath: "metadata.namespace", + }, + }, + }, + { + name: "MY_POD_NAME", + valueFrom: { + fieldRef: { + fieldPath: "metadata.name", + }, + }, + }, + ], + image: "gcr.io/kubeflow-images-public/tf_operator:v20180226-403", + name: "tf-job-operator", + volumeMounts: [ + { + mountPath: "/etc/config", + name: "config-volume", + }, + ], + }, + ], + serviceAccountName: "tf-job-operator", + volumes: [ + { + configMap: { + name: "tf-job-operator-config", + }, + name: "config-volume", + }, + ], + }, + }, + }, + } +) && + +std.assertEqual( + tfjob.parts(params.namespace).configMap(params.cloud, params.tfDefaultImage), + { + apiVersion: "v1", + data: { + "controller_config_file.yaml": '{\n "grpcServerFilePath": "/opt/mlkube/grpc_tensorflow_server/grpc_tensorflow_server.py"\n}', + }, + kind: "ConfigMap", + metadata: { + name: "tf-job-operator-config", + namespace: "test-kf-001", + }, + } +) && + +std.assertEqual( + tfjob.parts(params.namespace).serviceAccount, + { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "tf-job-operator", + }, + name: "tf-job-operator", + namespace: "test-kf-001", + }, + } +) && + +std.assertEqual( + tfjob.parts(params.namespace).operatorRole, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "tf-job-operator", + }, + name: "tf-job-operator", + }, + rules: [ + { + apiGroups: [ + "tensorflow.org", + "kubeflow.org", + ], + resources: [ + "tfjobs", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "apiextensions.k8s.io", + ], + resources: [ + "customresourcedefinitions", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "storage.k8s.io", + ], + resources: [ + "storageclasses", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "batch", + ], + resources: [ + "jobs", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "configmaps", + "pods", + "services", + "endpoints", + "persistentvolumeclaims", + "events", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "apps", + "extensions", + ], + resources: [ + "deployments", + ], + verbs: [ + "*", + ], + }, + ], + } +) && + +std.assertEqual( + tfjob.parts(params.namespace).operatorRoleBinding, + { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "tf-job-operator", + }, + name: "tf-job-operator", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "tf-job-operator", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "tf-job-operator", + namespace: "test-kf-001", + }, + ], + } +) && + +std.assertEqual( + tfjob.parts(params.namespace).crd, + { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "tfjobs.kubeflow.org", + }, + spec: { + group: "kubeflow.org", + names: { + kind: "TFJob", + plural: "tfjobs", + singular: "tfjob", + }, + version: "v1alpha1", + }, + } +) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/util_test.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/util_test.jsonnet new file mode 100644 index 000000000..51542d2e3 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tests/util_test.jsonnet @@ -0,0 +1,22 @@ +local util = import "../util.libsonnet"; + +std.assertEqual(util.upper("True"), "TRUE") && +std.assertEqual(util.upper("TrUe"), "TRUE") && +std.assertEqual(util.upper("true"), "TRUE") && +std.assertEqual(util.upper("TRUE"), "TRUE") && +std.assertEqual(util.toBool(false), false) && +std.assertEqual(util.toBool(true), true) && +std.assertEqual(util.toBool("true"), true) && +std.assertEqual(util.toBool("True"), true) && +std.assertEqual(util.toBool("TRUE"), true) && +std.assertEqual(util.toBool("false"), false) && +std.assertEqual(util.toBool("False"), false) && +std.assertEqual(util.toBool("FALSE"), false) && +std.assertEqual(util.toBool("random string"), false) && +std.assertEqual(util.toBool(1), true) && +std.assertEqual(util.toBool(0), false) && +std.assertEqual(util.toBool(123), true) && +std.assertEqual(std.length(util.toArray("a,b,c,d")), 4) && +std.assertEqual(std.length(util.toArray(2)), 0) && +std.assertEqual(std.length(util.toArray("hello world")), 1) && +std.assertEqual(std.length(util.toArray([1, 2, 3, 4])), 0) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tf-job-operator.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tf-job-operator.libsonnet new file mode 100644 index 000000000..a10448c32 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/tf-job-operator.libsonnet @@ -0,0 +1,561 @@ +{ + all(params):: [ + + $.parts(params.namespace).configMap(params.cloud, params.tfDefaultImage), + $.parts(params.namespace).serviceAccount, + $.parts(params.namespace).operatorRole, + $.parts(params.namespace).operatorRoleBinding, + $.parts(params.namespace).uiRole, + $.parts(params.namespace).uiRoleBinding, + $.parts(params.namespace).uiService(params.tfJobUiServiceType), + $.parts(params.namespace).uiServiceAccount, + $.parts(params.namespace).ui(params.tfJobImage), + ] + + + if params.tfJobVersion == "v1alpha2" then + [ + $.parts(params.namespace).crdv1alpha2, + $.parts(params.namespace).tfJobDeployV1Alpha2(params.tfJobImage), + ] + else + [ + $.parts(params.namespace).crd, + $.parts(params.namespace).tfJobDeploy(params.tfJobImage), + ], + + parts(namespace):: { + crd: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "tfjobs.kubeflow.org", + }, + spec: { + group: "kubeflow.org", + version: "v1alpha1", + names: { + kind: "TFJob", + singular: "tfjob", + plural: "tfjobs", + }, + }, + }, + + crdv1alpha2: { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "tfjobs.kubeflow.org", + }, + spec: { + group: "kubeflow.org", + version: "v1alpha2", + names: { + kind: "TFJob", + singular: "tfjob", + plural: "tfjobs", + }, + }, + }, + + tfJobDeploy(image): { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "tf-job-operator", + namespace: namespace, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + name: "tf-job-operator", + }, + }, + spec: { + containers: [ + { + command: [ + "/opt/mlkube/tf-operator", + "--controller-config-file=/etc/config/controller_config_file.yaml", + "--alsologtostderr", + "-v=1", + ], + env: [ + { + name: "MY_POD_NAMESPACE", + valueFrom: { + fieldRef: { + fieldPath: "metadata.namespace", + }, + }, + }, + { + name: "MY_POD_NAME", + valueFrom: { + fieldRef: { + fieldPath: "metadata.name", + }, + }, + }, + ], + image: image, + name: "tf-job-operator", + volumeMounts: [ + { + mountPath: "/etc/config", + name: "config-volume", + }, + ], + }, + ], + serviceAccountName: "tf-job-operator", + volumes: [ + { + configMap: { + name: "tf-job-operator-config", + }, + name: "config-volume", + }, + ], + }, + }, + }, + }, // tfJobDeploy + + tfJobDeployV1Alpha2(image): { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "tf-job-operator-v1alpha2", + namespace: namespace, + }, + spec: { + replicas: 1, + template: { + metadata: { + labels: { + name: "tf-job-operator", + }, + }, + spec: { + containers: [ + { + command: [ + "/opt/kubeflow/tf-operator.v2", + "--alsologtostderr", + "-v=1", + ], + env: [ + { + name: "MY_POD_NAMESPACE", + valueFrom: { + fieldRef: { + fieldPath: "metadata.namespace", + }, + }, + }, + { + name: "MY_POD_NAME", + valueFrom: { + fieldRef: { + fieldPath: "metadata.name", + }, + }, + }, + ], + image: image, + name: "tf-job-operator", + volumeMounts: [ + { + mountPath: "/etc/config", + name: "config-volume", + }, + ], + }, + ], + serviceAccountName: "tf-job-operator", + volumes: [ + { + configMap: { + name: "tf-job-operator-config", + }, + name: "config-volume", + }, + ], + }, + }, + }, + }, // tfJobDeploy + + // Default value for + defaultControllerConfig(tfDefaultImage):: { + grpcServerFilePath: "/opt/mlkube/grpc_tensorflow_server/grpc_tensorflow_server.py", + } + + if tfDefaultImage != "" && tfDefaultImage != "null" then + { + tfImage: tfDefaultImage, + } + else + {}, + + aksAccelerators:: { + accelerators: { + "alpha.kubernetes.io/nvidia-gpu": { + volumes: [ + { + name: "nvidia", + mountPath: "/usr/local/nvidia", + hostPath: "/usr/local/nvidia", + }, + ], + }, + }, + }, + + acsEngineAccelerators:: { + accelerators: { + "alpha.kubernetes.io/nvidia-gpu": { + volumes: [ + { + name: "nvidia", + mountPath: "/usr/local/nvidia", + hostPath: "/usr/local/nvidia", + }, + ], + }, + }, + }, + + configData(cloud, tfDefaultImage):: self.defaultControllerConfig(tfDefaultImage) + + if cloud == "aks" then + self.aksAccelerators + else if cloud == "acsengine" then + self.acsEngineAccelerators + else + {}, + + configMap(cloud, tfDefaultImage): { + apiVersion: "v1", + data: { + "controller_config_file.yaml": std.manifestJson($.parts(namespace).configData(cloud, tfDefaultImage)), + }, + kind: "ConfigMap", + metadata: { + name: "tf-job-operator-config", + namespace: namespace, + }, + }, + + serviceAccount: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "tf-job-operator", + }, + name: "tf-job-operator", + namespace: namespace, + }, + }, + + operatorRole: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "tf-job-operator", + }, + name: "tf-job-operator", + }, + rules: [ + { + apiGroups: [ + "tensorflow.org", + "kubeflow.org", + ], + resources: [ + "tfjobs", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "apiextensions.k8s.io", + ], + resources: [ + "customresourcedefinitions", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "storage.k8s.io", + ], + resources: [ + "storageclasses", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "batch", + ], + resources: [ + "jobs", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "configmaps", + "pods", + "services", + "endpoints", + "persistentvolumeclaims", + "events", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "apps", + "extensions", + ], + resources: [ + "deployments", + ], + verbs: [ + "*", + ], + }, + ], + }, // operator-role + + operatorRoleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "tf-job-operator", + }, + name: "tf-job-operator", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "tf-job-operator", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "tf-job-operator", + namespace: namespace, + }, + ], + }, // operator-role binding + + uiService(serviceType):: { + apiVersion: "v1", + kind: "Service", + metadata: { + name: "tf-job-dashboard", + namespace: namespace, + annotations: { + "getambassador.io/config": + std.join("\n", [ + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: tfjobs-ui-mapping", + "prefix: /tfjobs/", + "rewrite: /tfjobs/", + "service: tf-job-dashboard." + namespace, + ]), + }, //annotations + }, + spec: { + ports: [ + { + port: 80, + targetPort: 8080, + }, + ], + selector: { + name: "tf-job-dashboard", + }, + type: serviceType, + }, + }, // uiService + + uiServiceAccount: { + apiVersion: "v1", + kind: "ServiceAccount", + metadata: { + labels: { + app: "tf-job-dashboard", + }, + name: "tf-job-dashboard", + namespace: namespace, + }, + }, // uiServiceAccount + + ui(image):: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: "tf-job-dashboard", + namespace: namespace, + }, + spec: { + template: { + metadata: { + labels: { + name: "tf-job-dashboard", + }, + }, + spec: { + containers: [ + { + command: [ + "/opt/tensorflow_k8s/dashboard/backend", + ], + image: image, + name: "tf-job-dashboard", + ports: [ + { + containerPort: 8080, + }, + ], + }, + ], + serviceAccountName: "tf-job-dashboard", + }, + }, + }, + }, // ui + + uiRole:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRole", + metadata: { + labels: { + app: "tf-job-dashboard", + }, + name: "tf-job-dashboard", + }, + rules: [ + { + apiGroups: [ + "tensorflow.org", + "kubeflow.org", + ], + resources: [ + "tfjobs", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "apiextensions.k8s.io", + ], + resources: [ + "customresourcedefinitions", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "storage.k8s.io", + ], + resources: [ + "storageclasses", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "batch", + ], + resources: [ + "jobs", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "", + ], + resources: [ + "configmaps", + "pods", + "services", + "endpoints", + "persistentvolumeclaims", + "events", + ], + verbs: [ + "*", + ], + }, + { + apiGroups: [ + "apps", + "extensions", + ], + resources: [ + "deployments", + ], + verbs: [ + "*", + ], + }, + ], + }, // uiRole + + uiRoleBinding:: { + apiVersion: "rbac.authorization.k8s.io/v1beta1", + kind: "ClusterRoleBinding", + metadata: { + labels: { + app: "tf-job-dashboard", + }, + name: "tf-job-dashboard", + }, + roleRef: { + apiGroup: "rbac.authorization.k8s.io", + kind: "ClusterRole", + name: "tf-job-dashboard", + }, + subjects: [ + { + kind: "ServiceAccount", + name: "tf-job-dashboard", + namespace: namespace, + }, + ], + }, // uiRoleBinding + }, +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/util.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/util.libsonnet new file mode 100644 index 000000000..ddbee40ce --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/util.libsonnet @@ -0,0 +1,35 @@ +// Some useful routines. +{ + // Convert a string to upper case. + upper:: function(x) { + local cp(c) = std.codepoint(c), + local upLetter(c) = if cp(c) >= 97 && cp(c) < 123 then + std.char(cp(c) - 32) + else c, + result:: std.join("", std.map(upLetter, std.stringChars(x))), + }.result, + + // Convert non-boolean types like string,number to a boolean. + // This is primarily intended for dealing with parameters that should be booleans. + toBool:: function(x) { + result:: + if std.type(x) == "boolean" then + x + else if std.type(x) == "string" then + $.upper(x) == "TRUE" + else if std.type(x) == "number" then + x != 0 + else + false, + }.result, + + // Convert a comma-delimited string to an Array + toArray:: function(str) { + result:: + if std.type(str) == "string" && str != "null" && std.length(str) > 0 then + std.split(str, ",") + else [], + }.result, + + +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/version-info.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/version-info.json new file mode 100644 index 000000000..a55948fff --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/version-info.json @@ -0,0 +1,8 @@ +{ + "Major": "0", + "Minor": "2", + "Patch": "devel", + "GitCommit": "", + "BuildDate": "", + "ksonnetVersion": "0.9.2", +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/core/version.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/version.libsonnet new file mode 100644 index 000000000..7b3eb21ba --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/core/version.libsonnet @@ -0,0 +1,15 @@ +{ + all(params):: [ + { + apiVersion: "v1", + kind: "ConfigMap", + metadata: { + name: "kubeflow-version", + namespace: params.namespace, + }, + data: { + "kubeflow-version": importstr "version-info.json", + }, + }, + ], +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/core.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/core.libsonnet new file mode 100644 index 000000000..1af198263 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/core.libsonnet @@ -0,0 +1,96 @@ +local k = import "k.libsonnet"; +local deployment = k.extensions.v1beta1.deployment; +local container = k.apps.v1beta1.deployment.mixin.spec.template.spec.containersType; +local service = k.core.v1.service.mixin; +local serviceAccountMixin = k.core.v1.serviceAccount.mixin; +local clusterRoleBindingMixin = k.rbac.v1beta1.clusterRoleBinding.mixin; +local clusterRoleBinding = k.rbac.v1beta1.clusterRoleBinding; +local serviceAccount = k.core.v1.serviceAccount; +local baseApife = import "json/apife-deployment.json"; +local apifeService = import "json/apife-service.json"; +local operatorDeployment = import "json/operator-deployment.json"; +local redisDeployment = import "json/redis-deployment.json"; +local redisService = import "json/redis-service.json"; +local rbacServiceAccount = import "json/rbac-service-account.json"; +local rbacClusterRoleBinding = import "json/rbac-cluster-binding.json"; +local crdDefn = import "crd.libsonnet"; + +{ + parts(namespace):: { + + apife(apifeImage, withRbac):: + + local c = baseApife.spec.template.spec.containers[0] + + container.withImage(apifeImage) + + container.withImagePullPolicy("IfNotPresent"); + + local apiFeBase = + baseApife + + deployment.mixin.metadata.withNamespace(namespace) + + deployment.mixin.spec.template.spec.withContainers([c]); + + if withRbac == "true" then + apiFeBase + + deployment.mixin.spec.template.spec.withServiceAccountName("seldon") + else + apiFeBase, + + + apifeService(serviceType):: + + apifeService + + service.metadata.withNamespace(namespace) + + service.spec.withType(serviceType), + + deploymentOperator(engineImage, clusterManagerImage, springOpts, javaOpts, withRbac): + local env = [ + { name: "JAVA_OPTS", value: javaOpts }, + { name: "SPRING_OPTS", value: springOpts }, + { name: "ENGINE_CONTAINER_IMAGE_AND_VERSION", value: engineImage }, + ]; + + local c = operatorDeployment.spec.template.spec.containers[0] + + container.withImage(clusterManagerImage) + + container.withEnvMixin(env) + + container.withImagePullPolicy("IfNotPresent"); + + local depOp = operatorDeployment + + deployment.mixin.metadata.withNamespace(namespace) + + deployment.mixin.spec.template.spec.withContainers([c]); + + if withRbac == "true" then + depOp + + deployment.mixin.spec.template.spec.withServiceAccountName("seldon") + else + depOp, + + redisDeployment(): + + redisDeployment + + deployment.mixin.metadata.withNamespace(namespace), + + redisService(): + + redisService + + service.metadata.withNamespace(namespace), + + rbacServiceAccount(): + + rbacServiceAccount + + serviceAccountMixin.metadata.withNamespace(namespace), + + rbacClusterRoleBinding(): + + local subject = rbacClusterRoleBinding.subjects[0] + { namespace: namespace }; + + rbacClusterRoleBinding + + clusterRoleBindingMixin.metadata.withNamespace(namespace) + + clusterRoleBinding.withSubjects([subject]), + + crd(): + + crdDefn.crd(), + + }, // parts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/crd.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/crd.libsonnet new file mode 100644 index 000000000..9072cdaa2 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/crd.libsonnet @@ -0,0 +1,254 @@ +local podTemplateValidation = import "json/pod-template-spec-validation.json"; +local k = import "k.libsonnet"; + +{ + crd():: + { + apiVersion: "apiextensions.k8s.io/v1beta1", + kind: "CustomResourceDefinition", + metadata: { + name: "seldondeployments.machinelearning.seldon.io", + }, + spec: { + group: "machinelearning.seldon.io", + names: { + kind: "SeldonDeployment", + plural: "seldondeployments", + shortNames: [ + "sdep", + ], + singular: "seldondeployment", + }, + scope: "Namespaced", + validation: { + openAPIV3Schema: { + properties: { + spec: { + properties: { + annotations: { + description: "The annotations to be updated to a deployment", + type: "object", + }, + name: { + type: "string", + }, + oauth_key: { + type: "string", + }, + oauth_secret: { + type: "string", + }, + predictors: { + description: "List of predictors belonging to the deployment", + items: { + properties: { + annotations: { + description: "The annotations to be updated to a predictor", + type: "object", + }, + graph: { + properties: { + children: { + items: { + properties: { + children: { + items: { + properties: { + children: { + items: {}, + type: "array", + }, + endpoint: { + properties: { + service_host: { + type: "string", + }, + service_port: { + type: "integer", + }, + type: { + enum: [ + "REST", + "GRPC", + ], + type: "string", + }, + }, + }, + name: { + type: "string", + }, + implementation: { + enum: [ + "UNKNOWN_IMPLEMENTATION", + "SIMPLE_MODEL", + "SIMPLE_ROUTER", + "RANDOM_ABTEST", + "AVERAGE_COMBINER", + ], + type: "string", + }, + type: { + enum: [ + "UNKNOWN_TYPE", + "ROUTER", + "COMBINER", + "MODEL", + "TRANSFORMER", + "OUTPUT_TRANSFORMER", + ], + type: "string", + }, + methods: { + type: "array", + items: { + enum: [ + "TRANSFORM_INPUT", + "TRANSFORM_OUTPUT", + "ROUTE", + "AGGREGATE", + "SEND_FEEDBACK", + ], + type: "string", + }, + }, + }, + }, + type: "array", + }, + endpoint: { + properties: { + service_host: { + type: "string", + }, + service_port: { + type: "integer", + }, + type: { + enum: [ + "REST", + "GRPC", + ], + type: "string", + }, + }, + }, + name: { + type: "string", + }, + implementation: { + enum: [ + "UNKNOWN_IMPLEMENTATION", + "SIMPLE_MODEL", + "SIMPLE_ROUTER", + "RANDOM_ABTEST", + "AVERAGE_COMBINER", + ], + type: "string", + }, + type: { + enum: [ + "UNKNOWN_TYPE", + "ROUTER", + "COMBINER", + "MODEL", + "TRANSFORMER", + "OUTPUT_TRANSFORMER", + ], + type: "string", + }, + methods: { + type: "array", + items: { + enum: [ + "TRANSFORM_INPUT", + "TRANSFORM_OUTPUT", + "ROUTE", + "AGGREGATE", + "SEND_FEEDBACK", + ], + type: "string", + }, + }, + }, + }, + type: "array", + }, + endpoint: { + properties: { + service_host: { + type: "string", + }, + service_port: { + type: "integer", + }, + type: { + enum: [ + "REST", + "GRPC", + ], + type: "string", + }, + }, + }, + name: { + type: "string", + }, + implementation: { + enum: [ + "UNKNOWN_IMPLEMENTATION", + "SIMPLE_MODEL", + "SIMPLE_ROUTER", + "RANDOM_ABTEST", + "AVERAGE_COMBINER", + ], + type: "string", + }, + type: { + enum: [ + "UNKNOWN_TYPE", + "ROUTER", + "COMBINER", + "MODEL", + "TRANSFORMER", + "OUTPUT_TRANSFORMER", + ], + type: "string", + }, + methods: { + type: "array", + items: { + enum: [ + "TRANSFORM_INPUT", + "TRANSFORM_OUTPUT", + "ROUTE", + "AGGREGATE", + "SEND_FEEDBACK", + ], + type: "string", + }, + }, + }, + }, + name: { + type: "string", + }, + replicas: { + type: "integer", + }, + }, + }, + type: "array", + }, + componentSpec: podTemplateValidation, + + }, + }, + }, + }, + }, + version: "v1alpha1", + }, + }, + +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/apife-deployment.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/apife-deployment.json new file mode 100644 index 000000000..b0ff9cc3b --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/apife-deployment.json @@ -0,0 +1,52 @@ +{ + "apiVersion": "extensions/v1beta1", + "kind": "Deployment", + "metadata": { + "name": "seldon-apiserver" + }, + "spec": { + "replicas": 1, + "template": { + "metadata": { + "annotations": { + "prometheus.io/path": "/prometheus", + "prometheus.io/port": "8080", + "prometheus.io/scrape": "true" + }, + "labels": { + "app": "seldon-apiserver-container-app", + "version": "1" + } + }, + "spec": { + "containers": [ + { + "env": [ + { + "name": "SELDON_ENGINE_KAFKA_SERVER", + "value": "kafka:9092" + }, + { + "name": "SELDON_CLUSTER_MANAGER_REDIS_HOST", + "value": "redis" + } + ], + "image": "seldonio/apife:{{ .Values.apife.image.tag }}", + "imagePullPolicy": "{{ .Values.apife.image.pull_policy }}", + "name": "seldon-apiserver-container", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + }, + { + "containerPort": 5000, + "protocol": "TCP" + } + ] + } + ] + } + } + } +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/apife-service.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/apife-service.json new file mode 100644 index 000000000..b80139005 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/apife-service.json @@ -0,0 +1,34 @@ +{ + "apiVersion": "v1", + "kind": "Service", + "metadata": { + "labels": { + "app": "seldon-apiserver-container-app" + }, + "name": "seldon-apiserver" + }, + "spec": { + "ports": [ + { + "name": "http", + "port": 8080, + "protocol": "TCP", + "targetPort": 8080 + }, + { + "name": "grpc", + "port": 5000, + "protocol": "TCP", + "targetPort": 5000 + } + ], + "selector": { + "app": "seldon-apiserver-container-app" + }, + "sessionAffinity": "None", + "type": "{{ .Values.apife_service_type }}" + }, + "status": { + "loadBalancer": {} + } +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/operator-deployment.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/operator-deployment.json new file mode 100644 index 000000000..55b17b70f --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/operator-deployment.json @@ -0,0 +1,73 @@ +{ + "kind": "Deployment", + "apiVersion": "apps/v1beta1", + "metadata": { + "name": "seldon-cluster-manager", + "creationTimestamp": null, + "labels": { + "app": "seldon-cluster-manager-server" + } + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app": "seldon-cluster-manager-server" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app": "seldon-cluster-manager-server" + } + }, + "spec": { + "containers": [ + { + "name": "seldon-cluster-manager-container", + "image": "seldonio/cluster-manager:1234", + "ports": [ + { + "containerPort": 8080, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SELDON_CLUSTER_MANAGER_REDIS_HOST", + "value": "redis" + }, + { + "name": "SELDON_CLUSTER_MANAGER_POD_NAMESPACE", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "metadata.namespace" + } + } + } + ], + "resources": {}, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "imagePullPolicy": "IfNotPresent" + } + ], + "restartPolicy": "Always", + "terminationGracePeriodSeconds": 30, + "dnsPolicy": "ClusterFirst", + "securityContext": {}, + "schedulerName": "default-scheduler" + } + }, + "strategy": { + "type": "RollingUpdate", + "rollingUpdate": { + "maxUnavailable": 1, + "maxSurge": 1 + } + } + }, + "status": {} +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/pod-template-spec-validation.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/pod-template-spec-validation.json new file mode 100644 index 000000000..ebad4fa8d --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/pod-template-spec-validation.json @@ -0,0 +1,3336 @@ +{ + "description": "PodTemplateSpec describes the data a pod should have when created from a template", + "properties": { + "spec": { + "required": [ + "containers" + ], + "description": "PodSpec is a description of a pod.", + "properties": { + "dnsPolicy": { + "type": "string", + "description": "Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'. Note that 'None' policy is an alpha feature introduced in v1.9 and CustomPodDNS feature gate must be enabled to use it." + }, + "hostNetwork": { + "type": "boolean", + "description": "Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false." + }, + "restartPolicy": { + "type": "string", + "description": "Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" + }, + "automountServiceAccountToken": { + "type": "boolean", + "description": "AutomountServiceAccountToken indicates whether a service account token should be automatically mounted." + }, + "priorityClassName": { + "type": "string", + "description": "If specified, indicates the pod's priority. \"SYSTEM\" is a special keyword which indicates the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default." + }, + "securityContext": { + "description": "PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.", + "properties": { + "runAsNonRoot": { + "type": "boolean", + "description": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence." + }, + "fsGroup": { + "type": "integer", + "description": "A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.", + "format": "int64" + }, + "seLinuxOptions": { + "description": "SELinuxOptions are the labels to be applied to the container", + "properties": { + "type": { + "type": "string", + "description": "Type is a SELinux type label that applies to the container." + }, + "role": { + "type": "string", + "description": "Role is a SELinux role label that applies to the container." + }, + "user": { + "type": "string", + "description": "User is a SELinux user label that applies to the container." + }, + "level": { + "type": "string", + "description": "Level is SELinux level label that applies to the container." + } + } + }, + "supplementalGroups": { + "items": { + "type": "integer", + "format": "int64" + }, + "type": "array", + "description": "A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container." + }, + "runAsUser": { + "type": "integer", + "description": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + "format": "int64" + } + } + }, + "nodeName": { + "type": "string", + "description": "NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements." + }, + "hostAliases": { + "items": { + "description": "HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.", + "properties": { + "ip": { + "type": "string", + "description": "IP address of the host file entry." + }, + "hostnames": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Hostnames for the above IP address." + } + } + }, + "type": "array", + "description": "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "ip" + }, + "hostname": { + "type": "string", + "description": "Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value." + }, + "serviceAccount": { + "type": "string", + "description": "DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead." + }, + "nodeSelector": { + "additionalProperties": true, + "type": "object", + "description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/" + }, + "priority": { + "type": "integer", + "description": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.", + "format": "int32" + }, + "affinity": { + "description": "Affinity is a group of affinity scheduling rules.", + "properties": { + "podAffinity": { + "description": "Pod affinity is a group of inter pod affinity scheduling rules.", + "properties": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "items": { + "required": [ + "topologyKey" + ], + "description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running", + "properties": { + "labelSelector": { + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "properties": { + "matchLabels": { + "additionalProperties": true, + "type": "object", + "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed." + }, + "matchExpressions": { + "items": { + "required": [ + "key", + "operator" + ], + "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "properties": { + "operator": { + "type": "string", + "description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist." + }, + "values": { + "items": { + "type": "string" + }, + "type": "array", + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch." + }, + "key": { + "x-kubernetes-patch-merge-key": "key", + "type": "string", + "description": "key is the label key that the selector applies to.", + "x-kubernetes-patch-strategy": "merge" + } + } + }, + "type": "array", + "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed." + } + } + }, + "namespaces": { + "items": { + "type": "string" + }, + "type": "array", + "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"" + }, + "topologyKey": { + "type": "string", + "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed." + } + } + }, + "type": "array", + "description": "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied." + }, + "preferredDuringSchedulingIgnoredDuringExecution": { + "items": { + "required": [ + "weight", + "podAffinityTerm" + ], + "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", + "properties": { + "podAffinityTerm": { + "required": [ + "topologyKey" + ], + "description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running", + "properties": { + "labelSelector": { + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "properties": { + "matchLabels": { + "additionalProperties": true, + "type": "object", + "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed." + }, + "matchExpressions": { + "items": { + "required": [ + "key", + "operator" + ], + "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "properties": { + "operator": { + "type": "string", + "description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist." + }, + "values": { + "items": { + "type": "string" + }, + "type": "array", + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch." + }, + "key": { + "x-kubernetes-patch-merge-key": "key", + "type": "string", + "description": "key is the label key that the selector applies to.", + "x-kubernetes-patch-strategy": "merge" + } + } + }, + "type": "array", + "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed." + } + } + }, + "namespaces": { + "items": { + "type": "string" + }, + "type": "array", + "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"" + }, + "topologyKey": { + "type": "string", + "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed." + } + } + }, + "weight": { + "type": "integer", + "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", + "format": "int32" + } + } + }, + "type": "array", + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred." + } + } + }, + "nodeAffinity": { + "description": "Node affinity is a group of node affinity scheduling rules.", + "properties": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "required": [ + "nodeSelectorTerms" + ], + "description": "A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.", + "properties": { + "nodeSelectorTerms": { + "items": { + "required": [ + "matchExpressions" + ], + "description": "A null or empty node selector term matches no objects.", + "properties": { + "matchExpressions": { + "items": { + "required": [ + "key", + "operator" + ], + "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "properties": { + "operator": { + "type": "string", + "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt." + }, + "values": { + "items": { + "type": "string" + }, + "type": "array", + "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch." + }, + "key": { + "type": "string", + "description": "The label key that the selector applies to." + } + } + }, + "type": "array", + "description": "Required. A list of node selector requirements. The requirements are ANDed." + } + } + }, + "type": "array", + "description": "Required. A list of node selector terms. The terms are ORed." + } + } + }, + "preferredDuringSchedulingIgnoredDuringExecution": { + "items": { + "required": [ + "weight", + "preference" + ], + "description": "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).", + "properties": { + "preference": { + "required": [ + "matchExpressions" + ], + "description": "A null or empty node selector term matches no objects.", + "properties": { + "matchExpressions": { + "items": { + "required": [ + "key", + "operator" + ], + "description": "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "properties": { + "operator": { + "type": "string", + "description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt." + }, + "values": { + "items": { + "type": "string" + }, + "type": "array", + "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch." + }, + "key": { + "type": "string", + "description": "The label key that the selector applies to." + } + } + }, + "type": "array", + "description": "Required. A list of node selector requirements. The requirements are ANDed." + } + } + }, + "weight": { + "type": "integer", + "description": "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.", + "format": "int32" + } + } + }, + "type": "array", + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred." + } + } + }, + "podAntiAffinity": { + "description": "Pod anti affinity is a group of inter pod anti affinity scheduling rules.", + "properties": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "items": { + "required": [ + "topologyKey" + ], + "description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running", + "properties": { + "labelSelector": { + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "properties": { + "matchLabels": { + "additionalProperties": true, + "type": "object", + "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed." + }, + "matchExpressions": { + "items": { + "required": [ + "key", + "operator" + ], + "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "properties": { + "operator": { + "type": "string", + "description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist." + }, + "values": { + "items": { + "type": "string" + }, + "type": "array", + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch." + }, + "key": { + "x-kubernetes-patch-merge-key": "key", + "type": "string", + "description": "key is the label key that the selector applies to.", + "x-kubernetes-patch-strategy": "merge" + } + } + }, + "type": "array", + "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed." + } + } + }, + "namespaces": { + "items": { + "type": "string" + }, + "type": "array", + "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"" + }, + "topologyKey": { + "type": "string", + "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed." + } + } + }, + "type": "array", + "description": "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied." + }, + "preferredDuringSchedulingIgnoredDuringExecution": { + "items": { + "required": [ + "weight", + "podAffinityTerm" + ], + "description": "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", + "properties": { + "podAffinityTerm": { + "required": [ + "topologyKey" + ], + "description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running", + "properties": { + "labelSelector": { + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + "properties": { + "matchLabels": { + "additionalProperties": true, + "type": "object", + "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed." + }, + "matchExpressions": { + "items": { + "required": [ + "key", + "operator" + ], + "description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + "properties": { + "operator": { + "type": "string", + "description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist." + }, + "values": { + "items": { + "type": "string" + }, + "type": "array", + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch." + }, + "key": { + "x-kubernetes-patch-merge-key": "key", + "type": "string", + "description": "key is the label key that the selector applies to.", + "x-kubernetes-patch-strategy": "merge" + } + } + }, + "type": "array", + "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed." + } + } + }, + "namespaces": { + "items": { + "type": "string" + }, + "type": "array", + "description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"" + }, + "topologyKey": { + "type": "string", + "description": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed." + } + } + }, + "weight": { + "type": "integer", + "description": "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", + "format": "int32" + } + } + }, + "type": "array", + "description": "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred." + } + } + } + } + }, + "tolerations": { + "items": { + "description": "The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator .", + "properties": { + "operator": { + "type": "string", + "description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category." + }, + "value": { + "type": "string", + "description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string." + }, + "tolerationSeconds": { + "type": "integer", + "description": "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.", + "format": "int64" + }, + "effect": { + "type": "string", + "description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute." + }, + "key": { + "type": "string", + "description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys." + } + } + }, + "type": "array", + "description": "If specified, the pod's tolerations." + }, + "subdomain": { + "type": "string", + "description": "If specified, the fully qualified Pod hostname will be \"...svc.\". If not specified, the pod will not have a domainname at all." + }, + "hostPID": { + "type": "boolean", + "description": "Use the host's pid namespace. Optional: Default to false." + }, + "serviceAccountName": { + "type": "string", + "description": "ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/" + }, + "schedulerName": { + "type": "string", + "description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler." + }, + "hostIPC": { + "type": "boolean", + "description": "Use the host's ipc namespace. Optional: Default to false." + }, + "dnsConfig": { + "description": "PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.", + "properties": { + "nameservers": { + "items": { + "type": "string" + }, + "type": "array", + "description": "A list of DNS name server IP addresses. This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed." + }, + "searches": { + "items": { + "type": "string" + }, + "type": "array", + "description": "A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed." + }, + "options": { + "items": { + "description": "PodDNSConfigOption defines DNS resolver options of a pod.", + "properties": { + "name": { + "type": "string", + "description": "Required." + }, + "value": { + "type": "string" + } + } + }, + "type": "array", + "description": "A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy." + } + } + }, + "activeDeadlineSeconds": { + "type": "integer", + "description": "Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.", + "format": "int64" + }, + "terminationGracePeriodSeconds": { + "type": "integer", + "description": "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.", + "format": "int64" + }, + "containers": { + "items": { + "required": [ + "name" + ], + "description": "A single application container that you want to run within a pod.", + "properties": { + "livenessProbe": { + "description": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "timeoutSeconds": { + "type": "integer", + "description": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + }, + "initialDelaySeconds": { + "type": "integer", + "description": "Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "periodSeconds": { + "type": "integer", + "description": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + "format": "int32" + }, + "successThreshold": { + "type": "integer", + "description": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + "format": "int32" + }, + "failureThreshold": { + "type": "integer", + "description": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", + "format": "int32" + } + } + }, + "stdin": { + "type": "boolean", + "description": "Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false." + }, + "securityContext": { + "description": "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.", + "properties": { + "readOnlyRootFilesystem": { + "type": "boolean", + "description": "Whether this container has a read-only root filesystem. Default is false." + }, + "runAsUser": { + "type": "integer", + "description": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "format": "int64" + }, + "allowPrivilegeEscalation": { + "type": "boolean", + "description": "AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN" + }, + "capabilities": { + "description": "Adds and removes POSIX capabilities from running containers.", + "properties": { + "add": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Added capabilities" + }, + "drop": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Removed capabilities" + } + } + }, + "runAsNonRoot": { + "type": "boolean", + "description": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence." + }, + "seLinuxOptions": { + "description": "SELinuxOptions are the labels to be applied to the container", + "properties": { + "type": { + "type": "string", + "description": "Type is a SELinux type label that applies to the container." + }, + "role": { + "type": "string", + "description": "Role is a SELinux role label that applies to the container." + }, + "user": { + "type": "string", + "description": "User is a SELinux user label that applies to the container." + }, + "level": { + "type": "string", + "description": "Level is SELinux level label that applies to the container." + } + } + }, + "privileged": { + "type": "boolean", + "description": "Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false." + } + } + }, + "name": { + "type": "string", + "description": "Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated." + }, + "envFrom": { + "items": { + "description": "EnvFromSource represents the source of a set of ConfigMaps", + "properties": { + "prefix": { + "type": "string", + "description": "An optional identifer to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER." + }, + "configMapRef": { + "description": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the ConfigMap must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "secretRef": { + "description": "SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the Secret must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + } + } + }, + "type": "array", + "description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated." + }, + "volumeMounts": { + "items": { + "required": [ + "name", + "mountPath" + ], + "description": "VolumeMount describes a mounting of a Volume within a container.", + "properties": { + "subPath": { + "type": "string", + "description": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root)." + }, + "readOnly": { + "type": "boolean", + "description": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false." + }, + "mountPath": { + "type": "string", + "description": "Path within the container at which the volume should be mounted. Must not contain ':'." + }, + "mountPropagation": { + "type": "string", + "description": "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationHostToContainer is used. This field is alpha in 1.8 and can be reworked or removed in a future release." + }, + "name": { + "type": "string", + "description": "This must match the Name of a Volume." + } + } + }, + "type": "array", + "description": "Pod volumes to mount into the container's filesystem. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "mountPath" + }, + "image": { + "type": "string", + "description": "Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets." + }, + "args": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + }, + "stdinOnce": { + "type": "boolean", + "description": "Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false" + }, + "terminationMessagePolicy": { + "type": "string", + "description": "Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated." + }, + "ports": { + "items": { + "required": [ + "containerPort" + ], + "description": "ContainerPort represents a network port in a single container.", + "properties": { + "hostPort": { + "type": "integer", + "description": "Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.", + "format": "int32" + }, + "protocol": { + "type": "string", + "description": "Protocol for port. Must be UDP or TCP. Defaults to \"TCP\"." + }, + "containerPort": { + "type": "integer", + "description": "Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.", + "format": "int32" + }, + "name": { + "type": "string", + "description": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services." + }, + "hostIP": { + "type": "string", + "description": "What host IP to bind the external port to." + } + } + }, + "type": "array", + "description": "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "containerPort" + }, + "volumeDevices": { + "items": { + "required": [ + "name", + "devicePath" + ], + "description": "volumeDevice describes a mapping of a raw block device within a container.", + "properties": { + "devicePath": { + "type": "string", + "description": "devicePath is the path inside of the container that the device will be mapped to." + }, + "name": { + "type": "string", + "description": "name must match the name of a persistentVolumeClaim in the pod" + } + } + }, + "type": "array", + "description": "volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "devicePath" + }, + "tty": { + "type": "boolean", + "description": "Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false." + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + }, + "env": { + "items": { + "required": [ + "name" + ], + "description": "EnvVar represents an environment variable present in a Container.", + "properties": { + "valueFrom": { + "description": "EnvVarSource represents a source for the value of an EnvVar.", + "properties": { + "secretKeyRef": { + "required": [ + "key" + ], + "description": "SecretKeySelector selects a key of a Secret.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the Secret or it's key must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + }, + "key": { + "type": "string", + "description": "The key of the secret to select from. Must be a valid secret key." + } + } + }, + "fieldRef": { + "required": [ + "fieldPath" + ], + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "properties": { + "fieldPath": { + "type": "string", + "description": "Path of the field to select in the specified API version." + }, + "apiVersion": { + "type": "string", + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\"." + } + } + }, + "resourceFieldRef": { + "required": [ + "resource" + ], + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "properties": { + "containerName": { + "type": "string", + "description": "Container name: required for volumes, optional for env vars" + }, + "resource": { + "type": "string", + "description": "Required: resource to select" + }, + "divisor": { + "type": "string" + } + } + }, + "configMapKeyRef": { + "required": [ + "key" + ], + "description": "Selects a key from a ConfigMap.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the ConfigMap or it's key must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + }, + "key": { + "type": "string", + "description": "The key to select." + } + } + } + } + }, + "name": { + "type": "string", + "description": "Name of the environment variable. Must be a C_IDENTIFIER." + }, + "value": { + "type": "string", + "description": "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\"." + } + } + }, + "type": "array", + "description": "List of environment variables to set in the container. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "name" + }, + "imagePullPolicy": { + "type": "string", + "description": "Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images" + }, + "readinessProbe": { + "description": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "timeoutSeconds": { + "type": "integer", + "description": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + }, + "initialDelaySeconds": { + "type": "integer", + "description": "Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "periodSeconds": { + "type": "integer", + "description": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + "format": "int32" + }, + "successThreshold": { + "type": "integer", + "description": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + "format": "int32" + }, + "failureThreshold": { + "type": "integer", + "description": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", + "format": "int32" + } + } + }, + "terminationMessagePath": { + "type": "string", + "description": "Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated." + }, + "lifecycle": { + "description": "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.", + "properties": { + "preStop": { + "description": "Handler defines a specific action that should be taken", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + } + } + }, + "postStart": { + "description": "Handler defines a specific action that should be taken", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + } + } + } + } + }, + "resources": { + "description": "ResourceRequirements describes the compute resource requirements.", + "properties": { + "requests": { + "additionalProperties": true, + "type": "object", + "description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" + }, + "limits": { + "additionalProperties": true, + "type": "object", + "description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" + } + } + }, + "workingDir": { + "type": "string", + "description": "Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated." + } + } + }, + "type": "array", + "description": "List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "name" + }, + "volumes": { + "items": { + "required": [ + "name" + ], + "description": "Volume represents a named volume in a pod that may be accessed by any container in the pod.", + "properties": { + "portworxVolume": { + "required": [ + "volumeID" + ], + "description": "PortworxVolumeSource represents a Portworx volume resource.", + "properties": { + "readOnly": { + "type": "boolean", + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + }, + "volumeID": { + "type": "string", + "description": "VolumeID uniquely identifies a Portworx volume" + }, + "fsType": { + "type": "string", + "description": "FSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\". Implicitly inferred to be \"ext4\" if unspecified." + } + } + }, + "glusterfs": { + "required": [ + "endpoints", + "path" + ], + "description": "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.", + "properties": { + "path": { + "type": "string", + "description": "Path is the Glusterfs volume path. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod" + }, + "readOnly": { + "type": "boolean", + "description": "ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod" + }, + "endpoints": { + "type": "string", + "description": "EndpointsName is the endpoint name that details Glusterfs topology. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod" + } + } + }, + "gitRepo": { + "required": [ + "repository" + ], + "description": "Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling.", + "properties": { + "directory": { + "type": "string", + "description": "Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name." + }, + "repository": { + "type": "string", + "description": "Repository URL" + }, + "revision": { + "type": "string", + "description": "Commit hash for the specified revision." + } + } + }, + "flocker": { + "description": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.", + "properties": { + "datasetName": { + "type": "string", + "description": "Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated" + }, + "datasetUUID": { + "type": "string", + "description": "UUID of the dataset. This is unique identifier of a Flocker dataset" + } + } + }, + "storageos": { + "description": "Represents a StorageOS persistent volume resource.", + "properties": { + "volumeName": { + "type": "string", + "description": "VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace." + }, + "readOnly": { + "type": "boolean", + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + }, + "volumeNamespace": { + "type": "string", + "description": "VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created." + }, + "secretRef": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified." + } + } + }, + "iscsi": { + "required": [ + "targetPortal", + "iqn", + "lun" + ], + "description": "Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.", + "properties": { + "targetPortal": { + "type": "string", + "description": "iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260)." + }, + "portals": { + "items": { + "type": "string" + }, + "type": "array", + "description": "iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260)." + }, + "secretRef": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "fsType": { + "type": "string", + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi" + }, + "readOnly": { + "type": "boolean", + "description": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false." + }, + "chapAuthSession": { + "type": "boolean", + "description": "whether support iSCSI Session CHAP authentication" + }, + "initiatorName": { + "type": "string", + "description": "Custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection." + }, + "iscsiInterface": { + "type": "string", + "description": "iSCSI Interface Name that uses an iSCSI transport. Defaults to 'default' (tcp)." + }, + "chapAuthDiscovery": { + "type": "boolean", + "description": "whether support iSCSI Discovery CHAP authentication" + }, + "iqn": { + "type": "string", + "description": "Target iSCSI Qualified Name." + }, + "lun": { + "type": "integer", + "description": "iSCSI Target Lun number.", + "format": "int32" + } + } + }, + "projected": { + "required": [ + "sources" + ], + "description": "Represents a projected volume source", + "properties": { + "sources": { + "items": { + "description": "Projection that may be projected along with other supported volume types", + "properties": { + "configMap": { + "description": "Adapts a ConfigMap into a projected volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode.", + "properties": { + "items": { + "items": { + "required": [ + "key", + "path" + ], + "description": "Maps a string key to a path within a volume.", + "properties": { + "path": { + "type": "string", + "description": "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'." + }, + "mode": { + "type": "integer", + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "key": { + "type": "string", + "description": "The key to project." + } + } + }, + "type": "array", + "description": "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'." + }, + "optional": { + "type": "boolean", + "description": "Specify whether the ConfigMap or it's keys must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "secret": { + "description": "Adapts a secret into a projected volume.\n\nThe contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode.", + "properties": { + "items": { + "items": { + "required": [ + "key", + "path" + ], + "description": "Maps a string key to a path within a volume.", + "properties": { + "path": { + "type": "string", + "description": "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'." + }, + "mode": { + "type": "integer", + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "key": { + "type": "string", + "description": "The key to project." + } + } + }, + "type": "array", + "description": "If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'." + }, + "optional": { + "type": "boolean", + "description": "Specify whether the Secret or its key must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "downwardAPI": { + "description": "Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode.", + "properties": { + "items": { + "items": { + "required": [ + "path" + ], + "description": "DownwardAPIVolumeFile represents information to create the file containing the pod field", + "properties": { + "path": { + "type": "string", + "description": "Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'" + }, + "fieldRef": { + "required": [ + "fieldPath" + ], + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "properties": { + "fieldPath": { + "type": "string", + "description": "Path of the field to select in the specified API version." + }, + "apiVersion": { + "type": "string", + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\"." + } + } + }, + "mode": { + "type": "integer", + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "resourceFieldRef": { + "required": [ + "resource" + ], + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "properties": { + "containerName": { + "type": "string", + "description": "Container name: required for volumes, optional for env vars" + }, + "resource": { + "type": "string", + "description": "Required: resource to select" + }, + "divisor": { + "type": "string" + } + } + } + } + }, + "type": "array", + "description": "Items is a list of DownwardAPIVolume file" + } + } + } + } + }, + "type": "array", + "description": "list of volume projections" + }, + "defaultMode": { + "type": "integer", + "description": "Mode bits to use on created files by default. Must be a value between 0 and 0777. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + } + } + }, + "secret": { + "description": "Adapts a Secret into a volume.\n\nThe contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling.", + "properties": { + "items": { + "items": { + "required": [ + "key", + "path" + ], + "description": "Maps a string key to a path within a volume.", + "properties": { + "path": { + "type": "string", + "description": "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'." + }, + "mode": { + "type": "integer", + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "key": { + "type": "string", + "description": "The key to project." + } + } + }, + "type": "array", + "description": "If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'." + }, + "optional": { + "type": "boolean", + "description": "Specify whether the Secret or it's keys must be defined" + }, + "defaultMode": { + "type": "integer", + "description": "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "secretName": { + "type": "string", + "description": "Name of the secret in the pod's namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret" + } + } + }, + "flexVolume": { + "required": [ + "driver" + ], + "description": "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.", + "properties": { + "secretRef": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "readOnly": { + "type": "boolean", + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + }, + "driver": { + "type": "string", + "description": "Driver is the name of the driver to use for this volume." + }, + "options": { + "additionalProperties": true, + "type": "object", + "description": "Optional: Extra command options if any." + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script." + } + } + }, + "photonPersistentDisk": { + "required": [ + "pdID" + ], + "description": "Represents a Photon Controller persistent disk resource.", + "properties": { + "pdID": { + "type": "string", + "description": "ID that identifies Photon Controller persistent disk" + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified." + } + } + }, + "azureDisk": { + "required": [ + "diskName", + "diskURI" + ], + "description": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + "properties": { + "diskName": { + "type": "string", + "description": "The Name of the data disk in the blob storage" + }, + "cachingMode": { + "type": "string", + "description": "Host Caching mode: None, Read Only, Read Write." + }, + "kind": { + "type": "string", + "description": "Expected values Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared" + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified." + }, + "diskURI": { + "type": "string", + "description": "The URI the data disk in the blob storage" + }, + "readOnly": { + "type": "boolean", + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + } + } + }, + "fc": { + "description": "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.", + "properties": { + "readOnly": { + "type": "boolean", + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + }, + "wwids": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously." + }, + "targetWWNs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Optional: FC target worldwide names (WWNs)" + }, + "lun": { + "type": "integer", + "description": "Optional: FC target lun number", + "format": "int32" + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified." + } + } + }, + "scaleIO": { + "required": [ + "gateway", + "system", + "secretRef" + ], + "description": "ScaleIOVolumeSource represents a persistent ScaleIO volume", + "properties": { + "storageMode": { + "type": "string", + "description": "Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned." + }, + "secretRef": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "protectionDomain": { + "type": "string", + "description": "The name of the ScaleIO Protection Domain for the configured storage." + }, + "volumeName": { + "type": "string", + "description": "The name of a volume already created in the ScaleIO system that is associated with this volume source." + }, + "sslEnabled": { + "type": "boolean", + "description": "Flag to enable/disable SSL communication with Gateway, default false" + }, + "system": { + "type": "string", + "description": "The name of the storage system as configured in ScaleIO." + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified." + }, + "readOnly": { + "type": "boolean", + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + }, + "storagePool": { + "type": "string", + "description": "The ScaleIO Storage Pool associated with the protection domain." + }, + "gateway": { + "type": "string", + "description": "The host address of the ScaleIO API Gateway." + } + } + }, + "emptyDir": { + "description": "Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.", + "properties": { + "sizeLimit": { + "type": "string" + }, + "medium": { + "type": "string", + "description": "What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir" + } + } + }, + "persistentVolumeClaim": { + "required": [ + "claimName" + ], + "description": "PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).", + "properties": { + "readOnly": { + "type": "boolean", + "description": "Will force the ReadOnly setting in VolumeMounts. Default false." + }, + "claimName": { + "type": "string", + "description": "ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims" + } + } + }, + "configMap": { + "description": "Adapts a ConfigMap into a volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.", + "properties": { + "items": { + "items": { + "required": [ + "key", + "path" + ], + "description": "Maps a string key to a path within a volume.", + "properties": { + "path": { + "type": "string", + "description": "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'." + }, + "mode": { + "type": "integer", + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "key": { + "type": "string", + "description": "The key to project." + } + } + }, + "type": "array", + "description": "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'." + }, + "optional": { + "type": "boolean", + "description": "Specify whether the ConfigMap or it's keys must be defined" + }, + "defaultMode": { + "type": "integer", + "description": "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "rbd": { + "required": [ + "monitors", + "image" + ], + "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", + "properties": { + "secretRef": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "image": { + "type": "string", + "description": "The rados image name. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it" + }, + "keyring": { + "type": "string", + "description": "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it" + }, + "fsType": { + "type": "string", + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd" + }, + "readOnly": { + "type": "boolean", + "description": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it" + }, + "user": { + "type": "string", + "description": "The rados user name. Default is admin. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it" + }, + "monitors": { + "items": { + "type": "string" + }, + "type": "array", + "description": "A collection of Ceph monitors. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it" + }, + "pool": { + "type": "string", + "description": "The rados pool name. Default is rbd. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it" + } + } + }, + "name": { + "type": "string", + "description": "Volume's name. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + }, + "azureFile": { + "required": [ + "secretName", + "shareName" + ], + "description": "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + "properties": { + "shareName": { + "type": "string", + "description": "Share Name" + }, + "readOnly": { + "type": "boolean", + "description": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts." + }, + "secretName": { + "type": "string", + "description": "the name of secret that contains Azure Storage Account Name and Key" + } + } + }, + "quobyte": { + "required": [ + "registry", + "volume" + ], + "description": "Represents a Quobyte mount that lasts the lifetime of a pod. Quobyte volumes do not support ownership management or SELinux relabeling.", + "properties": { + "volume": { + "type": "string", + "description": "Volume is a string that references an already created Quobyte volume by name." + }, + "readOnly": { + "type": "boolean", + "description": "ReadOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false." + }, + "group": { + "type": "string", + "description": "Group to map volume access to Default is no group" + }, + "registry": { + "type": "string", + "description": "Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes" + }, + "user": { + "type": "string", + "description": "User to map volume access to Defaults to serivceaccount user" + } + } + }, + "hostPath": { + "required": [ + "path" + ], + "description": "Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.", + "properties": { + "path": { + "type": "string", + "description": "Path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath" + }, + "type": { + "type": "string", + "description": "Type for HostPath Volume Defaults to \"\" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath" + } + } + }, + "nfs": { + "required": [ + "server", + "path" + ], + "description": "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.", + "properties": { + "path": { + "type": "string", + "description": "Path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs" + }, + "readOnly": { + "type": "boolean", + "description": "ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs" + }, + "server": { + "type": "string", + "description": "Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs" + } + } + }, + "vsphereVolume": { + "required": [ + "volumePath" + ], + "description": "Represents a vSphere volume resource.", + "properties": { + "storagePolicyName": { + "type": "string", + "description": "Storage Policy Based Management (SPBM) profile name." + }, + "volumePath": { + "type": "string", + "description": "Path that identifies vSphere volume vmdk" + }, + "storagePolicyID": { + "type": "string", + "description": "Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName." + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified." + } + } + }, + "cinder": { + "required": [ + "volumeID" + ], + "description": "Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.", + "properties": { + "readOnly": { + "type": "boolean", + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md" + }, + "volumeID": { + "type": "string", + "description": "volume id used to identify the volume in cinder More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md" + }, + "fsType": { + "type": "string", + "description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md" + } + } + }, + "awsElasticBlockStore": { + "required": [ + "volumeID" + ], + "description": "Represents a Persistent Disk resource in AWS.\n\nAn AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling.", + "properties": { + "readOnly": { + "type": "boolean", + "description": "Specify \"true\" to force and set the ReadOnly property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore" + }, + "partition": { + "type": "integer", + "description": "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty).", + "format": "int32" + }, + "volumeID": { + "type": "string", + "description": "Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore" + }, + "fsType": { + "type": "string", + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore" + } + } + }, + "cephfs": { + "required": [ + "monitors" + ], + "description": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.", + "properties": { + "secretRef": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "secretFile": { + "type": "string", + "description": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it" + }, + "readOnly": { + "type": "boolean", + "description": "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it" + }, + "user": { + "type": "string", + "description": "Optional: User is the rados user name, default is admin More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it" + }, + "path": { + "type": "string", + "description": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /" + }, + "monitors": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Required: Monitors is a collection of Ceph monitors More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it" + } + } + }, + "downwardAPI": { + "description": "DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling.", + "properties": { + "items": { + "items": { + "required": [ + "path" + ], + "description": "DownwardAPIVolumeFile represents information to create the file containing the pod field", + "properties": { + "path": { + "type": "string", + "description": "Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'" + }, + "fieldRef": { + "required": [ + "fieldPath" + ], + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "properties": { + "fieldPath": { + "type": "string", + "description": "Path of the field to select in the specified API version." + }, + "apiVersion": { + "type": "string", + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\"." + } + } + }, + "mode": { + "type": "integer", + "description": "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + }, + "resourceFieldRef": { + "required": [ + "resource" + ], + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "properties": { + "containerName": { + "type": "string", + "description": "Container name: required for volumes, optional for env vars" + }, + "resource": { + "type": "string", + "description": "Required: resource to select" + }, + "divisor": { + "type": "string" + } + } + } + } + }, + "type": "array", + "description": "Items is a list of downward API volume file" + }, + "defaultMode": { + "type": "integer", + "description": "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + "format": "int32" + } + } + }, + "gcePersistentDisk": { + "required": [ + "pdName" + ], + "description": "Represents a Persistent Disk resource in Google Compute Engine.\n\nA GCE PD must exist before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once or read-only many times. GCE PDs support ownership management and SELinux relabeling.", + "properties": { + "readOnly": { + "type": "boolean", + "description": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk" + }, + "partition": { + "type": "integer", + "description": "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + "format": "int32" + }, + "pdName": { + "type": "string", + "description": "Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk" + }, + "fsType": { + "type": "string", + "description": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk" + } + } + } + } + }, + "type": "array", + "description": "List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes", + "x-kubernetes-patch-strategy": "merge,retainKeys", + "x-kubernetes-patch-merge-key": "name" + }, + "initContainers": { + "items": { + "required": [ + "name" + ], + "description": "A single application container that you want to run within a pod.", + "properties": { + "livenessProbe": { + "description": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "timeoutSeconds": { + "type": "integer", + "description": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + }, + "initialDelaySeconds": { + "type": "integer", + "description": "Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "periodSeconds": { + "type": "integer", + "description": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + "format": "int32" + }, + "successThreshold": { + "type": "integer", + "description": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + "format": "int32" + }, + "failureThreshold": { + "type": "integer", + "description": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", + "format": "int32" + } + } + }, + "stdin": { + "type": "boolean", + "description": "Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false." + }, + "securityContext": { + "description": "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.", + "properties": { + "readOnlyRootFilesystem": { + "type": "boolean", + "description": "Whether this container has a read-only root filesystem. Default is false." + }, + "runAsUser": { + "type": "integer", + "description": "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + "format": "int64" + }, + "allowPrivilegeEscalation": { + "type": "boolean", + "description": "AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN" + }, + "capabilities": { + "description": "Adds and removes POSIX capabilities from running containers.", + "properties": { + "add": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Added capabilities" + }, + "drop": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Removed capabilities" + } + } + }, + "runAsNonRoot": { + "type": "boolean", + "description": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence." + }, + "seLinuxOptions": { + "description": "SELinuxOptions are the labels to be applied to the container", + "properties": { + "type": { + "type": "string", + "description": "Type is a SELinux type label that applies to the container." + }, + "role": { + "type": "string", + "description": "Role is a SELinux role label that applies to the container." + }, + "user": { + "type": "string", + "description": "User is a SELinux user label that applies to the container." + }, + "level": { + "type": "string", + "description": "Level is SELinux level label that applies to the container." + } + } + }, + "privileged": { + "type": "boolean", + "description": "Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false." + } + } + }, + "name": { + "type": "string", + "description": "Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated." + }, + "envFrom": { + "items": { + "description": "EnvFromSource represents the source of a set of ConfigMaps", + "properties": { + "prefix": { + "type": "string", + "description": "An optional identifer to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER." + }, + "configMapRef": { + "description": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the ConfigMap must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "secretRef": { + "description": "SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the Secret must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + } + } + }, + "type": "array", + "description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated." + }, + "volumeMounts": { + "items": { + "required": [ + "name", + "mountPath" + ], + "description": "VolumeMount describes a mounting of a Volume within a container.", + "properties": { + "subPath": { + "type": "string", + "description": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root)." + }, + "readOnly": { + "type": "boolean", + "description": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false." + }, + "mountPath": { + "type": "string", + "description": "Path within the container at which the volume should be mounted. Must not contain ':'." + }, + "mountPropagation": { + "type": "string", + "description": "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationHostToContainer is used. This field is alpha in 1.8 and can be reworked or removed in a future release." + }, + "name": { + "type": "string", + "description": "This must match the Name of a Volume." + } + } + }, + "type": "array", + "description": "Pod volumes to mount into the container's filesystem. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "mountPath" + }, + "image": { + "type": "string", + "description": "Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets." + }, + "args": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + }, + "stdinOnce": { + "type": "boolean", + "description": "Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false" + }, + "terminationMessagePolicy": { + "type": "string", + "description": "Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated." + }, + "ports": { + "items": { + "required": [ + "containerPort" + ], + "description": "ContainerPort represents a network port in a single container.", + "properties": { + "hostPort": { + "type": "integer", + "description": "Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.", + "format": "int32" + }, + "protocol": { + "type": "string", + "description": "Protocol for port. Must be UDP or TCP. Defaults to \"TCP\"." + }, + "containerPort": { + "type": "integer", + "description": "Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.", + "format": "int32" + }, + "name": { + "type": "string", + "description": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services." + }, + "hostIP": { + "type": "string", + "description": "What host IP to bind the external port to." + } + } + }, + "type": "array", + "description": "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "containerPort" + }, + "volumeDevices": { + "items": { + "required": [ + "name", + "devicePath" + ], + "description": "volumeDevice describes a mapping of a raw block device within a container.", + "properties": { + "devicePath": { + "type": "string", + "description": "devicePath is the path inside of the container that the device will be mapped to." + }, + "name": { + "type": "string", + "description": "name must match the name of a persistentVolumeClaim in the pod" + } + } + }, + "type": "array", + "description": "volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "devicePath" + }, + "tty": { + "type": "boolean", + "description": "Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false." + }, + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + }, + "env": { + "items": { + "required": [ + "name" + ], + "description": "EnvVar represents an environment variable present in a Container.", + "properties": { + "valueFrom": { + "description": "EnvVarSource represents a source for the value of an EnvVar.", + "properties": { + "secretKeyRef": { + "required": [ + "key" + ], + "description": "SecretKeySelector selects a key of a Secret.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the Secret or it's key must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + }, + "key": { + "type": "string", + "description": "The key of the secret to select from. Must be a valid secret key." + } + } + }, + "fieldRef": { + "required": [ + "fieldPath" + ], + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "properties": { + "fieldPath": { + "type": "string", + "description": "Path of the field to select in the specified API version." + }, + "apiVersion": { + "type": "string", + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\"." + } + } + }, + "resourceFieldRef": { + "required": [ + "resource" + ], + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "properties": { + "containerName": { + "type": "string", + "description": "Container name: required for volumes, optional for env vars" + }, + "resource": { + "type": "string", + "description": "Required: resource to select" + }, + "divisor": { + "type": "string" + } + } + }, + "configMapKeyRef": { + "required": [ + "key" + ], + "description": "Selects a key from a ConfigMap.", + "properties": { + "optional": { + "type": "boolean", + "description": "Specify whether the ConfigMap or it's key must be defined" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + }, + "key": { + "type": "string", + "description": "The key to select." + } + } + } + } + }, + "name": { + "type": "string", + "description": "Name of the environment variable. Must be a C_IDENTIFIER." + }, + "value": { + "type": "string", + "description": "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\"." + } + } + }, + "type": "array", + "description": "List of environment variables to set in the container. Cannot be updated.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "name" + }, + "imagePullPolicy": { + "type": "string", + "description": "Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images" + }, + "readinessProbe": { + "description": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "timeoutSeconds": { + "type": "integer", + "description": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + }, + "initialDelaySeconds": { + "type": "integer", + "description": "Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + "format": "int32" + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "periodSeconds": { + "type": "integer", + "description": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + "format": "int32" + }, + "successThreshold": { + "type": "integer", + "description": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + "format": "int32" + }, + "failureThreshold": { + "type": "integer", + "description": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", + "format": "int32" + } + } + }, + "terminationMessagePath": { + "type": "string", + "description": "Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated." + }, + "lifecycle": { + "description": "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.", + "properties": { + "preStop": { + "description": "Handler defines a specific action that should be taken", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + } + } + }, + "postStart": { + "description": "Handler defines a specific action that should be taken", + "properties": { + "httpGet": { + "required": [ + "port" + ], + "description": "HTTPGetAction describes an action based on HTTP Get requests.", + "properties": { + "path": { + "type": "string", + "description": "Path to access on the HTTP server." + }, + "host": { + "type": "string", + "description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead." + }, + "scheme": { + "type": "string", + "description": "Scheme to use for connecting to the host. Defaults to HTTP." + }, + "httpHeaders": { + "items": { + "required": [ + "name", + "value" + ], + "description": "HTTPHeader describes a custom header to be used in HTTP probes", + "properties": { + "name": { + "type": "string", + "description": "The header field name" + }, + "value": { + "type": "string", + "description": "The header field value" + } + } + }, + "type": "array", + "description": "Custom headers to set in the request. HTTP allows repeated headers." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "tcpSocket": { + "required": [ + "port" + ], + "description": "TCPSocketAction describes an action based on opening a socket", + "properties": { + "host": { + "type": "string", + "description": "Optional: Host name to connect to, defaults to the pod IP." + }, + "port": { + "type": "string", + "format": "int-or-string" + } + } + }, + "exec": { + "description": "ExecAction describes a \"run in container\" action.", + "properties": { + "command": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy." + } + } + } + } + } + } + }, + "resources": { + "description": "ResourceRequirements describes the compute resource requirements.", + "properties": { + "requests": { + "additionalProperties": true, + "type": "object", + "description": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" + }, + "limits": { + "additionalProperties": true, + "type": "object", + "description": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" + } + } + }, + "workingDir": { + "type": "string", + "description": "Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated." + } + } + }, + "type": "array", + "description": "List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "name" + }, + "imagePullSecrets": { + "items": { + "description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + "properties": { + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names" + } + } + }, + "type": "array", + "description": "ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. For example, in the case of docker, only DockerConfig type secrets are honored. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "name" + } + } + }, + "metadata": { + "description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + "properties": { + "ownerReferences": { + "items": { + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "description": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.", + "properties": { + "kind": { + "type": "string", + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds" + }, + "uid": { + "type": "string", + "description": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids" + }, + "apiVersion": { + "type": "string", + "description": "API version of the referent." + }, + "controller": { + "type": "boolean", + "description": "If true, this reference points to the managing controller." + }, + "blockOwnerDeletion": { + "type": "boolean", + "description": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned." + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names" + } + } + }, + "type": "array", + "description": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "uid" + }, + "name": { + "type": "string", + "description": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names" + }, + "deletionTimestamp": { + "type": "string", + "format": "date-time" + }, + "clusterName": { + "type": "string", + "description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request." + }, + "deletionGracePeriodSeconds": { + "type": "integer", + "description": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + "format": "int64" + }, + "labels": { + "additionalProperties": true, + "type": "object", + "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels" + }, + "namespace": { + "type": "string", + "description": "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces" + }, + "generation": { + "type": "integer", + "description": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + "format": "int64" + }, + "finalizers": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.", + "x-kubernetes-patch-strategy": "merge" + }, + "initializers": { + "required": [ + "pending" + ], + "description": "Initializers tracks the progress of initialization.", + "properties": { + "result": { + "x-kubernetes-group-version-kind": [ + { + "kind": "Status", + "version": "v1", + "group": "" + } + ], + "description": "Status is a return value for calls that don't return other objects.", + "properties": { + "status": { + "type": "string", + "description": "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status" + }, + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds" + }, + "code": { + "type": "integer", + "description": "Suggested HTTP return code for this status, 0 if not set.", + "format": "int32" + }, + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources" + }, + "reason": { + "type": "string", + "description": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it." + }, + "details": { + "description": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + "properties": { + "kind": { + "type": "string", + "description": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds" + }, + "group": { + "type": "string", + "description": "The group attribute of the resource associated with the status StatusReason." + }, + "name": { + "type": "string", + "description": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described)." + }, + "retryAfterSeconds": { + "type": "integer", + "description": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + "format": "int32" + }, + "causes": { + "items": { + "description": "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + "properties": { + "field": { + "type": "string", + "description": "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"" + }, + "message": { + "type": "string", + "description": "A human-readable description of the cause of the error. This field may be presented as-is to a reader." + }, + "reason": { + "type": "string", + "description": "A machine-readable description of the cause of the error. If this value is empty there is no information available." + } + } + }, + "type": "array", + "description": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes." + }, + "uid": { + "type": "string", + "description": "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids" + } + } + }, + "message": { + "type": "string", + "description": "A human-readable description of the status of this operation." + }, + "metadata": { + "description": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + "properties": { + "continue": { + "type": "string", + "description": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response." + }, + "selfLink": { + "type": "string", + "description": "selfLink is a URL representing this object. Populated by the system. Read-only." + }, + "resourceVersion": { + "type": "string", + "description": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency" + } + } + } + } + }, + "pending": { + "items": { + "required": [ + "name" + ], + "description": "Initializer is information about an initializer that has not yet completed.", + "properties": { + "name": { + "type": "string", + "description": "name of the process that is responsible for initializing this object." + } + } + }, + "type": "array", + "description": "Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.", + "x-kubernetes-patch-strategy": "merge", + "x-kubernetes-patch-merge-key": "name" + } + } + }, + "resourceVersion": { + "type": "string", + "description": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency" + }, + "generateName": { + "type": "string", + "description": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency" + }, + "creationTimestamp": { + "type": "string", + "format": "date-time" + }, + "annotations": { + "additionalProperties": true, + "type": "object", + "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations" + }, + "selfLink": { + "type": "string", + "description": "SelfLink is a URL representing this object. Populated by the system. Read-only." + }, + "uid": { + "type": "string", + "description": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids" + } + } + } + } +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/rbac-cluster-binding.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/rbac-cluster-binding.json new file mode 100644 index 000000000..ee11136dc --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/rbac-cluster-binding.json @@ -0,0 +1,20 @@ +{ + "apiVersion": "rbac.authorization.k8s.io/v1", + "kind": "ClusterRoleBinding", + "metadata": { + "creationTimestamp": null, + "name": "seldon" + }, + "roleRef": { + "apiGroup": "rbac.authorization.k8s.io", + "kind": "ClusterRole", + "name": "cluster-admin" + }, + "subjects": [ + { + "kind": "ServiceAccount", + "name": "seldon", + "namespace": "default" + } + ] +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/rbac-service-account.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/rbac-service-account.json new file mode 100644 index 000000000..e6745dcdd --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/rbac-service-account.json @@ -0,0 +1,9 @@ +{ + "apiVersion": "v1", + "kind": "ServiceAccount", + "metadata": { + "creationTimestamp": null, + "name": "seldon" + } +} + diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/redis-deployment.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/redis-deployment.json new file mode 100644 index 000000000..98744fc4e --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/redis-deployment.json @@ -0,0 +1,59 @@ +{ + "apiVersion": "apps/v1beta1", + "kind": "Deployment", + "metadata": { + "creationTimestamp": null, + "labels": { + "app": "redis-app" + }, + "name": "redis" + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app": "redis-app" + } + }, + "strategy": { + "rollingUpdate": { + "maxSurge": 1, + "maxUnavailable": 1 + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app": "redis-app" + } + }, + "spec": { + "containers": [ + { + "image": "redis:4.0.1", + "imagePullPolicy": "IfNotPresent", + "name": "redis-container", + "ports": [ + { + "containerPort": 6379, + "protocol": "TCP" + } + ], + "resources": {}, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File" + } + ], + "dnsPolicy": "ClusterFirst", + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": {}, + "terminationGracePeriodSeconds": 30 + } + } + }, + "status": {} +} + diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/redis-service.json b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/redis-service.json new file mode 100644 index 000000000..3bda2f3ad --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/json/redis-service.json @@ -0,0 +1,25 @@ +{ + "apiVersion": "v1", + "kind": "Service", + "metadata": { + "creationTimestamp": null, + "name": "redis" + }, + "spec": { + "ports": [ + { + "port": 6379, + "protocol": "TCP", + "targetPort": 6379 + } + ], + "selector": { + "app": "redis-app" + }, + "sessionAffinity": "None", + "type": "ClusterIP" + }, + "status": { + "loadBalancer": {} + } +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/parts.yaml b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/parts.yaml new file mode 100644 index 000000000..7a2b77b95 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/parts.yaml @@ -0,0 +1,35 @@ +{ + "name": "seldon", + "apiVersion": "0.0.1", + "kind": "ksonnet.io/parts", + "description": "Seldon ML Deployment\n", + "author": "seldon-core team ", + "contributors": [ + { + "name": "Clive Cox", + "email": "cc@seldon.io" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/kubeflow/kubeflow" + }, + "bugs": { + "url": "https://github.com/SeldonIO/seldon-core/issues" + }, + "keywords": [ + "kubernetes", + "machine learning", + "deployment" + ], + "quickStart": { + "prototype": "io.ksonnet.pkg.seldon", + "componentName": "seldon", + "flags": { + "name": "seldon", + "namespace": "default" + }, + "comment": "Seldon Core Components." + }, + "license": "Apache 2.0" +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/prototypes/core.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/prototypes/core.jsonnet new file mode 100644 index 000000000..ca472fedb --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/prototypes/core.jsonnet @@ -0,0 +1,70 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.seldon +// @description Seldon Core components. Operator and API FrontEnd. +// @shortDescription Seldon Core components. +// @param name string seldon Name to give seldon +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam withRbac string true Whether to include RBAC setup +// @optionalParam withApife string false Whether to include builtin API Oauth fornt end server for ingress +// @optionalParam apifeImage string seldonio/apife:0.1.6 Default image for API Front End +// @optionalParam apifeServiceType string NodePort API Front End Service Type +// @optionalParam operatorImage string seldonio/cluster-manager:0.1.6 Seldon cluster manager image version +// @optionalParam operatorSpringOpts string null cluster manager spring opts +// @optionalParam operatorJavaOpts string null cluster manager java opts +// @optionalParam engineImage string seldonio/engine:0.1.6 Seldon engine image version + +local k = import "k.libsonnet"; +local core = import "kubeflow/seldon/core.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +local name = import "param://name"; +local namespace = updatedParams.namespace; +local withRbac = import "param://withRbac"; +local withApife = import "param://withApife"; + +// APIFE +local apifeImage = import "param://apifeImage"; +local apifeServiceType = import "param://apifeServiceType"; + +// Cluster Manager (The CRD Operator) +local operatorImage = import "param://operatorImage"; +local operatorSpringOptsParam = import "param://operatorSpringOpts"; +local operatorSpringOpts = if operatorSpringOptsParam != "null" then operatorSpringOptsParam else ""; +local operatorJavaOptsParam = import "param://operatorJavaOpts"; +local operatorJavaOpts = if operatorJavaOptsParam != "null" then operatorJavaOptsParam else ""; + +// Engine +local engineImage = import "param://engineImage"; + +// APIFE +local apife = [ + core.parts(namespace).apife(apifeImage, withRbac), + core.parts(namespace).apifeService(apifeServiceType), +]; + +local rbac = [ + core.parts(namespace).rbacServiceAccount(), + core.parts(namespace).rbacClusterRoleBinding(), +]; + +// Core +local coreComponents = [ + core.parts(namespace).deploymentOperator(engineImage, operatorImage, operatorSpringOpts, operatorJavaOpts, withRbac), + core.parts(namespace).redisDeployment(), + core.parts(namespace).redisService(), + core.parts(namespace).crd(), +]; + +if withRbac == "true" && withApife == "true" then + k.core.v1.list.new(apife + rbac + coreComponents) +else if withRbac == "true" && withApife == "false" then + k.core.v1.list.new(rbac + coreComponents) +else if withRbac == "false" && withApife == "true" then + k.core.v1.list.new(apife + coreComponents) +else if withRbac == "false" && withApife == "false" then + k.core.v1.list.new(coreComponents) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/prototypes/serve-simple.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/prototypes/serve-simple.jsonnet new file mode 100644 index 000000000..3f3674032 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/prototypes/serve-simple.jsonnet @@ -0,0 +1,40 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.seldon-serve-simple +// @description A prototype to serve a single seldon model +// @shortDescription A prototype to serve a single seldon model +// @param name string Name to give this deployment +// @param image string Docker image which contains this model +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam replicas number 1 Number of replicas +// @optionalParam endpoint string REST The endpoint type: REST or GRPC +// @optionalParam pvcName string null Name of PVC + + +local k = import "k.libsonnet"; +local serve = import "kubeflow/seldon/serve-simple.libsonnet"; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +local name = import "param://name"; +local image = import "param://image"; +local namespace = updatedParams.namespace; +local replicas = import "param://replicas"; +local endpoint = import "param://endpoint"; +local pvcName = import "param://pvcName"; + +local serveComponents = [ + serve.parts(namespace).serve(name, image, replicas, endpoint, pvcName), +]; + +local pvcComponent = [ + serve.parts(namespace).createPVC(pvcName), +]; + +if pvcName != "null" && pvcName != "" then + k.core.v1.list.new(serveComponents + pvcComponent) +else + k.core.v1.list.new(serveComponents) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/serve-simple.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/serve-simple.libsonnet new file mode 100644 index 000000000..137685654 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/seldon/serve-simple.libsonnet @@ -0,0 +1,89 @@ +{ + parts(namespace):: { + + createPVC(pvcName):: { + apiVersion: "v1", + kind: "PersistentVolumeClaim", + metadata: { + name: pvcName, + }, + spec: { + accessModes: [ + "ReadWriteOnce", + ], + resources: { + requests: { + storage: "10Gi", + }, + }, + }, + }, // createPVC + + serve(name, image, replicas, endpoint, pvcName):: { + apiVersion: "machinelearning.seldon.io/v1alpha1", + kind: "SeldonDeployment", + metadata: { + labels: { + app: "seldon", + }, + name: name, + namespace: namespace, + }, + spec: { + annotations: { + deployment_version: "v1", + project_name: name, + }, + name: name, + predictors: [ + { + annotations: { + predictor_version: "v1", + }, + componentSpec: { + spec: { + containers: [ + { + image: image, + imagePullPolicy: "Always", + name: name, + volumeMounts+: if pvcName != "null" && pvcName != "" then [ + { + mountPath: "/mnt", + name: "persistent-storage", + }, + ] else [], + }, + ], + terminationGracePeriodSeconds: 1, + volumes+: if pvcName != "null" && pvcName != "" then [ + { + name: "persistent-storage", + volumeSource: { + persistentVolumeClaim: { + claimName: pvcName, + }, + }, + }, + ] else [], + }, + }, + graph: { + children: [ + + ], + endpoint: { + type: endpoint, + }, + name: name, + type: "MODEL", + }, + name: name, + replicas: replicas, + }, + ], + }, + }, + + }, +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/README.md b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/README.md new file mode 100644 index 000000000..9825b264c --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/README.md @@ -0,0 +1,91 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [tf-job](#tf-job) + - [Quickstart](#quickstart) + - [Using the library](#using-the-library) + - [io.ksonnet.pkg.tf-job](#ioksonnetpkgtf-job) + - [Example](#example) + - [Parameters](#parameters) + - [Example](#example-1) + - [Parameters](#parameters-1) + + + +# tf-job + +> Prototypes for running TensorFlow jobs. + + +* [Quickstart](#quickstart) +* [Using Prototypes](#using-prototypes) + * [io.ksonnet.pkg.tf-job](#io.ksonnet.pkg.tf-job) + * [io.ksonnet.pkg.tf-cnn](#io.ksonnet.pkg.tf-cnn) + +## Quickstart + +*The following commands use the `io.ksonnet.pkg.tf-job` prototype to generate Kubernetes YAML for tf-job, and then deploys it to your Kubernetes cluster.* + +First, create a cluster and install the ksonnet CLI (see root-level [README.md](rootReadme)). + +If you haven't yet created a [ksonnet application](linkToSomewhere), do so using `ks init `. + +Finally, in the ksonnet application directory, run the following: + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.tf-job tf-job \ + --namespace default \ + --name tf-job + +# Apply to server. +$ ks apply -f tf-job.jsonnet +``` + +## Using the library + +The library files for tf-job define a set of relevant *parts* (_e.g._, deployments, services, secrets, and so on) that can be combined to configure tf-job for a wide variety of scenarios. For example, a database like Redis may need a secret to hold the user password, or it may have no password if it's acting as a cache. + +This library provides a set of pre-fabricated "flavors" (or "distributions") of tf-job, each of which is configured for a different use case. These are captured as ksonnet *prototypes*, which allow users to interactively customize these distributions for their specific needs. + +These prototypes, as well as how to use them, are enumerated below. + +### io.ksonnet.pkg.tf-job + +A TensorFlow job (could be training or evaluation). +#### Example + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.tf-job tf-job \ + --name YOUR_NAME_HERE +``` + +#### Parameters + +The available options to pass prototype are: + +* `--name=`: Name to give to each of the components [string] +### io.ksonnet.pkg.tf-cnn + +A TensorFlow CNN Benchmarking job +#### Example + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.tf-cnn tf-job \ + --name YOUR_NAME_HERE +``` + +#### Parameters + +The available options to pass prototype are: + +* `--name=`: Name for the job. [string] + + +[rootReadme]: https://github.com/ksonnet/mixins diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/parts.yaml b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/parts.yaml new file mode 100644 index 000000000..905ff0a92 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/parts.yaml @@ -0,0 +1,35 @@ +{ + "name": "tf-job", + "apiVersion": "0.0.1", + "kind": "ksonnet.io/parts", + "description": "Prototypes for running TensorFlow jobs.\n", + "author": "kubeflow team ", + "contributors": [ + { + "name": "Jeremy Lewi", + "email": "jlewi@google.com" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/kubeflow/kubeflow" + }, + "bugs": { + "url": "https://github.com/kubeflow/kubeflow/issues" + }, + "keywords": [ + "kubeflow", + "tensorflow", + "database" + ], + "quickStart": { + "prototype": "io.ksonnet.pkg.tf-job", + "componentName": "tf-job", + "flags": { + "name": "tf-job", + "namespace": "default" + }, + "comment": "Run TensorFlow Job" + }, + "license": "Apache 2.0" +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/prototypes/tf-cnn-benchmarks.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/prototypes/tf-cnn-benchmarks.jsonnet new file mode 100644 index 000000000..62cf9b5ce --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/prototypes/tf-cnn-benchmarks.jsonnet @@ -0,0 +1,109 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.tf-cnn +// @description A TensorFlow CNN Benchmarking job +// @shortDescription Run the TensorFlow CNN benchmarking job. +// @param name string Name for the job. +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam batch_size number 32 The batch size +// @optionalParam model string resnet50 Which model to use +// @optionalParam num_gpus number 0 The number of GPUs to attach to workers. +// @optionalParam image string gcr.io/kubeflow/tf-benchmarks-cpu:v20171202-bdab599-dirty-284af3 The docker image to use for the job. +// @optionalParam image_gpu string gcr.io/kubeflow/tf-benchmarks-gpu:v20171202-bdab599-dirty-284af3 The docker image to use when using GPUs. +// @optionalParam image_pull_secrets string null Comma-delimited list of secret names to use credentials in pulling your docker images. +// @optionalParam num_ps number 1 The number of ps to use +// @optionalParam num_workers number 1 The number of workers to use + +// We need at least 1 parameter server. + +// TODO(jlewi): Should we move this into an examples package? + +local k = import "k.libsonnet"; +local deployment = k.extensions.v1beta1.deployment; +local container = deployment.mixin.spec.template.spec.containersType; +local podTemplate = k.extensions.v1beta1.podTemplate; + +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +local tfJob = import "kubeflow/tf-job/tf-job.libsonnet"; + +local name = import "param://name"; +local namespace = updatedParams.namespace; + +local numGpus = import "param://num_gpus"; +local batchSize = import "param://batch_size"; +local model = import "param://model"; + +local args = [ + "python", + "tf_cnn_benchmarks.py", + "--batch_size=" + batchSize, + "--model=" + model, + "--variable_update=parameter_server", + "--flush_stdout=true", + ] + + if numGpus == 0 then + // We need to set num_gpus=1 even if not using GPUs because otherwise the devie list + // is empty because of this code + // https://github.com/tensorflow/benchmarks/blob/master/scripts/tf_cnn_benchmarks/benchmark_cnn.py#L775 + // We won't actually use GPUs because based on other flags no ops will be assigned to GPus. + [ + "--num_gpus=1", + "--local_parameter_device=cpu", + "--device=cpu", + "--data_format=NHWC", + ] + else + [ + "--num_gpus=" + numGpus, + ] +; + +local image = import "param://image"; +local imageGpu = import "param://image_gpu"; +local imagePullSecrets = import "param://image_pull_secrets"; +local numPs = import "param://num_ps"; +local numWorkers = import "param://num_workers"; +local numGpus = import "param://num_gpus"; + +local workerSpec = if numGpus > 0 then + tfJob.parts.tfJobReplica("WORKER", numWorkers, args, imageGpu, imagePullSecrets, numGpus) +else + tfJob.parts.tfJobReplica("WORKER", numWorkers, args, image, imagePullSecrets); + +// TODO(jlewi): Look at how the redis prototype modifies a container by +// using mapContainersWithName. Can we do something similar? +// https://github.com/ksonnet/parts/blob/9d78d6bb445d530d5b927656d2293d4f12654608/incubator/redis/redis.libsonnet +local replicas = std.map(function(s) + s { + template+: { + spec+: { + // TODO(jlewi): Does this overwrite containers? + containers: [ + s.template.spec.containers[0] { + workingDir: "/opt/tf-benchmarks/scripts/tf_cnn_benchmarks", + }, + ], + }, + }, + }, + std.prune([workerSpec, tfJob.parts.tfJobReplica("PS", numPs, args, image, imagePullSecrets)])); + +local job = + if numWorkers < 1 then + error "num_workers must be >= 1" + else + if numPs < 1 then + error "num_ps must be >= 1" + else + tfJob.parts.tfJob(name, namespace, replicas, null) + { + spec+: { + tfImage: image, + terminationPolicy: { chief: { replicaName: "WORKER", replicaIndex: 0 } }, + }, + }; + +std.prune(k.core.v1.list.new([job])) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/prototypes/tf-job.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/prototypes/tf-job.jsonnet new file mode 100644 index 000000000..f3e5e68b6 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/prototypes/tf-job.jsonnet @@ -0,0 +1,65 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.tf-job +// @description A TensorFlow job (could be training or evaluation). +// @shortDescription A TensorFlow job. +// @param name string Name to give to each of the components +// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set. +// @optionalParam args string null Comma separated list of arguments to pass to the job +// @optionalParam image string null The docker image to use for the job. +// @optionalParam image_gpu string null The docker image to use when using GPUs. +// @optionalParam image_pull_secrets string null Comma-delimited list of secret names to use credentials in pulling your docker images. +// @optionalParam num_masters number 1 The number of masters to use +// @optionalParam num_ps number 0 The number of ps to use +// @optionalParam num_workers number 0 The number of workers to use +// @optionalParam num_gpus number 0 The number of GPUs to attach to workers. + +// TODO(https://github.com/ksonnet/ksonnet/issues/235): ks param set args won't work if the arg starts with "--". + +local k = import "k.libsonnet"; +local tfJob = import "kubeflow/tf-job/tf-job.libsonnet"; +// updatedParams uses the environment namespace if +// the namespace parameter is not explicitly set +local updatedParams = params { + namespace: if params.namespace == "null" then env.namespace else params.namespace, +}; + +local name = import "param://name"; +local namespace = updatedParams.namespace; + +local argsParam = import "param://args"; +local args = + if argsParam == "null" then + [] + else + std.split(argsParam, ","); + +local image = import "param://image"; +local imageGpu = import "param://image_gpu"; +local imagePullSecrets = import "param://image_pull_secrets"; +local numMasters = import "param://num_masters"; +local numPs = import "param://num_ps"; +local numWorkers = import "param://num_workers"; +local numGpus = import "param://num_gpus"; + +local terminationPolicy = if numMasters == 1 then + tfJob.parts.tfJobTerminationPolicy("MASTER", 0) +else + tfJob.parts.tfJobTerminationPolicy("WORKER", 0); + +local workerSpec = if numGpus > 0 then + tfJob.parts.tfJobReplica("WORKER", numWorkers, args, imageGpu, imagePullSecrets, numGpus) +else + tfJob.parts.tfJobReplica("WORKER", numWorkers, args, image, imagePullSecrets); + +std.prune(k.core.v1.list.new([ + tfJob.parts.tfJob( + name, + namespace, + [ + tfJob.parts.tfJobReplica("MASTER", numMasters, args, image, imagePullSecrets), + workerSpec, + tfJob.parts.tfJobReplica("PS", numPs, args, image, imagePullSecrets), + ], + terminationPolicy + ), +])) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/tf-job.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/tf-job.libsonnet new file mode 100644 index 000000000..2ac2f7445 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/tf-job.libsonnet @@ -0,0 +1,59 @@ +local k = import "k.libsonnet"; +local util = import "util.libsonnet"; + +{ + parts:: { + tfJobReplica(replicaType, number, args, image, imagePullSecrets=[], numGpus=0):: + local baseContainer = { + image: image, + name: "tensorflow", + }; + local containerArgs = if std.length(args) > 0 then + { + args: args, + } + else {}; + local resources = if numGpus > 0 then { + resources: { + limits: { + "nvidia.com/gpu": numGpus, + }, + }, + } else {}; + if number > 0 then + { + replicas: number, + template: { + spec: { + imagePullSecrets: [{ name: secret } for secret in util.toArray(imagePullSecrets)], + containers: [ + baseContainer + containerArgs + resources, + ], + restartPolicy: "OnFailure", + }, + }, + tfReplicaType: replicaType, + } + else {}, + + tfJobTerminationPolicy(replicaName, replicaIndex):: { + chief: { + replicaName: replicaName, + replicaIndex: replicaIndex, + }, + }, + + tfJob(name, namespace, replicas, tp):: { + apiVersion: "kubeflow.org/v1alpha1", + kind: "TFJob", + metadata: { + name: name, + namespace: namespace, + }, + spec: { + replicaSpecs: replicas, + terminationPolicy: tp, + }, + }, + }, +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/util.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/util.libsonnet new file mode 100644 index 000000000..d5458f403 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-job/util.libsonnet @@ -0,0 +1,7 @@ +{ + // Convert a comma-delimited string to an array. + toArray(str):: + if std.type(str) == "string" && str != "null" && std.length(str) > 0 then + std.split(str, ",") + else [], +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/README.md b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/README.md new file mode 100644 index 000000000..3cf13ada6 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/README.md @@ -0,0 +1,73 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [tf-serving](#tf-serving) + - [Quickstart](#quickstart) + - [Using the library](#using-the-library) + - [io.ksonnet.pkg.tf-serving](#ioksonnetpkgtf-serving) + - [Example](#example) + - [Parameters](#parameters) + + + +# tf-serving + +> TensorFlow serving is a server for TensorFlow models. + + +* [Quickstart](#quickstart) +* [Using Prototypes](#using-prototypes) + * [io.ksonnet.pkg.tf-serving](#io.ksonnet.pkg.tf-serving) + +## Quickstart + +*The following commands use the `io.ksonnet.pkg.tf-serving` prototype to generate Kubernetes YAML for tf-serving, and then deploys it to your Kubernetes cluster.* + +First, create a cluster and install the ksonnet CLI (see root-level [README.md](rootReadme)). + +If you haven't yet created a [ksonnet application](linkToSomewhere), do so using `ks init `. + +Finally, in the ksonnet application directory, run the following: + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.tf-serving tf-serving \ + --name tf-serving \ + --namespace default + +# Apply to server. +$ ks apply -f tf-serving.jsonnet +``` + +## Using the library + +The library files for tf-serving define a set of relevant *parts* (_e.g._, deployments, services, secrets, and so on) that can be combined to configure tf-serving for a wide variety of scenarios. For example, a database like Redis may need a secret to hold the user password, or it may have no password if it's acting as a cache. + +This library provides a set of pre-fabricated "flavors" (or "distributions") of tf-serving, each of which is configured for a different use case. These are captured as ksonnet *prototypes*, which allow users to interactively customize these distributions for their specific needs. + +These prototypes, as well as how to use them, are enumerated below. + +### io.ksonnet.pkg.tf-serving + +TensorFlow serving +#### Example + +```shell +# Expand prototype as a Jsonnet file, place in a file in the +# `components/` directory. (YAML and JSON are also available.) +$ ks prototype use io.ksonnet.pkg.tf-serving tf-serving \ + --name YOUR_NAME_HERE \ + --model_path YOUR_MODEL_PATH_HERE +``` + +#### Parameters + +The available options to pass prototype are: + +* `--name=`: Name to give to each of the components [string] +* `--model_path=`: Path to the model. This can be a GCS path. [string] + + +[rootReadme]: https://github.com/ksonnet/mixins diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/parts.yaml b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/parts.yaml new file mode 100644 index 000000000..899555682 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/parts.yaml @@ -0,0 +1,35 @@ +{ + "name": "tf-serving", + "apiVersion": "0.0.1", + "kind": "ksonnet.io/parts", + "description": "TensorFlow serving is a server for TensorFlow models.\n", + "author": "kubeflow team ", + "contributors": [ + { + "name": "Jeremy Lewi", + "email": "jlewi@google.com" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/kubeflow/kubeflow" + }, + "bugs": { + "url": "https://github.com/kubeflow/kubeflow/issues" + }, + "keywords": [ + "kubeflow", + "tensorflow", + "database" + ], + "quickStart": { + "prototype": "io.ksonnet.pkg.tf-serving", + "componentName": "tf-serving", + "flags": { + "name": "tf-serving", + "namespace": "default" + }, + "comment": "Run TensorFlow Serving" + }, + "license": "Apache 2.0" +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/prototypes/tf-serving-all-features.jsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/prototypes/tf-serving-all-features.jsonnet new file mode 100644 index 000000000..24aeeef78 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/prototypes/tf-serving-all-features.jsonnet @@ -0,0 +1,24 @@ +// @apiVersion 0.1 +// @name io.ksonnet.pkg.tf-serving +// @description TensorFlow serving +// @shortDescription A TensorFlow serving deployment +// @param name string Name to give to each of the components + +local k = import "k.libsonnet"; + +// ksonnet appears to require name be a parameter of the prototype which is why we handle it differently. +local name = import "param://name"; + +// updatedParams includes the namespace from env by default. +// We can override namespace in params if needed +local updatedParams = env + params; + +local tfServingBase = import "kubeflow/tf-serving/tf-serving.libsonnet"; +local tfServing = tfServingBase { + // Override parameters with user supplied parameters. + params+: updatedParams { + name: name, + }, +}; + +std.prune(k.core.v1.list.new(tfServing.components)) diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/tf-serving.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/tf-serving.libsonnet new file mode 100644 index 000000000..a2aa642ba --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/tf-serving.libsonnet @@ -0,0 +1,383 @@ +{ + util:: import "kubeflow/tf-serving/util.libsonnet", + + // Parameters are intended to be late bound. + params:: { + name: null, + numGpus: 0, + labels: { + app: $.params.name, + }, + modelName: $.params.name, + modelPath: null, + modelStorageType: "cloud", + + version: "v1", + firstVersion: true, + + deployIstio: false, + + deployHttpProxy: false, + defaultHttpProxyImage: "gcr.io/kubeflow-images-public/tf-model-server-http-proxy:v20180327-995786ec", + httpProxyImage: "", + httpProxyImageToUse: if $.params.httpProxyImage == "" then + $.params.defaultHttpProxyImage + else + $.params.httpProxyImage, + + serviceType: "ClusterIP", + + // If users want to override the image then can override defaultCpuImage and/or defaultGpuImage + // in which case the image used will still depend on whether GPUs are used or not. + // Users can also override modelServerImage in which case the user supplied value will always be used + // regardless of numGpus. + defaultCpuImage: "gcr.io/kubeflow-images-public/tf-model-server-cpu:v20180327-995786ec", + defaultGpuImage: "gcr.io/kubeflow-images-public/tf-model-server-gpu:v20180327-995786ec", + modelServerImage: if $.params.numGpus == 0 then + $.params.defaultCpuImage + else + $.params.defaultGpuImage, + + + // Whether or not to enable s3 parameters + s3Enable:: false, + + // Which cloud to use + cloud:: null, + }, + + // Parametes specific to GCP. + gcpParams:: { + gcpCredentialSecretName: "", + } + $.params, + + // Parameters that control S3 access + // params overrides s3params because params can be overwritten by the user to override the defaults. + s3params:: { + // Name of the k8s secrets containing S3 credentials + s3SecretName: "", + // Name of the key in the k8s secret containing AWS_ACCESS_KEY_ID. + s3SecretAccesskeyidKeyName: "", + + // Name of the key in the k8s secret containing AWS_SECRET_ACCESS_KEY. + s3SecretSecretaccesskeyKeyName: "", + + // S3 region + s3AwsRegion: "us-west-1", + + // TODO(jlewi): We should use util.toBool to automatically conver to actual boolean values. + // The use of strings is left over from when they were prototype parameters which only supports string type. + + // true Whether or not to use https for S3 connections + s3UseHttps: "true", + + // Whether or not to verify https certificates for S3 connections + s3VerifySsl: "true", + + // URL for your s3-compatible endpoint. + s3Endpoint: "http://s3.us-west-1.amazonaws.com,", + } + $.params, + + + components:: { + + all:: [ + // Default routing rule for the first version of model. + if $.util.toBool($.params.deployIstio) && $.util.toBool($.params.firstVersion) then + $.parts.defaultRouteRule, + ] + + // TODO(jlewi): It would be better to structure s3 as a mixin. + // As an example it would be great to allow S3 and GCS parameters + // to be enabled simultaneously. This should be doable because + // each entails adding a set of environment variables and volumes + // to the containers. These volumes/environment variables shouldn't + // overlap so there's no reason we shouldn't be able to just add + // both modifications to the base container. + // I think we want to restructure things as mixins so they can just + // be added. + if $.params.s3Enable then + [ + $.s3parts.tfService, + $.s3parts.tfDeployment, + ] + else if $.params.cloud == "gcp" then + [ + $.gcpParts.tfService, + $.gcpParts.tfDeployment, + ] + else + [ + $.parts.tfService, + $.parts.tfDeployment, + ], + }.all, + + parts:: { + // We define the containers one level beneath parts because combined with jsonnet late binding + // this makes it easy for users to override specific bits of the container. + tfServingContainerBase:: { + name: $.params.name, + image: $.params.modelServerImage, + imagePullPolicy: "IfNotPresent", + args: [ + "/usr/bin/tensorflow_model_server", + "--port=9000", + "--model_name=" + $.params.modelName, + "--model_base_path=" + $.params.modelPath, + ], + ports: [ + { + containerPort: 9000, + }, + ], + // TODO(jlewi): We should add readiness and liveness probes. I think the blocker is that + // model-server doesn't have something we can use out of the box. + resources: { + requests: { + memory: "1Gi", + cpu: "1", + }, + limits: { + memory: "4Gi", + cpu: "4", + }, + }, + // The is user and group should be defined in the Docker image. + // Per best practices we don't run as the root user. + securityContext: { + runAsUser: 1000, + fsGroup: 1000, + }, + volumeMounts+: if $.params.modelStorageType == "nfs" then [{ + name: "nfs", + mountPath: "/mnt", + }] + else [], + }, // tfServingContainer + + tfServingContainer+: $.parts.tfServingContainerBase + + if $.params.numGpus > 0 then + { + resources+: { + limits+: { + "nvidia.com/gpu": $.params.numGpus, + }, + }, + } + else {}, + + tfServingMetadata+: { + labels: $.params.labels { version: $.params.version }, + annotations: { + "sidecar.istio.io/inject": if $.util.toBool($.params.deployIstio) then "true", + }, + }, + + httpProxyContainer:: { + name: $.params.name + "-http-proxy", + image: $.params.httpProxyImageToUse, + imagePullPolicy: "IfNotPresent", + command: [ + "python", + "/usr/src/app/server.py", + "--port=8000", + "--rpc_port=9000", + "--rpc_timeout=10.0", + ], + env: [], + ports: [ + { + containerPort: 8000, + }, + ], + resources: { + requests: { + memory: "1Gi", + cpu: "1", + }, + limits: { + memory: "4Gi", + cpu: "4", + }, + }, + securityContext: { + runAsUser: 1000, + fsGroup: 1000, + }, + }, // httpProxyContainer + + + tfDeployment: { + apiVersion: "extensions/v1beta1", + kind: "Deployment", + metadata: { + name: $.params.name + "-" + $.params.version, + namespace: $.params.namespace, + labels: $.params.labels, + }, + spec: { + template: { + metadata: $.parts.tfServingMetadata, + spec: { + containers: [ + $.parts.tfServingContainer, + if $.util.toBool($.params.deployHttpProxy) then + $.parts.httpProxyContainer, + ], + volumes+: if $.params.modelStorageType == "nfs" then + [{ + name: "nfs", + persistentVolumeClaim: { + claimName: $.params.nfsPVC, + }, + }] + else [], + }, + }, + }, + }, // tfDeployment + + tfService: { + apiVersion: "v1", + kind: "Service", + metadata: { + labels: $.params.labels, + name: $.params.name, + namespace: $.params.namespace, + annotations: { + "getambassador.io/config": + std.join("\n", [ + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: tfserving-mapping-" + $.params.name + "-get", + "prefix: /models/" + $.params.name + "/", + "rewrite: /", + "method: GET", + "service: " + $.params.name + "." + $.params.namespace + ":8000", + "---", + "apiVersion: ambassador/v0", + "kind: Mapping", + "name: tfserving-mapping-" + $.params.name + "-post", + "prefix: /models/" + $.params.name + "/", + "rewrite: /model/" + $.params.name + ":predict", + "method: POST", + "service: " + $.params.name + "." + $.params.namespace + ":8000", + ]), + }, //annotations + }, + spec: { + ports: [ + { + name: "grpc-tf-serving", + port: 9000, + targetPort: 9000, + }, + { + name: "http-tf-serving-proxy", + port: 8000, + targetPort: 8000, + }, + ], + selector: $.params.labels, + type: $.params.serviceType, + }, + }, // tfService + + defaultRouteRule: { + apiVersion: "config.istio.io/v1alpha2", + kind: "RouteRule", + metadata: { + name: $.params.name + "-default", + namespace: $.params.namespace, + }, + spec: { + destination: { + name: $.params.name, + }, + precedence: 0, + route: [ + { + labels: { version: $.params.version }, + }, + ], + }, + }, + + }, // parts + + // Parts specific to S3 + s3parts:: $.parts { + s3Env:: [ + { name: "AWS_ACCESS_KEY_ID", valueFrom: { secretKeyRef: { name: $.s3params.s3SecretName, key: $.s3params.s3SecretAccesskeyidKeyName } } }, + { name: "AWS_SECRET_ACCESS_KEY", valueFrom: { secretKeyRef: { name: $.s3params.s3SecretName, key: $.s3params.s3SecretSecretaccesskeyKeyName } } }, + { name: "AWS_REGION", value: $.s3params.s3AwsRegion }, + { name: "S3_REGION", value: $.s3params.s3AwsRegion }, + { name: "S3_USE_HTTPS", value: $.s3params.s3UseHttps }, + { name: "S3_VERIFY_SSL", value: $.s3params.s3VerifySsl }, + { name: "S3_ENDPOINT", value: $.s3params.s3Endpoint }, + ], + + tfServingContainer: $.parts.tfServingContainer { + env+: $.s3parts.s3Env, + }, + + tfDeployment: $.parts.tfDeployment { + spec: +{ + template: +{ + metadata: $.parts.tfServingMetadata, + spec: +{ + containers: [ + $.s3parts.tfServingContainer, + if $.util.toBool($.params.deployHttpProxy) then + $.parts.httpProxyContainer, + ], + }, + }, + }, + }, // tfDeployment + }, // s3parts + + // Parts specific to GCP + gcpParts:: $.parts { + gcpEnv:: [ + if $.gcpParams.gcpCredentialSecretName != "" then + { name: "GOOGLE_APPLICATION_CREDENTIALS", value: "/secret/gcp-credentials/key.json" }, + ], + + tfServingContainer: $.parts.tfServingContainer { + env+: $.gcpParts.gcpEnv, + volumeMounts+: [ + if $.gcpParams.gcpCredentialSecretName != "" then + { + name: "gcp-credentials", + mountPath: "/secret/gcp-credentials", + }, + ], + }, + + tfDeployment: $.parts.tfDeployment { + spec+: { + template+: { + metadata: $.parts.tfServingMetadata, + spec+: { + containers: [ + $.gcpParts.tfServingContainer, + if $.util.toBool($.params.deployHttpProxy) then + $.parts.httpProxyContainer, + ], + volumes: [ + if $.gcpParams.gcpCredentialSecretName != "" then + { + name: "gcp-credentials", + secret: { + secretName: $.gcpParams.gcpCredentialSecretName, + }, + }, + ], + }, + }, + }, + }, // tfDeployment + }, // gcpParts +} diff --git a/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/util.libsonnet b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/util.libsonnet new file mode 100644 index 000000000..087e97cd1 --- /dev/null +++ b/dev-kubeflow-org/ks-app/vendor/kubeflow/tf-serving/util.libsonnet @@ -0,0 +1,25 @@ +// Some useful routines. +{ + // Convert a string to upper case. + upper:: function(x) { + local cp(c) = std.codepoint(c), + local upLetter(c) = if cp(c) >= 97 && cp(c) < 123 then + std.char(cp(c) - 32) + else c, + result:: std.join("", std.map(upLetter, std.stringChars(x))), + }.result, + + // Convert non-boolean types like string,number to a boolean. + // This is primarily intended for dealing with parameters that should be booleans. + toBool:: function(x) { + result:: + if std.type(x) == "boolean" then + x + else if std.type(x) == "string" then + $.upper(x) == "TRUE" + else if std.type(x) == "number" then + x != 0 + else + false, + }.result, +} diff --git a/dev-kubeflow-org/recreate_app.sh b/dev-kubeflow-org/recreate_app.sh index 2c71b246f..1e4101262 100755 --- a/dev-kubeflow-org/recreate_app.sh +++ b/dev-kubeflow-org/recreate_app.sh @@ -14,6 +14,7 @@ NAMESPACE=kubeflow # For a list of releases refer to: # https://github.com/kubeflow/kubeflow/releases VERSION=master +API_VERSION=v1.7.0 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -36,7 +37,7 @@ if [ -d ${DIR}/${APP_NAME} ]; then fi fi -ks init ${APP_NAME} +ks init ${APP_NAME} --api-spec=version:${API_VERSION} cd ${APP_NAME} ks env set default --namespace ${NAMESPACE} @@ -94,6 +95,8 @@ ks param set kubeflow-core usageId ${USAGE_ID} # summarization model data ks param set kubeflow-core disks github-issues-data --env=default +# Enable a PVC backed by the default StorageClass +ks param set kubeflow-core jupyterNotebookPVCMount /home/jovyan # Checkout files that are manually created from the master branch. # Since we restore params.libsonnet we restore all values of params @@ -104,4 +107,6 @@ git checkout ${repo_name} components/${f} done -# TODO(jlewi): We should run autoformat. +# Run autoformat from the git root +cd ${DIR}/.. +bash <(curl -s https://raw.githubusercontent.com/kubeflow/kubeflow/${VERSION}/scripts/autoformat_jsonnet.sh)