Commit Graph

197 Commits

Author SHA1 Message Date
Tim Hockin
7afaf23b01
Copy make's codegen logic to update-codegen.sh
The `make` rules which auto-generate some of our API stuff are
incredibly baroque, and hard to maintain.  They were originally added on
the assumption that we would stop checking generated files into git.
Since then we have moved away from that goal, and the worst problems
with generated files have been resolved.

Reasons to kill this:
* It is slow on every build, as opposed to just being slow when running
  the generators.  It is even slow to calculate that there's nothing to
  update.
* Most development work doesn't involve changing APIs.
* It only covers about half (or less) of the generated code, and making
  it cover more would be even slower.
* Approximately 1 person knows how this all works.
* We have CI to make sure changes do not get merged without updating
  this code.
* We have corner cases where this does the WRONG thing and tracking
  those down is ugly and hard in perpetuity.

So this commit puts all the same logic that WAS in the
Makefile.generated_files into update-codegen.sh.

I do not love this script, especially WRT sub-packages, but I am trying
not to boil the ocean.  I hope to follow up with some more cleanups over
time.

I have tested this manually and with the scripts and it still seems to
catch errors properly.

This includes a change to kube::util::read-array to make it not unset
variables and not over-write non-array variables.
2022-10-04 08:48:39 -07:00
Davanum Srinivas
5fd6b0a980
Update instructions to install cfssl
Use the newer "go install" variant as we are above go 1.18

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-09-25 15:53:02 -04:00
ZeusPerez
ddec2a9125 Apply changes requested in the pull-kubernetes-verify failed check 2022-01-20 17:25:52 +01:00
ZeusPerez
5d52b4ef9a Add PATH when looking for executable locations 2022-01-06 19:03:47 +01:00
Markus Thömmes
671cd6c606 Make the docker buildx check call --help 2021-11-05 09:49:07 +01:00
Davanum Srinivas
f63dbd481f
Warn if docker buildx is not available
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-08-10 14:42:11 -04:00
Benjamin Elder
03576473ce don't search bazel output paths for binaries 2021-03-07 12:47:00 -08:00
Benjamin Elder
7f1c6740f7 suggest homebrew when bash is too old on macOS 2021-02-09 22:40:01 -08:00
Li Bo
bb150cdd4f change minimum bash version to 4.2 2021-01-26 20:12:58 +08:00
Davanum Srinivas
feecef7795
Ensure bash version at least 5.x
Co-authored-by: Stephen Augustus <justaugustus@users.noreply.github.com>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-01-22 13:08:53 -05:00
Kubernetes Prow Robot
3722cef5e5
Merge pull request #97947 from Haleygo/fix/replace-cfssl-resource
fix:replace cfssl resources and upgrade them to 1.5.0
2021-01-12 21:10:37 -08:00
Haleygo
b2796cea93 fix:replace cfssl resources and upgrade them to 1.5.0
Signed-off-by: Haleygo <hui.wang@daocloud.io>
2021-01-12 14:05:20 +08:00
Jesus Herrera
d8bedb3980 Remove docker remote/docker-machine from build scripts 2020-12-30 12:37:51 -05:00
knight42
00e4234cc9
fix: pass bearer token to curl using -H instead of --oauth2-bearer
The flag `--oauth2-bearer` might have no effect in some environment.

Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-11-05 01:15:19 +08:00
knight42
cfc2b330a7
refactor(apiserver): ignore the insecure flags
Leave the insecure flags intact but stop serving on insecure port.
2020-10-29 23:20:17 +08:00
Mike Danese
bdadb2a187 make kube::util::find-binary not dependent on bazel-out/ structure
Implement an aspect that outputs go_build_mode metadata for go binaries,
and use that during binary selection.
2020-09-11 13:19:38 -07:00
Mike Danese
5a72bb001f hack/lib/util.sh: some bash cleanups
* switched one spot to use kube::logging
* make kube::util::find-binary return an error when it doesn't find
  anything so that hack scripts fail fast instead of with '' binary not
  found errors.
  * this required deleting some genfeddoc stuff. the binary no longer
    exists in k/k repo since we removed federation/, and I don't see it
    in https://github.com/kubernetes-sigs/kubefed/ either. I'm assuming
    that it's gone for good now.
