forked from kubermatic/kubermatic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-codegen.sh
executable file
·69 lines (54 loc) · 2.19 KB
/
update-codegen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
# Copyright 2020 The Kubermatic Kubernetes Platform contributors.
#
# 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 -euo pipefail
cd $(dirname $0)/..
source hack/lib.sh
CONTAINERIZE_IMAGE=golang:1.15.1 containerize ./hack/update-codegen.sh
echodate "Creating vendor directory"
go mod vendor
chmod +x vendor/k8s.io/code-generator/generate-groups.sh
echodate "Removing old clients"
rm -rf "pkg/crd/client"
echo "" > /tmp/headerfile
# -trimpath would cause the code generation to fail, so undo the
# Makefile's value and also force mod=readonly here
export "GOFLAGS=-mod=readonly"
echodate "Generating kubermatic:v1"
./vendor/k8s.io/code-generator/generate-groups.sh all \
k8c.io/kubermatic/v2/pkg/crd/client \
k8c.io/kubermatic/v2/pkg/crd \
"kubermatic:v1" \
--go-header-file /tmp/headerfile
echodate "Generating operator:v1alpha1"
./vendor/k8s.io/code-generator/generate-groups.sh deepcopy,lister,informer \
k8c.io/kubermatic/v2/pkg/crd/client \
k8c.io/kubermatic/v2/pkg/crd \
"operator:v1alpha1" \
--go-header-file /tmp/headerfile
# Temporary fixes due to: https://github.com/kubernetes/kubernetes/issues/71655
GENERIC_FILE="v2/pkg/crd/client/informers/externalversions/generic.go"
sed -i s/usersshkeys/usersshkeies/g ${GENERIC_FILE}
echodate "Generating deepcopy funcs for other packages"
go run k8s.io/code-generator/cmd/deepcopy-gen \
--input-dirs k8c.io/kubermatic/v2/pkg/semver \
-O zz_generated.deepcopy \
--go-header-file /tmp/headerfile
# move files into their correct location, generate-groups.sh does not handle
# non-v1 module names very well
cp -r v2/* .
rm -rf v2/
rm /tmp/headerfile
echodate "Generating reconciling functions"
go generate pkg/resources/reconciling/ensure.go