From e6909decb25e2420c57aa650ac5d4e9e588b8938 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Fri, 15 Jun 2018 19:18:18 +0000 Subject: [PATCH] Update from build repo. It seems that the version of the code we have vendored got out of sync with the version we were installing. This led to a mismatch in the conditions we look for on the build, and as a result made successful builds result in Revision failures. Fixes: https://github.com/knative/serving/issues/1214 --- Gopkg.lock | 4 +- Gopkg.toml | 4 +- third_party/config/build/release.yaml | 153 +++++++++++++++--- .../build/v1alpha1/build_template_types.go | 13 ++ .../pkg/apis/build/v1alpha1/build_types.go | 13 ++ 5 files changed, 162 insertions(+), 25 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index eb1d0377e03d..f8c869bdb16e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -342,7 +342,7 @@ "pkg/client/informers/externalversions/internalinterfaces", "pkg/client/listers/build/v1alpha1" ] - revision = "8624fda54557ac4461d35921765b7bf48e5aba6d" + revision = "5127da35831f0c56d234e23ff087e9caf77d75e7" [[projects]] name = "github.com/magiconair/properties" @@ -953,6 +953,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "1577ac66c930a057af55991e718ed2034acf607a5a567e867263d4dd9f355394" + inputs-digest = "edd4655990f9e22d6adeebd339be0d4710134ee1c2f62f0cffbe8dbbeb3010f9" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 348b41b842ef..ddcc3d096b33 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -50,8 +50,8 @@ required = [ [[constraint]] name = "github.com/knative/build" - # HEAD as of 2018-06-05 - revision = "8624fda54557ac4461d35921765b7bf48e5aba6d" + # HEAD as of 2018-06-15 + revision = "5127da35831f0c56d234e23ff087e9caf77d75e7" [[constraint]] name = "github.com/google/go-containerregistry" diff --git a/third_party/config/build/release.yaml b/third_party/config/build/release.yaml index b898ba1355d2..3ded55bcab70 100644 --- a/third_party/config/build/release.yaml +++ b/third_party/config/build/release.yaml @@ -1,55 +1,166 @@ +--- apiVersion: v1 kind: Namespace -metadata: {name: build-system} - +metadata: + name: build-system --- apiVersion: v1 kind: ServiceAccount -metadata: {name: build-controller, namespace: build-system} - +metadata: + name: build-controller + namespace: build-system --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding -metadata: {name: build-controller-admin} -roleRef: {apiGroup: rbac.authorization.k8s.io, kind: ClusterRole, name: cluster-admin} +metadata: + name: build-controller-admin +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin subjects: -- {kind: ServiceAccount, name: build-controller, namespace: build-system} - +- kind: ServiceAccount + name: build-controller + namespace: build-system --- apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition -metadata: {name: builds.build.dev} +metadata: + name: builds.build.dev spec: group: build.dev - names: {kind: Build, plural: builds} + names: + kind: Build + plural: builds scope: Namespaced version: v1alpha1 - --- apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition -metadata: {name: buildtemplates.build.dev} +metadata: + name: buildtemplates.build.dev spec: group: build.dev - names: {kind: BuildTemplate, plural: buildtemplates} + names: + kind: BuildTemplate + plural: buildtemplates scope: Namespaced version: v1alpha1 - +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: build-controller + name: build-controller + namespace: build-system +spec: + ports: + - name: metrics + port: 9090 + protocol: TCP + targetPort: 9090 + selector: + app: build-controller +--- +apiVersion: v1 +kind: Service +metadata: + labels: + role: build-webhook + name: build-webhook + namespace: build-system +spec: + ports: + - port: 443 + targetPort: 443 + selector: + role: build-webhook +--- +apiVersion: v1 +data: + loglevel.autoscaler: info + loglevel.controller: info + loglevel.queueproxy: info + loglevel.webhook: info + zap-logger-config: | + { + "level": "info", + "development": false, + "sampling": { + "initial": 100, + "thereafter": 100 + }, + "outputPaths": ["stdout"], + "errorOutputPaths": ["stderr"], + "encoding": "json", + "encoderConfig": { + "timeKey": "", + "levelKey": "level", + "nameKey": "logger", + "callerKey": "caller", + "messageKey": "msg", + "stacktraceKey": "stacktrace", + "lineEnding": "", + "levelEncoder": "", + "timeEncoder": "", + "durationEncoder": "", + "callerEncoder": "" + } + } +kind: ConfigMap +metadata: + name: config-logging + namespace: build-system --- apiVersion: apps/v1beta1 kind: Deployment -metadata: {name: build-controller, namespace: build-system} +metadata: + name: build-controller + namespace: build-system spec: replicas: 1 template: metadata: - labels: {app: build-controller} + labels: + app: build-controller spec: containers: - - args: [-builder, cluster, -logtostderr, -stderrthreshold, INFO, -creds-image, - 'gcr.io/build-crd/github.com/elafros/build/cmd/creds-init@sha256:a7281d37ea08587680eda1cca0b5f48e16ed59e77de43c6b3239c7ff0806a97c', - -git-image, 'gcr.io/build-crd/github.com/elafros/build/cmd/git-init@sha256:735823a7f88556f33530ca56326cb0828aae0ce98ccb113750655afaaed4c241'] - image: gcr.io/build-crd/github.com/elafros/build/cmd/controller@sha256:0af871213dee2df6afd2ace310acaa9c1ceacb192a2e6cf64eaff37f01b327cd + - args: + - -builder + - cluster + - -logtostderr + - -stderrthreshold + - INFO + - -creds-image + - gcr.io/build-crd/github.com/knative/build/cmd/creds-init@sha256:30eaef209dc037dd79f79009792caab5fb2991aa728e9c1cfd41c737ad649b4d + - -git-image + - gcr.io/build-crd/github.com/knative/build/cmd/git-init@sha256:f92f04e37a6960fc588caa4f94f01e43277766edc0284ce3c1f73988f7162c15 + image: gcr.io/build-crd/github.com/knative/build/cmd/controller@sha256:4478d5bb35930021ade5bf68012bc715a8b6fff28e47df535a22f2d303a6c277 name: build-controller serviceAccountName: build-controller - +--- +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: build-webhook + namespace: build-system +spec: + replicas: 1 + template: + metadata: + labels: + app: build-webhook + role: build-webhook + spec: + containers: + - image: gcr.io/build-crd/github.com/knative/build/cmd/webhook@sha256:b8af5e463fdac66b0443bceb797c38b8a00c5e424e781d425f351bf176cf07ad + name: build-webhook + volumeMounts: + - mountPath: /etc/config-logging + name: config-logging + serviceAccountName: build-controller + volumes: + - configMap: + name: config-logging + name: config-logging diff --git a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go index 64b644214087..69bf3c05359d 100644 --- a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go +++ b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_template_types.go @@ -17,6 +17,8 @@ limitations under the License. package v1alpha1 import ( + "encoding/json" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -34,6 +36,13 @@ type BuildTemplate struct { } type BuildTemplateSpec struct { + // TODO: Generation does not work correctly with CRD. They are scrubbed + // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) + // So, we add Generation here. Once that gets fixed, remove this and use + // ObjectMeta.Generation instead. + // +optional + Generation int64 `json:"generation,omitempty"` + // Parameters defines the parameters that can be populated in a template. Parameters []ParameterSpec `json:"parameters,omitempty"` Steps []corev1.Container `json:"steps"` @@ -116,3 +125,7 @@ func (b *BuildTemplateStatus) RemoveCondition(t BuildTemplateConditionType) { } b.Conditions = conditions } + +func (bt *BuildTemplate) GetGeneration() int64 { return bt.Spec.Generation } +func (bt *BuildTemplate) SetGeneration(generation int64) { bt.Spec.Generation = generation } +func (bt *BuildTemplate) GetSpecJSON() ([]byte, error) { return json.Marshal(bt.Spec) } diff --git a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go index 52ff1ae7776a..68027c758fcf 100644 --- a/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go +++ b/vendor/github.com/knative/build/pkg/apis/build/v1alpha1/build_types.go @@ -17,6 +17,8 @@ limitations under the License. package v1alpha1 import ( + "encoding/json" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -36,6 +38,13 @@ type Build struct { // BuildSpec is the spec for a Build resource type BuildSpec struct { + // TODO: Generation does not work correctly with CRD. They are scrubbed + // by the APIserver (https://github.com/kubernetes/kubernetes/issues/58778) + // So, we add Generation here. Once that gets fixed, remove this and use + // ObjectMeta.Generation instead. + // +optional + Generation int64 `json:"generation,omitempty"` + Source *SourceSpec `json:"source,omitempty"` Steps []corev1.Container `json:"steps,omitempty"` @@ -208,3 +217,7 @@ func (b *BuildStatus) RemoveCondition(t BuildConditionType) { } b.Conditions = conditions } + +func (b *Build) GetGeneration() int64 { return b.Spec.Generation } +func (b *Build) SetGeneration(generation int64) { b.Spec.Generation = generation } +func (b *Build) GetSpecJSON() ([]byte, error) { return json.Marshal(b.Spec) }