2020-09-11 13:19:37 -07:00
Haowei Cai
b71252a0ab add internal.apiserver.k8s.io/v1alpha1 to known gvs 2020-09-08 14:34:55 -07:00
Jordan Liggitt
d8b0f6fc50 Build code-generator tools directly 2020-08-02 10:56:46 -04:00
Anders Eknert
b423216a3b Presence of bearer token should cancel exec action
If a bearer token is present in a request, the exec credential plugin should accept that as the chosen method of authentication. Judging by an [earlier comment in exec.go](c18bc7e9f7/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go (L217)), this was already intended. This would however not work since UpdateTransportConfig would set the GetCert callback which would then get called by the transport, triggering the exec plugin action even with a token present in the request. See linked issue for further details.

See #87369 for further details.

Signed-off-by: Anders Eknert <anders.eknert@bisnode.com>
2020-07-02 12:12:32 +02:00
Xiang Dai
e09bc312cb *.sh: cleanup all white noise
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
2020-05-29 09:56:00 +08:00
Cecile Robert-Michon
7d6ba67da0
Update find-binary-for-platform to work with non-GNU versions of find 2020-05-01 16:19:00 -07:00
Claudiu Belu
6d3a18b0be test images: Image Promoter sed fix
The image used by the Image Promoter (gcr.io/k8s-testimages/gcb-docker-gcloud:v20190906-745fed4)
is based on busybox, and thus, the sed binary is actually busybox. image-util.sh calls
kube::util::ensure-gnu-sed several times, which ensures that a GNU sed binary exists
(it checks by greping GNU in its --help output). Obviously, it won't match the busybox sed
binary. But the sed usage in image-util.sh is fairly simple, and the busybox sed is sufficient.

