Kenchu123 commented on a change in pull request #788: URL: https://github.com/apache/submarine/pull/788#discussion_r743576678
########## File path: submarine-cloud-v2/artifacts/submarine/submarine-database.yaml ########## @@ -0,0 +1,77 @@ +--- +# Source: submarine/templates/submarine-database.yaml +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +# Source: submarine/templates/submarine-database.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: submarine-database-pvc +spec: + accessModes: + - ReadWriteOnce + storageClassName: submarine-storageclass + resources: + requests: + storage: 1Gi +--- +# Source: submarine/templates/submarine-database.yaml +apiVersion: v1 +kind: Service +metadata: + name: "submarine-database" +spec: + ports: + - name: "submarine-database" + port: 3306 + targetPort: 3306 + selector: + app: "submarine-database" +--- +# Source: submarine/templates/submarine-database.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "submarine-database" +spec: + replicas: 1 + selector: + matchLabels: + app: "submarine-database" + template: + metadata: + labels: + app: "submarine-database" + + spec: + containers: + - name: "submarine-database" + image: "apache/submarine:database-0.7.0-SNAPSHOT" + imagePullPolicy: "IfNotPresent" + ports: + - containerPort: 3306 + env: + - name: MYSQL_ROOT_PASSWORD + value: "password" + volumeMounts: + - mountPath: /var/lib/mysql + name: volume + subPath: submarine-database Review comment: @MortalHappiness I had added it. Thanks. ########## File path: submarine-cloud-v2/pkg/controller/parser.go ########## @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +package controller + +import ( + "encoding/json" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/pkg/errors" + traefikv1alpha1 "github.com/traefik/traefik/v2/pkg/provider/kubernetes/crd/traefik/v1alpha1" + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/api/core/v1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/util/yaml" +) + +// PathToOSFile gets the absolute path from relative path. +func pathToOSFile(relativePath string) (*os.File, error) { + path, err := filepath.Abs(relativePath) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("failed generate absolute file path of %s", relativePath)) + } + + manifest, err := os.Open(path) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("failed to open file %s", path)) + } + + return manifest, nil +} Review comment: @MortalHappiness I have found out that the function name is right, which the function turns the `path` into the type of `*os.File`. Hence, I modified the comment just now. Thanks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
