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

🏃 migrate conformance test to Prow #759

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
_artifacts
bin/
config/
hack/
docs/
templates/
tmp
hack/
out/
scripts/
templates/
tmp/
**/.md
tilt-provider.json
53 changes: 0 additions & 53 deletions .zuul.yaml

This file was deleted.

103 changes: 0 additions & 103 deletions .zuul/playbooks/run.yaml

This file was deleted.

13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export GOPROXY
# Activate module mode, as we use go modules to manage dependencies
export GO111MODULE=on

# This option is for running docker manifest command
export DOCKER_CLI_EXPERIMENTAL := enabled

# Directories.
TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
Expand Down Expand Up @@ -201,9 +204,15 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
## Docker
## --------------------------------------

.PHONY: docker-pull-prerequisites
docker-pull-prerequisites:
docker pull docker.io/docker/dockerfile:1.1-experimental
docker pull docker.io/library/golang:1.16.0
docker pull gcr.io/distroless/static:latest

.PHONY: docker-build
docker-build: ## Build the docker image for controller-manager
docker build --pull --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager
DOCKER_BUILDKIT=1 docker build --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image
$(MAKE) set-manifest-pull-policy

Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ Note: You can use [the template file](../templates/cluster-template.yaml) by man
# Using 'external-cloud-provider' flavor
clusterctl config cluster capi-quickstart \
--flavor external-cloud-provider \
--kubernetes-version v1.19.7 \
--kubernetes-version v1.20.4 \
--control-plane-machine-count=3 \
--worker-machine-count=1 \
> capi-quickstart.yaml

# Using 'without-lb' flavor
clusterctl config cluster capi-quickstart \
--flavor without-lb \
--kubernetes-version v1.19.7 \
--kubernetes-version v1.20.4 \
--control-plane-machine-count=1 \
--worker-machine-count=1 \
> capi-quickstart.yaml
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2015 The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.py.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright YEAR The Kubernetes Authors.
#
Expand Down
126 changes: 126 additions & 0 deletions hack/boskos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#!/usr/bin/env python3

# Copyright 2021 The Kubernetes Authors.
#
# 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.

import argparse
import json
import os

import requests
import time

BOSKOS_HOST = os.environ.get("BOSKOS_HOST", "boskos")
BOSKOS_RESOURCE_NAME = os.environ.get('BOSKOS_RESOURCE_NAME')


def checkout_account_request(resource_type, user, input_state):
url = f'http://{BOSKOS_HOST}/acquire?type={resource_type}&state={input_state}&dest=busy&owner={user}'
r = requests.post(url)
status = r.status_code
reason = r.reason
result = ""

if status == 200:
content = r.content.decode()
result = json.loads(content)

return status, reason, result


def checkout_account(resource_type, user):
status, reason, result = checkout_account_request(resource_type, user, "clean")
# TODO(sbueringer): find out if we still need this
# replicated the implementation of cluster-api-provider-gcp
# we're working around an issue with the data in boskos.
# We'll remove the code that tries both free and clean once all the data is good.
# Afterwards we should just check for free
if status == 404:
status, reason, result = checkout_account_request(resource_type, user, "free")

if status != 200:
raise Exception(f"Got invalid response {status}: {reason}")

print(f"export BOSKOS_RESOURCE_NAME={result['name']}")
print(f"export GCP_PROJECT={result['name']}")


def release_account(user):
url = f'http://{BOSKOS_HOST}/release?name={BOSKOS_RESOURCE_NAME}&dest=dirty&owner={user}'

r = requests.post(url)

if r.status_code != 200:
raise Exception(f"Got invalid response {r.status_code}: {r.reason}")


def send_heartbeat(user):
url = f'http://{BOSKOS_HOST}/update?name={BOSKOS_RESOURCE_NAME}&state=busy&owner={user}'

while True:
print(f"POST-ing heartbeat for resource {BOSKOS_RESOURCE_NAME} to {BOSKOS_HOST}")
r = requests.post(url)

if r.status_code == 200:
print(f"response status: {r.status_code}")
else:
print(f"Got invalid response {r.status_code}: {r.reason}")

time.sleep(60)


def main():
parser = argparse.ArgumentParser(description='Boskos GCP Account Management')

parser.add_argument(
'--get', dest='checkout_account', action="store_true",
help='Checkout a Boskos GCP Account'
)

parser.add_argument(
'--release', dest='release_account', action="store_true",
help='Release a Boskos GCP Account'
)

parser.add_argument(
'--heartbeat', dest='send_heartbeat', action="store_true",
help='Send heartbeat for the checked out a Boskos GCP Account'
)

parser.add_argument(
'--resource-type', dest="resource_type", type=str,
default="gce-project",
help="Type of Boskos resource to manage"
)

parser.add_argument(
'--user', dest="user", type=str,
default="cluster-api-provider-openstack",
help="username"
)

args = parser.parse_args()

if args.checkout_account:
checkout_account(args.resource_type, args.user)

elif args.release_account:
release_account(args.user)

elif args.send_heartbeat:
send_heartbeat(args.user)


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions hack/ci/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e2e-conformance-gcp-cloud-init.yaml
Loading