This was previously fixed in: #87188, but it was reverted by #87653 as it was failing
on Mac (sed does not exist). This commit fixes that issue as well.
2020-02-18 19:58:35 -08:00
JieJhih Jhang
8bd9c994ca fix command variable exited with status 1 2020-01-30 12:52:09 +08:00
Claudiu Belu
4c51eb9063 test images: Image Promoter fixes
Prior to the Image Centralization part 4 (https://github.com/kubernetes/kubernetes/pull/81170),
a PR merged that enables the Image Promoter to run on the k/k test images.

The Image Promoter currently only builds the Conformance-related images, but the
Image Centralization part 4 centralized some of those images into agnhost, so they
need to be removed from the conformance_images list.

Additionally, https://github.com/kubernetes/kubernetes/pull/81226 proposes mounttest-user
image to be removed, and RunAsUser to be used in tests instead.

The image used by the Image Promoter (gcr.io/k8s-testimages/gcb-docker-gcloud:v20190906-745fed4)
is based on busybox, and thus, the sed binary is actually busybox. image-util.sh calls
kube::util::ensure-gnu-sed several times, which ensures that a GNU sed binary exists
(it checks by greping GNU in its --help output). Obviously, it won't match the busybox sed
binary. But the sed usage in image-util.sh is fairly simple, and the busybox sed is sufficient.

Bumps image versions for: jessie-dnsutils, nonewprivs, resource-consumer, sample-apiserver. These
images are included in the conformance_images that are being built by the Image Promoter, so
we're bumping them just to make sure we're not breaking anything and cause all the CIs to fall.
We're going to bump the image versions used in tests in a subsequent PR. The image version was not
bumped for: agnhost, kitten, nautilus, as they were already bumped by the Image Centralization part 4
PR.
2020-01-06 09:08:51 -08:00
howard
6ca5e0ed4d local-up-cluster kube-proxy terminated error
When using hack/local-up-cluster.sh deploy local cluster, it
failed with following message "kube-proxy terminated unexpectedly"
and "Failed to retrieve node info: nodes "127.0.0.1" not found" in
kube-proxy.log.

The root reason for this error is miss boot order of kubernetes
services in local-up-cluster.sh, kube-proxy and kubectl daemon.

When starting kube-proxy, it would check node information. And
these information are collected by kubelet daemon. However, in
the shell script, kube-proxy service start before kubelet daemon.

This patch changed the boot order of kubelet daemon and kube-proxy
and check if node stats ready for kube-proxy start.

Signed-off-by: Howard Zhang <howard.zhang@arm.com>
2019-09-16 10:36:42 +08:00
Davanum Srinivas
adbd1800c8 Drop cloud-controller-manager artifacts from k/k release 2019-08-06 13:51:27 -04:00
Benjamin Elder
4aaa7b4da2 document KUBE_ROOT in util.sh 2019-06-24 11:43:04 -07:00
Benjamin Elder
29b7b2c4f8 add kube::util::list_staging_repos 2019-06-24 11:43:04 -07:00
Benjamin Elder
7b0ea99a3e copy kube::release:md5 to kube::util::md5 2019-06-23 12:08:05 -07:00
Christoph Blecker
eaafa5952f
Don't use mapfile as it isn't bash 3 compatible 2019-05-06 15:55:12 -07:00
Jordan Liggitt
2ea3cbdcbc Update hack scripts to use go mod 2019-04-03 10:19:39 -04:00
Jordan Liggitt
7f246d461b Remove third_party/forked/godep 2019-04-03 10:19:39 -04:00
Ismo Puustinen
ecb6d13253 hack/lib/util.sh: fix empty array expansion with bash 3. 2019-03-05 21:34:08 +02:00
Ismo Puustinen
1e34d9df7d hack/lib/util.sh: replace sed with bash replace.
Test script:

  #!/bin/bash

  rev1="foo"
  rev2="\"bar\""
  rev3="'bar'"

  newrev1="${rev1//[\'\"]}"
  newrev2="${rev2//[\'\"]}"
  newrev3="${rev3//[\'\"]}"

  oldrev1=$(echo "${rev1}" | sed "s/['\"]//g")
  oldrev2=$(echo "${rev2}" | sed "s/['\"]//g")
  oldrev3=$(echo "${rev3}" | sed "s/['\"]//g")

  echo "$newrev1 vs. $oldrev1"
  echo "$newrev2 vs. $oldrev2"
  echo "$newrev3 vs. $oldrev3"

expected output:

  foo vs. foo
  bar vs. bar
  bar vs. bar
2019-03-04 23:23:20 +02:00
Ismo Puustinen
0078fce5bd hack/lib/util.sh: don't implicitly convert "find" results into array.
Also fix array item comparison. Test script for the comparison change:

  #!/bin/bash

  staging_apis=(extensions/v1beta1 extensions/v1 extensions/v1alpha)
  group_versions=(v1 extensions/v1beta1 extensions/v1 extensions.k8s.io/v1)

  for group_version in ${group_versions[@]}; do
    # original code
    if [[ " ${staging_apis[@]} " =~ " ${group_version/.*k8s.io/} " ]]; then
      echo "orig: vendor/k8s.io/api/${group_version/.*k8s.io/}"
    fi
    # new code
    for api in ${staging_apis[@]}; do
      if [[ "${api}" = "${group_version/.*k8s.io/}" ]]; then
        echo "new: vendor/k8s.io/api/${group_version/.*k8s.io/}"
      fi
    done
  done

Expected output:

  orig: vendor/k8s.io/api/extensions/v1beta1
  new: vendor/k8s.io/api/extensions/v1beta1
  orig: vendor/k8s.io/api/extensions/v1
  new: vendor/k8s.io/api/extensions/v1
  orig: vendor/k8s.io/api/extensions/v1
  new: vendor/k8s.io/api/extensions/v1
2019-03-04 23:23:20 +02:00
Ismo Puustinen
edd806330a hack/lib/util.sh: mark variables to be used in a sourcing context.
"Decorate" the variables with a no-op function to prevent shellcheck
from complaining that they are not being used. This method provides
visibility to which variables are supposed to be used in a sourcing
script compared to just disabling the warning.
2019-03-04 23:23:20 +02:00
Ismo Puustinen
24b5c67723 hack/lib/util.sh: various shellcheck-reported cleanups.
Use "command -v" instead of "which".  Also remove the redirections,
since "command -v" does not return an error message if the command isn't
found. Also use "read -r" instead of "read" and quote variables
properly. Do some error handling if "pushd" or "popd" fail. Read values
properly into arrays.

However, one shellcheck error is ignored in trap mechanism.  The logic
in trap_add function requires the trap command to be expanded when run.
Just storing the variable into trap doesn't work. Add a shellcheck
disable directive to ignore the error.

An alternative to ignoring could be tricking shellcheck with:

  trap ''"${new_cmd}" "${trap_add_name}"
2019-03-04 23:18:54 +02:00
Dr. Stefan Schimanski
2393799e2e hack/update-openapi-spec.sh: normalize indention of spec through jq 2019-02-11 13:16:36 +01:00
Kubernetes Prow Robot
92db54cc53
Merge pull request #73335 from oomichi/cleanup-hack
Add check-file-in-alphabetical-order for cleanup
2019-02-07 18:24:41 -08:00
Bin Lu
44a36ea36e Bug fix: ./hack/local-up-cluster.sh is not work on Arm64 platform
Signed-off-by: Bin Lu <bin.lu@arm.com>
2019-01-30 09:49:46 +08:00
Kenichi Omichi
c32d1acbb9 Add check-file-in-alphabetical-order for cleanup
Both verify-golint.sh and verify-shellcheck.sh have the same logic
which checks failure_file in alphabetical order.
In addition, we'd like to add another script which requires the
same logic. So this add a common function for cleanup.
2019-01-26 02:09:06 +00:00
Lubomir I. Ivanov
54e8d73920 docs: stop tracking placeholder documentation
The placeholder documentation introduces a couple of problems:
- it complicates the contributor-experience (forces the CI to run
N times before the contributor finds out that they need to call an .sh
script and include certain files from docs/)
- it forces CLI related pull requests for tools like kubeadm and kubectl
to require top level approval from docs/OWNERS as such PRs still need
to touch the .generated_docs file

Stop tracking the placeholder documentation by applying the
following actions:
- remove the utility set-placeholder-gen-docs()
- make verify-generated-docs.sh only generate in a temporary folder
and not match .generated_docs
- mark generate-docs.sh as an alias for update-generated-docs.sh
- remove all current placeholder files in docs folders admin, man,
user-guide, yaml
- ignore the above folders and .generated_docs in a .gitignore file
2019-01-26 01:07:10 +02:00
Roy Lenferink
b18bc2ea79 Improved some more bash script variable definitions 2019-01-21 23:11:58 +01:00
Kubernetes Prow Robot
4a6ac500fb
Merge pull request #72807 from dixudx/hack_host_arch
add method to get host os/arch in hack scripts
2019-01-17 13:51:24 -08:00
Di Xu
88740dfb9e add method to get host os/arch in hack scripts 2019-01-17 23:44:58 +08:00
Jordan Liggitt
9229399bd6 Remove build/verify scripts for swagger 1.2 API docs, API server swagger ui / swagger 1.2 config 2019-01-15 13:33:06 -05:00
Sen Lu
d6801b8211 Diff between PULL_BASE_SHA and HEAD when detecting file changes from
Prow
2019-01-08 11:17:00 -08:00
Christoph Blecker
b1aae87327
Don't use hermetic go environment for installing godep
This is unneeded, and causes this build environment to persist throughout the lifetime of any godep script.
2018-11-28 16:31:25 -08:00
Christoph Blecker
35cdbdf16c
Use ensured godep instead of relying on PATH 2018-11-07 11:02:01 -08:00