Skip to content

Commit

Permalink
[Format] Format yaml files that will be automated (#3958)
Browse files Browse the repository at this point in the history
* [Format] Format yaml files that will be automated

* Fix formatting

* Add a top level script

* Fix formatting
  • Loading branch information
Bobgy authored Jun 11, 2020
1 parent 4812d35 commit 3cf36cd
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 138 deletions.
23 changes: 23 additions & 0 deletions hack/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -ex

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"
REPO_ROOT="$DIR/.."

"$REPO_ROOT/manifests/gcp_marketplace/hack/format.sh"
"$REPO_ROOT/manifests/kustomize/hack/format.sh"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ metadata:
annotations:
kubernetes-engine.cloud.google.com/icon: >-
data:image/png;base64,{{ .Files.Get "logo.png" | b64enc }}
marketplace.cloud.google.com/deploy-info: '{"partner_id": "google-cloud-ai-platform", "product_id": "kubeflow-pipelines", "partner_name": "Google Cloud AI Platform"}'
marketplace.cloud.google.com/deploy-info: '{"partner_id": "google-cloud-ai-platform",
"product_id": "kubeflow-pipelines", "partner_name": "Google Cloud AI Platform"}'
labels:
app.kubernetes.io/name: "{{ .Release.Name }}"
spec:
Expand All @@ -16,36 +17,34 @@ spec:
description: |-
Reusable end-to-end ML workflow
maintainers:
- name: Google Cloud AI Platform
url: https://cloud.google.com/ai-platform/
- name: Kubeflow Pipelines
url: https://github.com/kubeflow/pipelines
- name: Google Cloud AI Platform
url: https://cloud.google.com/ai-platform/
- name: Kubeflow Pipelines
url: https://github.com/kubeflow/pipelines
links:
- description: 'Kubeflow Pipelines Documentation'
url: https://www.kubeflow.org/docs/pipelines/
- description: 'Kubeflow Pipelines Documentation'
url: https://www.kubeflow.org/docs/pipelines/
notes: |-
Please go to [Hosted Kubeflow Pipelines Console](https://console.cloud.google.com/ai-platform/pipelines/clusters).
info:
- name: Application Namespace
value: "{{ .Release.Namespace }}"
- name: Console
value: 'https://console.cloud.google.com/ai-platform/pipelines/clusters'
- name: Application Namespace
value: "{{ .Release.Namespace }}"
- name: Console
value: 'https://console.cloud.google.com/ai-platform/pipelines/clusters'
componentKinds:
- group: v1
kind: ServiceAccount
- group: rbac.authorization.k8s.io/v1
kind: Role
- group: rbac.authorization.k8s.io/v1
kind: RoleBinding
- group: v1
kind: Service
- group: v1
kind: PersistentVolumeClaim
- group: v1
kind: ConfigMap
- group: v1
kind: Secret
- group: apps/v1
kind: Deployment

- group: v1
kind: ServiceAccount
- group: rbac.authorization.k8s.io/v1
kind: Role
- group: rbac.authorization.k8s.io/v1
kind: RoleBinding
- group: v1
kind: Service
- group: v1
kind: PersistentVolumeClaim
- group: v1
kind: ConfigMap
- group: v1
kind: Secret
- group: apps/v1
kind: Deployment
29 changes: 29 additions & 0 deletions manifests/gcp_marketplace/hack/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -ex

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"

echo "This formatting script uses yq, it can be downloaded at https://github.com/mikefarah/yq/releases/tag/3.3.0"
function format_yaml {
local path=$1
local tmp=$(mktemp)
yq r "$path" > "$tmp"
cp "$tmp" "$path"
}
format_yaml "$DIR/../schema.yaml"
format_yaml "$DIR/../chart/kubeflow-pipelines/templates/application.yaml"
23 changes: 10 additions & 13 deletions manifests/gcp_marketplace/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ x-google-marketplace:
releaseNote: >-
Based on 0.5.1 version.
releaseTypes:
- Feature
- Feature
recommended: false
managedUpdates:
kalmSupported: false
Expand Down Expand Up @@ -87,12 +87,12 @@ x-google-marketplace:
type: FULL
deployerServiceAccount:
roles:
- type: ClusterRole # This is a cluster-wide ClusterRole
rulesType: CUSTOM # We specify our own custom RBAC roles
rules:
- apiGroups: ['apiextensions.k8s.io', 'rbac.authorization.k8s.io']
resources: ['customresourcedefinitions', 'clusterroles', 'clusterrolebindings']
verbs: ['*']
- type: ClusterRole # This is a cluster-wide ClusterRole
rulesType: CUSTOM # We specify our own custom RBAC roles
rules:
- apiGroups: ['apiextensions.k8s.io', 'rbac.authorization.k8s.io']
resources: ['customresourcedefinitions', 'clusterroles', 'clusterrolebindings']
verbs: ['*']
clusterConstraints:
resources:
- replicas: 3
Expand All @@ -105,8 +105,7 @@ x-google-marketplace:
gcp:
nodes:
requiredOauthScopes:
- https://www.googleapis.com/auth/cloud-platform

- https://www.googleapis.com/auth/cloud-platform
properties:
name:
type: string
Expand Down Expand Up @@ -161,8 +160,6 @@ properties:
If the prefix specified is same as an old deployment in the past,
the deployment will recover from an old deployment.
If this not specified, the app instance name will be used.
required:
- name
- namespace

- name
- namespace
181 changes: 87 additions & 94 deletions manifests/kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- application
- argo
Expand All @@ -9,103 +8,97 @@ bases:
- mysql
- cache
- cache-deployer

resources:
- pipeline-application.yaml

- pipeline-application.yaml
images:
- name: gcr.io/ml-pipeline/api-server
newTag: 0.5.1
- name: gcr.io/ml-pipeline/persistenceagent
newTag: 0.5.1
- name: gcr.io/ml-pipeline/scheduledworkflow
newTag: 0.5.1
- name: gcr.io/ml-pipeline/frontend
newTag: 0.5.1
- name: gcr.io/ml-pipeline/viewer-crd-controller
newTag: 0.5.1
- name: gcr.io/ml-pipeline/visualization-server
newTag: 0.5.1
- name: gcr.io/ml-pipeline/metadata-writer
newTag: 0.5.1
- name: gcr.io/ml-pipeline/cache-server
newTag: 0.5.1
- name: gcr.io/ml-pipeline/cache-deployer
newTag: 0.5.1

- name: gcr.io/ml-pipeline/api-server
newTag: 0.5.1
- name: gcr.io/ml-pipeline/persistenceagent
newTag: 0.5.1
- name: gcr.io/ml-pipeline/scheduledworkflow
newTag: 0.5.1
- name: gcr.io/ml-pipeline/frontend
newTag: 0.5.1
- name: gcr.io/ml-pipeline/viewer-crd-controller
newTag: 0.5.1
- name: gcr.io/ml-pipeline/visualization-server
newTag: 0.5.1
- name: gcr.io/ml-pipeline/metadata-writer
newTag: 0.5.1
- name: gcr.io/ml-pipeline/cache-server
newTag: 0.5.1
- name: gcr.io/ml-pipeline/cache-deployer
newTag: 0.5.1
# Used by Kustomize
configMapGenerator:
- name: pipeline-install-config
env: params.env

- name: pipeline-install-config
env: params.env
secretGenerator:
- name: mysql-secret
env: params-db-secret.env

- name: mysql-secret
env: params-db-secret.env
vars:
- name: NAMESPACE
objref:
kind: Deployment
apiVersion: apps/v1
name: ml-pipeline
fieldref:
fieldpath: metadata.namespace
- name: APP_NAME
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.appName
- name: APP_VERSION
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.appVersion
- name: DBSERVICE_HOST
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.dbHost
- name: DBSERVICE_PORT
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.dbPort
- name: DBNAME_MLMD
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.mlmdDb
- name: DBNAME_CACHE
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.cacheDb
- name: DBNAME_PIPELINE
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.pipelineDb
- name: BUCKET_NAME
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.bucketName

- name: NAMESPACE
objref:
kind: Deployment
apiVersion: apps/v1
name: ml-pipeline
fieldref:
fieldpath: metadata.namespace
- name: APP_NAME
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.appName
- name: APP_VERSION
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.appVersion
- name: DBSERVICE_HOST
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.dbHost
- name: DBSERVICE_PORT
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.dbPort
- name: DBNAME_MLMD
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.mlmdDb
- name: DBNAME_CACHE
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.cacheDb
- name: DBNAME_PIPELINE
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.pipelineDb
- name: BUCKET_NAME
objref:
kind: ConfigMap
name: pipeline-install-config
apiVersion: v1
fieldref:
fieldpath: data.bucketName
configurations:
- params.yaml
- params.yaml
2 changes: 0 additions & 2 deletions manifests/kustomize/env/gcp/inverse-proxy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

images:
- name: gcr.io/ml-pipeline/inverse-proxy-agent
newTag: 0.5.1

resources:
- proxy-configmap.yaml
- proxy-deployment.yaml
Expand Down
Loading

0 comments on commit 3cf36cd

Please sign in to comment.