Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proposal] Move ArtifactType -> artifact.type, BuildConfig.BuildType -> build.location #1203

Closed
balopat opened this issue Oct 25, 2018 · 2 comments

Comments

@balopat
Copy link
Contributor

balopat commented Oct 25, 2018

Background

We have three places in our pipeline config where we use "inline oneOf" fields currently: BuildConfig.BuildType, DeployConfig.DeployType, Artifact.ArtifactType They are "oneOf" fields - our DIY "union types" - choices are represented as fields and we validate against multiple choices runtime. They are "inline" as these "choice fields" become part of the parent element.

e.g.:

apiVersion: skaffold/v1alpha4
kind: Config
build:
  artifacts:
  - image: gcr.io/k8s-skaffold/skaffold-example
    docker:
        target: "mytarget"
        cacheFrom:
          - "baseimage1"
          - "baseimage2"
  kaniko:
    buildContext: 
      localDir: {}
    pullSecretName: e2esecret
    namespace: default

Problem

Out of these BuildConfig.BuildType and Artifact.ArtifactType are mixed in with other properties. For example Artifact.Image, Artifact.Sync, Artifact.Context, which becomes confusing when used in an IntelliSense context:

image

Proposal

1.) Move ArtifactType to a non-inline field: artifact.type:

image

image

2.) Move BuildConfig.BuildType under build.location
This would also help with resolving some of the readability arguments in

#1179
#955
#953

@balopat
Copy link
Contributor Author

balopat commented Oct 25, 2018

After chatting with @r2d4 - this would be a deviation from the k8s pattern.

Here's the K8S API guidance for unions:
https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#unions

And the example of Volume.VolumeSource fields happily mixed with the name field on Volume:
https://kubernetes.io/docs/concepts/storage/volumes#emptydir
https://github.com/kubernetes/api/blob/master/core/v1/types.go#L44

@balopat
Copy link
Contributor Author

balopat commented Oct 29, 2018

After some discussions within the team I'll close this. If someone feels strongly about this please reopen/comment.

@balopat balopat closed this as completed Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant