Skip to content

Commit c3c3be7

Browse files
AnchorArrayDiego Rodriguezsenthilrch
authored
aberg/DEVOPS 247 (#3)
* Move custom resource definitions to crds directory * modified travis build conditions * Initial commit for v0.8.0 * Bumped up versions of go, alpine, operator sdk, docker, cri-tool * upgrade go in travis ci * update dependencies * code changes for upgraded dependencies * fix unit tests * make release-amd64 to build all 4 amd64 images * v1alpha1 -> v1alpha2, kubefledged.k8s.io -> kubefledged.io * ignore build binaries * add labels to manifests * updates to imagecache manifest * update apigroup apiversion in validatingwebhook * issue senthilrch#70 deploy-using-yaml: wait for webhook-server running * issue senthilrch#66: upgrade crd api version to v1 * updates to helm chart & operator * update clusterrole to list and watch * update signer name in csr * remove v1alpha1 cr * issue senthilrch#70 add init container to wait for webhook-server * helm chart fix webhook service name * helm chart update * fix chart apiVersion * updated readme for helm chart installation * updated name of helm operator cr * fix issue senthilrch#75: workaround * Ensure validating webhook configuration client config service name for the webhook server mataches the correct webhook service name * Ensure validating webhook configuration client config service name for the webhook server mataches the correct webhook service name * add init option to webhook server * update manifests * updated helm chart * updated makefile and manifests * updated helm operator * makefile wait for operator ready * get imagecache before updating status * pre-install hook for validatingwebhookconfiguration * fix golint errors * modify refresh/purge annotation key to kubefledged.io/xxx * cri-client-image name as env instead of cmd flag * read busybox image from env * use busybox image from gcr.io to overcome dockerhub ratelimiting * fix issue senthilrch#89 change hostpath filetype to socket * delete pre-install hook in "make remove-operator-and-kubefledged" * add annotations to validatingwebhookconfiguration * add "helm repo update" to readme * continue processing job deletion when not found * check if refresh-cache annotation exists * add "helm repo update" to readme * update helm chart to use release namespace * update design proposal document * expose helm parameters in operator CR * document helm parameters * update release version to v0.8.2 * set status to known when unable to fetch pod * add check for image pull/delete status unknown * update log messages * deploy controller and operator to same namespace * fix unit test errors * restore Kubefledged CR during "remove-operator-and-kubefledged" * Update README.md * Update README.md * Update design-proposal.md * Update README.md Co-authored-by: Diego Rodriguez <[email protected]> Co-authored-by: Senthil Raja Chermapandian <[email protected]>
1 parent 59d4c2c commit c3c3be7

File tree

85 files changed

+2210
-1328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2210
-1328
lines changed

.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# ignore build output
2-
build/fledged
3-
build/fledged-latest.tar.gz
2+
build/kubefledged-controller
3+
build/kubefledged-webhook-server
4+
scp.sh
5+
coverage.out

.travis.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dist: bionic
22
language: go
33
go:
4-
- 1.14.2
4+
- 1.16.4
55
services:
66
- docker
77
env:
@@ -12,22 +12,23 @@ before_install:
1212
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
1313
- sudo apt-get remove docker docker-engine docker.io containerd runc
1414
- sudo apt-get update
15-
- sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
15+
- sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
1616
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
1717
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
18+
- sudo apt-get update
1819
- sudo apt-get install docker-ce docker-ce-cli containerd.io -y
1920
install:
2021
# Install dependencies required for unit test coverage
2122
- go get golang.org/x/tools/cmd/cover
2223
- go get github.com/mattn/goveralls
2324
- go get -u golang.org/x/lint/golint
2425
stages:
25-
# This stage builds controller and webhook-server images, performs tests in "hack" and runs unit tests with coverage
26+
# This stage builds all four amd64 images, performs tests in "hack" and runs unit tests with coverage
2627
- name: build_amd64
27-
if: type = push
28+
if: (type = push AND branch = develop) or (type = pull_request)
2829
# This stage builds all four multi-arch images and pushes them to docker hub (only for PR builds)
2930
- name: build_multiarch
30-
if: type = pull_request
31+
if: type = push and branch = master
3132
# This stage is a placeholder for future (only for release tags)
3233
- name: build_release
3334
if: tag IS present
@@ -40,15 +41,16 @@ jobs:
4041
- hack/verify-gofmt.sh
4142
- hack/verify-golint.sh
4243
- hack/verify-govet.sh
44+
- echo "$DOCKERHUB_PSWD" | docker login --username "$DOCKERHUB_USER" --password-stdin
4345
# BUILD_OUTPUT is left empty to indicate buildx to leave the built images in it's cache
44-
- travis_wait 30 make BUILD_OUTPUT= controller-amd64 webhook-server-amd64
46+
- travis_wait 30 make BUILD_OUTPUT= PROGRESS=plain release-amd64
4547
- make test
4648
- $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/goveralls -coverprofile=coverage.out -service=travis-ci
4749
- stage: build_multiarch
4850
script:
4951
- echo "$DOCKERHUB_PSWD" | docker login --username "$DOCKERHUB_USER" --password-stdin
5052
# BUILD_OUTPUT=--push requests buildx to push the built images to docker hub
51-
- travis_wait 60 make release
53+
- travis_wait 60 make PROGRESS=plain release
5254
- stage: build_release
5355
script:
5456
- echo "Release tag pushed. nothing to do!!"

Makefile

+52-40
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
.PHONY: clean clean-controller clean-cri-client clean-operator controller-amd64 controller-image cri-client-image operator-image build-images push-images test deploy update remove
15+
.PHONY: clean clean-controller clean-cri-client clean-operator controller-amd64 controller-image cri-client-image operator-image build-images push-images test deploy update remove hack
1616
# Default tag and architecture. Can be overridden
1717
TAG?=$(shell git describe --tags --dirty)
1818
ARCH?=amd64
@@ -43,27 +43,27 @@ ifndef OPERATOR_IMAGE_REPO
4343
endif
4444

4545
ifndef RELEASE_VERSION
46-
RELEASE_VERSION=v0.7.1
46+
RELEASE_VERSION=v0.8.2
4747
endif
4848

4949
ifndef DOCKER_VERSION
50-
DOCKER_VERSION=19.03.8
50+
DOCKER_VERSION=20.10.6
5151
endif
5252

5353
ifndef CRICTL_VERSION
54-
CRICTL_VERSION=v1.18.0
54+
CRICTL_VERSION=v1.21.0
5555
endif
5656

5757
ifndef GOLANG_VERSION
58-
GOLANG_VERSION=1.14.2
58+
GOLANG_VERSION=1.16.4
5959
endif
6060

6161
ifndef ALPINE_VERSION
62-
ALPINE_VERSION=3.11.6
62+
ALPINE_VERSION=3.13.5
6363
endif
6464

6565
ifndef OPERATORSDK_VERSION
66-
OPERATORSDK_VERSION=v0.17.1
66+
OPERATORSDK_VERSION=v1.9.0
6767
endif
6868

6969
ifndef TARGET_PLATFORMS
@@ -78,8 +78,8 @@ ifndef BUILD_OUTPUT
7878
BUILD_OUTPUT=--push
7979
endif
8080

81-
ifndef OPERATOR_NAMESPACE
82-
OPERATOR_NAMESPACE=kubefledged-operator
81+
ifndef PROGRESS
82+
PROGRESS=auto
8383
endif
8484

8585
ifndef KUBEFLEDGED_NAMESPACE
@@ -121,7 +121,7 @@ clean-operator:
121121
controller-image: clean-controller
122122
docker buildx build --platform=${TARGET_PLATFORMS} -t ${CONTROLLER_IMAGE_REPO}:${RELEASE_VERSION} \
123123
-t ${CONTROLLER_IMAGE_REPO}:latest -f build/Dockerfile.controller ${HTTP_PROXY_CONFIG} ${HTTPS_PROXY_CONFIG} \
124-
--build-arg GOLANG_VERSION=${GOLANG_VERSION} --build-arg ALPINE_VERSION=${ALPINE_VERSION} --progress=plain ${BUILD_OUTPUT} .
124+
--build-arg GOLANG_VERSION=${GOLANG_VERSION} --build-arg ALPINE_VERSION=${ALPINE_VERSION} --progress=${PROGRESS} ${BUILD_OUTPUT} .
125125

126126
controller-amd64: TARGET_PLATFORMS=linux/amd64
127127
controller-amd64: install-buildx controller-image
@@ -135,7 +135,7 @@ controller-dev: clean-controller
135135
webhook-server-image: clean-webhook-server
136136
docker buildx build --platform=${TARGET_PLATFORMS} -t ${WEBHOOK_SERVER_IMAGE_REPO}:${RELEASE_VERSION} \
137137
-t ${WEBHOOK_SERVER_IMAGE_REPO}:latest -f build/Dockerfile.webhook_server ${HTTP_PROXY_CONFIG} ${HTTPS_PROXY_CONFIG} \
138-
--build-arg GOLANG_VERSION=${GOLANG_VERSION} --build-arg ALPINE_VERSION=${ALPINE_VERSION} --progress=plain ${BUILD_OUTPUT} .
138+
--build-arg GOLANG_VERSION=${GOLANG_VERSION} --build-arg ALPINE_VERSION=${ALPINE_VERSION} --progress=${PROGRESS} ${BUILD_OUTPUT} .
139139

140140
webhook-server-amd64: TARGET_PLATFORMS=linux/amd64
141141
webhook-server-amd64: install-buildx webhook-server-image
@@ -150,12 +150,21 @@ cri-client-image: clean-cri-client
150150
docker buildx build --platform=${TARGET_PLATFORMS} -t ${CRI_CLIENT_IMAGE_REPO}:${RELEASE_VERSION} \
151151
-t ${CRI_CLIENT_IMAGE_REPO}:latest -f build/Dockerfile.cri_client ${HTTP_PROXY_CONFIG} ${HTTPS_PROXY_CONFIG} \
152152
--build-arg DOCKER_VERSION=${DOCKER_VERSION} --build-arg CRICTL_VERSION=${CRICTL_VERSION} \
153-
--build-arg ALPINE_VERSION=${ALPINE_VERSION} --progress=plain ${BUILD_OUTPUT} .
153+
--build-arg ALPINE_VERSION=${ALPINE_VERSION} --progress=${PROGRESS} ${BUILD_OUTPUT} .
154+
155+
cri-client-amd64: TARGET_PLATFORMS=linux/amd64
156+
cri-client-amd64: install-buildx cri-client-image
154157

155158
operator-image: clean-operator
156159
cd deploy/kubefledged-operator && \
157160
docker buildx build --platform=${OPERATOR_TARGET_PLATFORMS} -t ${OPERATOR_IMAGE_REPO}:${RELEASE_VERSION} \
158-
-t ${OPERATOR_IMAGE_REPO}:latest -f build/Dockerfile --build-arg OPERATORSDK_VERSION=${OPERATORSDK_VERSION} --progress=plain ${BUILD_OUTPUT} .
161+
-t ${OPERATOR_IMAGE_REPO}:latest -f build/Dockerfile --build-arg OPERATORSDK_VERSION=${OPERATORSDK_VERSION} --progress=${PROGRESS} ${BUILD_OUTPUT} .
162+
163+
operator-amd64: TARGET_PLATFORMS=linux/amd64
164+
operator-amd64: install-buildx operator-image
165+
166+
release-amd64: TARGET_PLATFORMS=linux/amd64
167+
release-amd64: release
159168

160169
release: install-buildx controller-image webhook-server-image cri-client-image operator-image
161170

@@ -170,38 +179,44 @@ test:
170179
-rm -f coverage.out
171180
bash hack/run-unit-tests.sh
172181

182+
hack:
183+
bash hack/update-codegen.sh
184+
bash hack/update-gofmt.sh
185+
bash hack/verify-codegen.sh
186+
bash hack/verify-gofmt.sh
187+
bash hack/verify-golint.sh
188+
bash hack/verify-govet.sh
189+
173190
deploy-using-yaml:
174191
-kubectl apply -f deploy/kubefledged-namespace.yaml
175-
bash deploy/webhook-create-signed-cert.sh
176-
bash deploy/webhook-patch-ca-bundle.sh
177192
kubectl apply -f deploy/kubefledged-crd.yaml
178193
kubectl apply -f deploy/kubefledged-serviceaccount.yaml
179194
kubectl apply -f deploy/kubefledged-clusterrole.yaml
180195
kubectl apply -f deploy/kubefledged-clusterrolebinding.yaml
181-
kubectl apply -f deploy/kubefledged-deployment-controller.yaml
196+
-kubectl delete validatingwebhookconfigurations -l app=kubefledged
197+
kubectl apply -f deploy/kubefledged-validatingwebhook.yaml
182198
kubectl apply -f deploy/kubefledged-deployment-webhook-server.yaml
183199
kubectl apply -f deploy/kubefledged-service-webhook-server.yaml
184-
kubectl apply -f deploy/kubefledged-validatingwebhook.yaml
200+
kubectl apply -f deploy/kubefledged-deployment-controller.yaml
201+
kubectl rollout status deployment kubefledged-webhook-server -n kube-fledged --watch
202+
kubectl rollout status deployment kubefledged-controller -n kube-fledged --watch
185203

186204
deploy-using-operator:
187-
# Create the namespaces for operator and kubefledged
188-
-kubectl create namespace ${OPERATOR_NAMESPACE}
205+
# Create the namespace
189206
-kubectl create namespace ${KUBEFLEDGED_NAMESPACE}
190-
# Deploy the operator to a separate namespace
191-
sed -i 's|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g' deploy/kubefledged-operator/deploy/service_account.yaml
192-
sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/clusterrole_binding.yaml
193-
sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/operator.yaml
194-
kubectl apply -f deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_kubefledgeds_crd.yaml
207+
# Deploy the operator
208+
sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/service_account.yaml
209+
sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/clusterrole_binding.yaml
210+
sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/operator.yaml
211+
kubectl apply -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_kubefledgeds_crd.yaml
195212
kubectl apply -f deploy/kubefledged-operator/deploy/service_account.yaml
196213
kubectl apply -f deploy/kubefledged-operator/deploy/clusterrole.yaml
197214
kubectl apply -f deploy/kubefledged-operator/deploy/clusterrole_binding.yaml
198215
kubectl apply -f deploy/kubefledged-operator/deploy/operator.yaml
199-
# Deploy kube-fledged to a separate namespace
200-
sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_v1alpha1_kubefledged_cr.yaml
201-
sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_v1alpha1_kubefledged_cr.yaml
202-
bash deploy/webhook-create-signed-cert.sh --namespace ${KUBEFLEDGED_NAMESPACE}
203-
bash deploy/webhook-patch-ca-bundle.sh
204-
kubectl apply -f deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_v1alpha1_kubefledged_cr.yaml
216+
# Deploy kube-fledged
217+
sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml
218+
kubectl rollout status deployment kubefledged-operator -n ${KUBEFLEDGED_NAMESPACE} --watch
219+
kubectl apply -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml
205220

206221
update:
207222
kubectl scale deployment kubefledged-controller --replicas=0 -n kube-fledged
@@ -216,23 +231,20 @@ remove-kubefledged:
216231
-kubectl delete -f deploy/kubefledged-clusterrole.yaml
217232
-kubectl delete -f deploy/kubefledged-crd.yaml
218233
-kubectl delete -f deploy/kubefledged-validatingwebhook.yaml
219-
-git checkout deploy/kubefledged-validatingwebhook.yaml
220-
-git checkout deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_v1alpha1_kubefledged_cr.yaml
221234

222235
remove-operator-and-kubefledged:
223-
# Remove kubefledged and the namespace
224-
-kubectl delete -f deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_v1alpha1_kubefledged_cr.yaml
225-
-kubectl delete namespace ${KUBEFLEDGED_NAMESPACE}
226-
-git checkout deploy/kubefledged-validatingwebhook.yaml
227-
-git checkout deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_v1alpha1_kubefledged_cr.yaml
236+
# Remove kubefledged
237+
-kubectl delete -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml
238+
-kubectl delete validatingwebhookconfigurations -l app.kubernetes.io/name=kube-fledged
228239
# Remove the kubefledged operator and the namespace
229240
-kubectl delete -f deploy/kubefledged-operator/deploy/operator.yaml
230241
-kubectl delete -f deploy/kubefledged-operator/deploy/clusterrole_binding.yaml
231242
-kubectl delete -f deploy/kubefledged-operator/deploy/clusterrole.yaml
232243
-kubectl delete -f deploy/kubefledged-operator/deploy/service_account.yaml
233-
-kubectl delete -f deploy/kubefledged-operator/deploy/crds/charts.helm.k8s.io_kubefledgeds_crd.yaml
234-
-kubectl delete namespace ${OPERATOR_NAMESPACE}
244+
-kubectl delete -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_kubefledgeds_crd.yaml
245+
-kubectl delete namespace ${KUBEFLEDGED_NAMESPACE}
246+
# Restore manifests
235247
-git checkout deploy/kubefledged-operator/deploy/operator.yaml
236248
-git checkout deploy/kubefledged-operator/deploy/clusterrole_binding.yaml
237249
-git checkout deploy/kubefledged-operator/deploy/service_account.yaml
238-
250+
-git checkout deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml

0 commit comments

Comments
 (0)