From 875c82b4e9343340eca7a724f6e0990d24138560 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Wed, 8 May 2024 10:38:54 +0200 Subject: [PATCH 01/32] Dev Env setup script: add new step: generate certs and keys necessary for unit tests to run successfully --- docs/tutorials/porch-development-environment/bin/setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index 69afb5ac..c0328a82 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -111,10 +111,13 @@ else echo "main branch already exists in git repo." fi +############################################ +h1 Generate certs and keys +"${self_dir}/../../../../deployments/local/makekeys.sh" + ############################################ h1 "Clean up" cd "$self_dir" rm -fr "$TMP_DIR" - echo echo Done. From bb1e1ec956ad1c338343c5a902fe2ede945ef4f5 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Wed, 8 May 2024 18:25:47 +0200 Subject: [PATCH 02/32] Dev Env setup script: bugfix: call the makekeys.sh script properly --- docs/tutorials/porch-development-environment/bin/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index c0328a82..a018aaa8 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -113,7 +113,8 @@ fi ############################################ h1 Generate certs and keys -"${self_dir}/../../../../deployments/local/makekeys.sh" +cd "${self_dir}/../../../../" +deployments/local/makekeys.sh ############################################ h1 "Clean up" From da9c821c8bf4561c203031cc34638c84f0e49938 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Thu, 23 May 2024 00:21:02 +0200 Subject: [PATCH 03/32] dev-env setup script improvements - make the setup script rely on local config files instead of remote ones from github - keep gitea deployment kpt package in .build directory (as opposed to a temp dir) in order to keep the local inventory for future updates - vscode: remove kpt-related folders from workspace - vscode: adopt porch-server launch paremeters to the porch components running in the test kind cluster --- .vscode/launch.json | 5 +- .../bin/kind_porch_test_cluster.yaml | 15 +++++ .../bin/setup.sh | 65 +++++++++++-------- porch.code-workspace | 8 --- 4 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 docs/tutorials/porch-development-environment/bin/kind_porch_test_cluster.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index 6ae3651e..467fe979 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,9 +25,10 @@ "--secure-port=9443", "--v=7", "--standalone-debug-mode", - "--kubeconfig=${workspaceFolder}/deployments/local/kubeconfig", + "--kubeconfig=${env:KUBECONFIG}", "--cache-directory=${workspaceFolder}/.cache", - "--function-runner=192.168.8.202:9445" + "--function-runner=localhost:30001", + "--repo-sync-frequency=60s" ], "cwd": "${workspaceFolder}" }, diff --git a/docs/tutorials/porch-development-environment/bin/kind_porch_test_cluster.yaml b/docs/tutorials/porch-development-environment/bin/kind_porch_test_cluster.yaml new file mode 100644 index 00000000..ed96f6ee --- /dev/null +++ b/docs/tutorials/porch-development-environment/bin/kind_porch_test_cluster.yaml @@ -0,0 +1,15 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +name: management +networking: + apiServerAddress: 127.0.0.1 + apiServerPort: 31000 + podSubnet: 10.97.0.0/16 + serviceSubnet: 10.197.0.0/16 +nodes: +- role: control-plane + extraPortMappings: + - containerPort: 30000 # Gitea NodePort + hostPort: 3000 + - containerPort: 30001 # function-runner NodePort + hostPort: 30001 diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index a018aaa8..195a90f3 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -14,10 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -porch_cluster_name=porch-test +porch_cluster_name=${PORCH_TEST_CLUSTER:-porch-test} git_repo_name="$porch_cluster_name" -gitea_ip=172.18.255.200 # should be from the address range specified here: https://github.com/nephio-project/porch/blob/main/docs/tutorials/starting-with-porch/metallb-conf.yaml +gitea_ip=172.18.255.200 # should be from the address range specified here: docs/tutorials/starting-with-porch/metallb-conf.yaml self_dir="$(dirname "$(readlink -f "$0")")" +git_root="$(readlink -f "${self_dir}/../../../..")" +cd "${git_root}" function h1() { echo @@ -40,8 +42,9 @@ fi ############################################## h1 "Install kind cluster: $porch_cluster_name" if ! kind get clusters | grep -q "^$porch_cluster_name\$" ; then - curl -s https://raw.githubusercontent.com/nephio-project/porch/main/docs/tutorials/starting-with-porch/kind_management_cluster.yaml | \ - kind create cluster --config=- --name "$porch_cluster_name" || true + kind create cluster \ + --config="${git_root}/docs/tutorials/porch-development-environment/bin/kind_porch_test_cluster.yaml" \ + --name "$porch_cluster_name" || true mkdir -p ~/.kube kind get kubeconfig --name="$porch_cluster_name" > ~/.kube/"kind-$porch_cluster_name" @@ -58,49 +61,56 @@ echo "Waiting for controller to become ready..." kubectl wait --namespace metallb-system deploy controller \ --for=condition=available \ --timeout=90s -kubectl apply -f https://raw.githubusercontent.com/nephio-project/porch/main/docs/tutorials/starting-with-porch/metallb-conf.yaml - -############################################ -h1 Prepare tmp dir -TMP_DIR=$(mktemp -d) -echo "$TMP_DIR" +kubectl apply -f "${git_root}/docs/tutorials/starting-with-porch/metallb-conf.yaml" ############################################ h1 Install Gitea -mkdir "$TMP_DIR/kpt_packages" -cd "$TMP_DIR/kpt_packages" -kpt pkg get https://github.com/nephio-project/catalog/tree/main/distros/sandbox/gitea +mkdir -p "${git_root}/.build" +cd "${git_root}/.build" +if [ -d gitea ]; then + kpt pkg update gitea +else + kpt pkg get https://github.com/nephio-project/catalog/tree/main/distros/sandbox/gitea +fi + kpt fn eval gitea \ --image gcr.io/kpt-fn/set-annotations:v0.1.4 \ --match-kind Service \ --match-name gitea \ --match-namespace gitea \ -- "metallb.universe.tf/loadBalancerIPs=${gitea_ip}" -curl -o gitea/cluster-config.yaml https://raw.githubusercontent.com/nephio-project/porch/main/docs/tutorials/starting-with-porch/kind_management_cluster.yaml -echo "metadata: { name: "porch-test" }" >> gitea/cluster-config.yaml -kpt fn eval gitea \ - --image gcr.io/kpt-fn/set-annotations:v0.1.4 \ - --match-kind Cluster \ - --match-api-version kind.x-k8s.io/v1alpha4 \ - -- "config.kubernetes.io/local-config=true" + +cp -f "${git_root}/docs/tutorials/porch-development-environment/bin/kind_porch_test_cluster.yaml" gitea/cluster-config.yaml +# turn kind's cluster-config into a valid KRM +cat >> gitea/cluster-config.yaml </dev/null; then + echo "Add main branch to git repo:" git switch -c main touch README.md git add README.md @@ -110,15 +120,14 @@ if ! git rev-parse -q --verify refs/remotes/origin/main >/dev/null; then else echo "main branch already exists in git repo." fi +cd "${git_root}" +rm -fr "$TMP_DIR" ############################################ h1 Generate certs and keys -cd "${self_dir}/../../../../" +cd "${git_root}" deployments/local/makekeys.sh ############################################ -h1 "Clean up" -cd "$self_dir" -rm -fr "$TMP_DIR" echo echo Done. diff --git a/porch.code-workspace b/porch.code-workspace index f90fdd25..d50229ad 100644 --- a/porch.code-workspace +++ b/porch.code-workspace @@ -11,17 +11,9 @@ "name": "porch", "path": "." }, - { - "name": "kpt", - "path": ".." - }, { "name": "controllers", "path": "controllers" - }, - { - "name": "rollouts", - "path": "../rollouts" } ] } From 8aa0e944a1ca83e63b639fdade4710d95a5a16f1 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Thu, 23 May 2024 00:21:58 +0200 Subject: [PATCH 04/32] Bump up local kube-apiserver version to 1.30.1 to keep it aligned with the go-client module --- build/Dockerfile.apiserver | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build/Dockerfile.apiserver b/build/Dockerfile.apiserver index 0cacc1ce..629970ad 100644 --- a/build/Dockerfile.apiserver +++ b/build/Dockerfile.apiserver @@ -15,14 +15,13 @@ FROM golang:1.22.2-bookworm as builder WORKDIR /workspace/src -RUN git clone https://github.com/kubernetes/kubernetes --branch v1.23.2 --depth=1 +RUN git clone https://github.com/kubernetes/kubernetes --branch v1.30.1 --depth=1 WORKDIR /workspace/src/kubernetes RUN apt-get update && apt-get install --yes rsync -RUN make generated_files -RUN CGO_ENABLED=0 go build -o /workspace/artifacts/kube-apiserver ./cmd/kube-apiserver +RUN make kube-apiserver FROM gcr.io/distroless/static -COPY --from=builder /workspace/artifacts/kube-apiserver /kube-apiserver +COPY --from=builder /workspace/src/kubernetes/_output/local/bin/linux/amd64/kube-apiserver /kube-apiserver #USER 65532:65532 From d1b8498805c3b7c2d73d6fc4186df93f74aaeee7 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Thu, 23 May 2024 18:31:37 +0200 Subject: [PATCH 05/32] dev-env setup script: additional automated steps --- .vscode/launch.json | 4 +- .../bin/cleardown.sh | 21 ---- .../bin/setup.sh | 106 ++++++++++++++++++ 3 files changed, 108 insertions(+), 23 deletions(-) delete mode 100755 docs/tutorials/porch-development-environment/bin/cleardown.sh diff --git a/.vscode/launch.json b/.vscode/launch.json index 467fe979..98f1e512 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -22,12 +22,12 @@ "mode": "auto", "program": "${workspaceFolder}/cmd/porch/main.go", "args": [ - "--secure-port=9443", + "--secure-port=4443", "--v=7", "--standalone-debug-mode", "--kubeconfig=${env:KUBECONFIG}", "--cache-directory=${workspaceFolder}/.cache", - "--function-runner=localhost:30001", + "--function-runner=172.18.255.201:9445", "--repo-sync-frequency=60s" ], "cwd": "${workspaceFolder}" diff --git a/docs/tutorials/porch-development-environment/bin/cleardown.sh b/docs/tutorials/porch-development-environment/bin/cleardown.sh deleted file mode 100755 index 14138915..00000000 --- a/docs/tutorials/porch-development-environment/bin/cleardown.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/bash - -# Copyright 2024 The kpt and Nephio 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. - -kind delete cluster --name management -kind delete cluster --name edge1 - -rm ~/.kube/kind-management-config -rm ~/.kube/kind-edge1-config \ No newline at end of file diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index 195a90f3..68d0dd91 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -17,6 +17,8 @@ porch_cluster_name=${PORCH_TEST_CLUSTER:-porch-test} git_repo_name="$porch_cluster_name" gitea_ip=172.18.255.200 # should be from the address range specified here: docs/tutorials/starting-with-porch/metallb-conf.yaml +function_runner_ip=172.18.255.201 + self_dir="$(dirname "$(readlink -f "$0")")" git_root="$(readlink -f "${self_dir}/../../../..")" cd "${git_root}" @@ -128,6 +130,110 @@ h1 Generate certs and keys cd "${git_root}" deployments/local/makekeys.sh +############################################ +h1 Install CRDs +kubectl apply -f api/porchconfig/v1alpha1/config.porch.kpt.dev_repositories.yaml +kubectl apply -f api/porchconfig/v1alpha1/config.porch.kpt.dev_functions.yaml +kubectl apply -f controllers/config/crd/bases/config.porch.kpt.dev_packagevariants.yaml +kubectl apply -f controllers/config/crd/bases/config.porch.kpt.dev_packagevariantsets.yaml +kubectl apply -f internal/api/porchinternal/v1alpha1/config.porch.kpt.dev_packagerevs.yaml + + +############################################ +h1 Load container images into kind cluster +export IMAGE_TAG=v2.0.0 +export KIND_CONTEXT_NAME="$porch_cluster_name" +if ! docker exec -it "$porch_cluster_name-control-plane" crictl images | grep -q docker.io/nephio/test-git-server ; then + make build-images + kind load docker-image docker.io/nephio/porch-controllers:${IMAGE_TAG} -n ${KIND_CONTEXT_NAME} + kind load docker-image docker.io/nephio/porch-function-runner:${IMAGE_TAG} -n ${KIND_CONTEXT_NAME} + kind load docker-image docker.io/nephio/porch-wrapper-server:${IMAGE_TAG} -n ${KIND_CONTEXT_NAME} + kind load docker-image docker.io/nephio/test-git-server:${IMAGE_TAG} -n ${KIND_CONTEXT_NAME} +else + echo "Images already loaded into kind cluster." +fi + +############################################ +h1 Install all porch components, except porch-server + +make deployment-config-no-sa +cd .build/deploy-no-sa +# expose function-runner to local processes +kpt fn eval \ + --image gcr.io/kpt-fn/starlark:v0.5.0 \ + --match-kind Service \ + --match-name function-runner \ + --match-namespace porch-system \ + -- "ip=${function_runner_ip}" 'source= +ip = ctx.resource_list["functionConfig"]["data"]["ip"] +for resource in ctx.resource_list["items"]: + resource["metadata"].setdefault("annotations", {})["metallb.universe.tf/loadBalancerIPs"] = ip + resource["spec"]["type"] = "LoadBalancer" + resource["spec"]["ports"][0]["nodePort"] = 30001' +# "remove" porch-server from package +kpt fn eval \ + --image gcr.io/kpt-fn/set-annotations:v0.1.4 \ + --match-kind Deployment \ + --match-name porch-server \ + --match-namespace porch-system \ + -- "config.kubernetes.io/local-config=true" +# make the api service point to the local porch-server +if [ "$(uname)" = "Darwin" ] +then + # MAC + kpt fn eval \ + --image gcr.io/kpt-fn/starlark:v0.5.0 \ + --match-kind Service \ + --match-name api \ + --match-namespace porch-system \ + -- 'source= +for resource in ctx.resource_list["items"]: + resource["spec"] = { + "type": "ExternalName", + "externalName": "host.docker.internal" + } +' + +else + # Linux + docker_bridge_ip="$(docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}')" + kpt fn eval \ + --image gcr.io/kpt-fn/starlark:v0.5.0 \ + --match-kind Service \ + --match-name api \ + --match-namespace porch-system \ + -- "ip=$docker_bridge_ip" 'source= +ip = ctx.resource_list["functionConfig"]["data"]["ip"] +for resource in ctx.resource_list["items"]: + resource["spec"].pop("selector") +ctx.resource_list["items"].append({ + "apiVersion": "v1", + "kind": "Endpoints", + "metadata": { + "name": "api", + "namespace": "porch-system", + }, + "subsets": [ + { + "addresses": [{"ip": ip}], + "ports": [ + { + "appProtocol": "https", + "port": 4443, + "protocol": "TCP", + "name": "api" + } + ] + } + ] +}) +' +fi +kpt fn render +kpt live init || true +kpt live apply --inventory-policy=adopt --output=table + + ############################################ echo echo Done. From d2009039a6d83c44317f4faa148a772b5f8d5949 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Fri, 24 May 2024 13:20:52 +0200 Subject: [PATCH 06/32] dev-env setup script: minor fixes --- .vscode/launch.json | 23 ----------- Makefile | 6 ++- deployments/local/porch-api-endpoints.yaml | 18 +++++++++ .../bin/setup.sh | 40 ++++++------------- 4 files changed, 36 insertions(+), 51 deletions(-) create mode 100644 deployments/local/porch-api-endpoints.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index 98f1e512..b5975014 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -45,29 +45,6 @@ "--", "namespace=foo" ] - }, - { - "name": "Launch kpt", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "${workspaceFolder}/../main.go", - "args": [ - "alpha", "rpkg", "get" - ], - "cwd": "${workspaceFolder}/.." - }, - { - "name": "Launch kpt e2e test", - "type": "go", - "request": "launch", - "mode": "test", - "program": "${workspaceFolder}/../e2e", - "args": [ - "-v", - "-test.run", - "TestPorch" - ] } ] } \ No newline at end of file diff --git a/Makefile b/Makefile index f8acabb8..7d7711ca 100644 --- a/Makefile +++ b/Makefile @@ -159,6 +159,10 @@ generate: generate-api tidy: @for f in $(MODULES); do (cd $$f; echo "Tidying $$f"; go mod tidy) || exit 1; done +.PHONY: test-e2e +test-e2e: + E2E=1 go test -v -race --count=1 -failfast ./test/e2e + .PHONY: configure-git configure-git: git config --global --add user.name test @@ -266,8 +270,8 @@ push-and-deploy: push-images deploy # `push-and-deploy` etc.) .PHONY: deployment-config-no-sa deployment-config-no-sa: - rm -rf $(DEPLOYCONFIG_NO_SA_DIR) || true mkdir -p $(DEPLOYCONFIG_NO_SA_DIR) + find $(DEPLOYCONFIG_NO_SA_DIR) ! -name 'resourcegroup.yaml' -type f -exec rm -f {} + ./scripts/create-deployment-blueprint.sh \ --destination "$(DEPLOYCONFIG_NO_SA_DIR)" \ --server-image "$(IMAGE_REPO)/$(PORCH_SERVER_IMAGE):$(IMAGE_TAG)" \ diff --git a/deployments/local/porch-api-endpoints.yaml b/deployments/local/porch-api-endpoints.yaml new file mode 100644 index 00000000..98abbde6 --- /dev/null +++ b/deployments/local/porch-api-endpoints.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Endpoints +metadata: + annotations: + config.kubernetes.io/target-path: 3-porch-server-endpoints.yaml + name: api + namespace: porch-system +subsets: +- addresses: + - ip: 172.17.0.1 + ports: + - appProtocol: https + name: api + port: 4443 + protocol: TCP + - name: webhooks + port: 8443 + protocol: TCP \ No newline at end of file diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index 68d0dd91..28829b91 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -96,7 +96,7 @@ kpt fn eval gitea \ kpt fn render gitea kpt live init gitea || true -kpt live apply gitea --inventory-policy=adopt --output=table +kpt live apply gitea --inventory-policy=adopt echo "Waiting for gitea to become ready..." kubectl wait --namespace gitea statefulset gitea \ --for='jsonpath={.status.readyReplicas}=1' \ @@ -197,41 +197,27 @@ for resource in ctx.resource_list["items"]: else # Linux docker_bridge_ip="$(docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}')" + kpt fn eval \ + --image upsert-resource:v0.2.0 \ + --fn-config "${git_root}/deployments/local/porch-api-endpoints.yaml" + kpt fn eval \ + --image gcr.io/kpt-fn/search-replace:v0.2.0 \ + --match-kind Endpoints \ + --match-name api \ + --match-namespace porch-system \ + -- 'by-path=subsets[0].addresses[0].ip' "put-value=$docker_bridge_ip" kpt fn eval \ --image gcr.io/kpt-fn/starlark:v0.5.0 \ --match-kind Service \ --match-name api \ --match-namespace porch-system \ - -- "ip=$docker_bridge_ip" 'source= -ip = ctx.resource_list["functionConfig"]["data"]["ip"] + -- 'source= for resource in ctx.resource_list["items"]: - resource["spec"].pop("selector") -ctx.resource_list["items"].append({ - "apiVersion": "v1", - "kind": "Endpoints", - "metadata": { - "name": "api", - "namespace": "porch-system", - }, - "subsets": [ - { - "addresses": [{"ip": ip}], - "ports": [ - { - "appProtocol": "https", - "port": 4443, - "protocol": "TCP", - "name": "api" - } - ] - } - ] -}) -' + resource["spec"].pop("selector")' fi kpt fn render kpt live init || true -kpt live apply --inventory-policy=adopt --output=table +kpt live apply --inventory-policy=adopt ############################################ From 2710e2a900ed259e3241b5d3e296969e8b274018 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Fri, 24 May 2024 18:20:32 +0200 Subject: [PATCH 07/32] dev-env tutorial README update --- docs/tutorials/porch-development-environment/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 99e021b8..8bf9c65f 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -123,9 +123,9 @@ The Porch api server requires that the following resources are defined in the K8 Slight differences in docker networking require a secific setup depending on the host OS. -## Mac OS example +## Docker Desktop (Mac OS or Windows) example -Docker networking on Mac allows traffic to be routed via a default DNS name `host.docker.internal`, which is not available on Linux. +Docker Desktop on Mac/Windows allows traffic to be routed to the host machine via the domain name `host.docker.internal`. More details [here](https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host). A sample configuration is available at `deployments/local/localconfig.yaml` From 0850696b70221653241c4eef0467c8396d159040 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Mon, 27 May 2024 19:35:43 +0200 Subject: [PATCH 08/32] Update dev-env setup tutorial to reflect the changes in the new setup script. --- .../porch-development-environment/README.md | 398 +++--------------- 1 file changed, 48 insertions(+), 350 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 8bf9c65f..a029c3a2 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -1,372 +1,52 @@ # Setting up a development environment for Porch -This tutorial gives short instructions on how to set up a development environment for Porch. It outlines the steps to get a [kind](https://kind.sigs.k8s.io/) cluster up -and running to which a Porch instance running in Visual Studio Code can connect to and interact with. +This tutorial gives short instructions on how to set up a development environment for Porch. It outlines the steps to get +a [kind](https://kind.sigs.k8s.io/) cluster up and running to which a Porch instance running in Visual Studio Code can connect to and interact with. +It is highly recommended to go through the [Starting with Porch tutorial](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch) before this one, if you are not familiar with how porch works. > **_NOTE:_** The code itself can be run on a remote VM and we can use the [VSCode Remote SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) plugin to connect to it as our Dev environment.
-# Setup kind with MetalLB and Gitea +# Setup the environment everything automatically -Follow steps 1-5 inclusive of the [Starting with Porch](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch) tutorial. You now have the Kind cluster `management` running with Gitea installed on it. Gitea has the repository `management` defined. +This [setup script](bin/setup.sh) automatically bulids a porch development environment. +Please note that this is not the only possible way to build a working porch development environment, and feel free to customize your own. +The setup script will perform the following steps: +1. Install a kind cluster. + The name of the cluster is read from PORCH_TEST_CLUSTER environment variable, otherwise it defaults to `porch-test`. + The configuration of the cluster is taken from [here](kind_porch_test_cluster.yaml). -> **_NOTE:_** This [setup script](bin/setup.sh) automates steps 1-5 of the Starting with Porch tutorial. You may need to adapt this script to your local environment and also have [pre requisites](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch#prerequisites) installed on the target machine. +1. Install the MetalLB load balancer into the cluster, in order to `LoadBalancer` typed Services to work properly. -> **_NOTE:_** This [cleardown script script](bin/cleardown.sh) clears everything down by deleting the `management` Kind cluster. USE WITH CARE. +1. Install the Gitea git server into the cluster. This can be used to test porch during development, but it is not used in automated end-to-end tests. -Switch to use the kind-management context if necessary: -``` -kubectl config use-context kind-management -``` - - -You can reach the Gitea web interface on the address reported by the following command: -``` -kubectl get svc -n gitea gitea -``` -Sample output: -``` -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -gitea LoadBalancer 10.197.10.118 172.18.255.200 22:31260/TCP,3000:31012/TCP 8m35s -``` - -
- -# Install the Porch function runner - -The Porch server requires that the Porch function runner is executing. To install the Porch function runner on the Kind management cluster, execute the following commands: - -``` -kubectl apply -f https://raw.githubusercontent.com/nephio-project/catalog/main/nephio/core/porch/1-namespace.yaml -kubectl apply -f https://raw.githubusercontent.com/nephio-project/catalog/main/nephio/core/porch/2-function-runner.yaml - -kubectl wait --namespace porch-system \ - --for=condition=ready pod \ - --selector=app=function-runner \ - --timeout=300s -``` - -The Porch function runner should now be executing: - -``` -kubectl get pod -n porch-system --selector=app=function-runner -``` -Sample output: -``` -NAME READY STATUS RESTARTS AGE -function-runner-67d4c7c7b-7wm97 1/1 Running 0 16m -function-runner-67d4c7c7b-czvvq 1/1 Running 0 16m -``` - -Expose the `function-runner` service so that the Porch server running in Visual Studio Code can reach it. Patch the service type from `ClusterIP` to `LoadBalancer`: + Gitea is exposed to the host via the port 3000. The GUI is accessible via the URL: http://localhost:3000/nephio , and also via: http://172.18.255.200:3000/nephio (username: nephio, password: secret). -``` -kubectl patch svc -n porch-system function-runner -p '{"spec": {"type": "LoadBalancer"}}' -``` + > **_NOTE:_** If you are using WSL2 (Windows Subsystem for Linux), then Gitea is also accessible from the Windows host via the http://localhost:3000/nephio URL. -Check that the `function-runner` service has been assigned an external IP address: -``` -kubectl get svc -n porch-system function-runner -``` -Sample output: -``` -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -function-runner LoadBalancer 10.197.168.148 172.18.255.201 9445:31794/TCP 22m -``` -
- -# Install the Porch CRDs - -The Custom Resource Definitions can be applied to the cluster from the upstream porch kpt pkg as follows: +1. Generate the PKI resources (key pairs and certificates) necessary for end-to-end tests. -``` -kubectl apply -f https://raw.githubusercontent.com/nephio-project/catalog/main/nephio/core/porch/0-packagerevs.yaml -kubectl apply -f https://raw.githubusercontent.com/nephio-project/catalog/main/nephio/core/porch/0-packagevariants.yaml -kubectl apply -f https://raw.githubusercontent.com/nephio-project/catalog/main/nephio/core/porch/0-packagevariantsets.yaml -kubectl apply -f https://raw.githubusercontent.com/nephio-project/catalog/main/nephio/core/porch/0-repositories.yaml -``` +1. Install porch CRDs into the cluster. -Check the entries: -``` -kubectl get crd | grep porch -``` -Sample output: -``` -packagerevs.config.porch.kpt.dev 2024-03-11T15:07:12Z -packagevariants.config.porch.kpt.dev 2024-03-11T15:07:12Z -packagevariantsets.config.porch.kpt.dev 2024-03-11T15:07:13Z -repositories.config.porch.kpt.dev 2024-03-11T15:07:14Z -``` -These new `resources` are now also visible wihtin the kubernetes api-resources: -``` -kubectl api-resources | grep -i porch -``` -Sample output: -``` -packagerevs config.porch.kpt.dev/v1alpha1 true PackageRev -packagevariants config.porch.kpt.dev/v1alpha1 true PackageVariant -packagevariantsets config.porch.kpt.dev/v1alpha2 true PackageVariantSet -repositories config.porch.kpt.dev/v1alpha1 true Repository - -``` - -
+1. Build the porch containers and loads them into the nodes of the kind cluster. -# Deploy the porch APIService resources +1. Deploy all porch components in the kind cluster, except the porch-server (porch's aggregated API server). + The script also exposes the function-runner service via 172.18.255.201:9445 -The Porch api server requires that the following resources are defined in the K8S cluster where it is executed: +That's it. If you want to run the steps manually, please use the code of the script as a detailed description. -- A `porch-system` namespace -- An APIService called `apiservice.apiregistration.k8s.io/v1alpha1.porch.kpt.dev` -- A `service.api` service to route the API Service requests. - -Slight differences in docker networking require a secific setup depending on the host OS. - -## Docker Desktop (Mac OS or Windows) example - -Docker Desktop on Mac/Windows allows traffic to be routed to the host machine via the domain name `host.docker.internal`. More details [here](https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host). - -A sample configuration is available at `deployments/local/localconfig.yaml` - -Apply the KRM: -``` -kubectl apply -f https://raw.githubusercontent.com/nephio-project/porch/main/deployments/local/localconfig.yaml -``` -Verify that the resources have been created -``` -kubectl api-resources | grep -i porch -functions config.porch.kpt.dev/v1alpha1 true Function -packagerevs config.porch.kpt.dev/v1alpha1 true PackageRev -packagevariants config.porch.kpt.dev/v1alpha1 true PackageVariant -packagevariantsets config.porch.kpt.dev/v1alpha2 true PackageVariantSet -repositories config.porch.kpt.dev/v1alpha1 true Repository -``` -## Linux OS example - -Linux docker networking between `kind` clusters and the host processes require the traffic to be routed through the default docker bridge. See [here](https://github.com/kubernetes-sigs/kind/issues/1200#issuecomment-1532192361) for more details. - -Apply the following resources: -``` -kubectl apply -f - < # Configure VSCode to run the Porch (api)server -From the root of your checked out Porch repo. - -Edit your local `.vscode.launch.json` file as follows: -1. Change the `--kubeconfig` value to point at your management cluster configuration file. -2. Change the `--function-runner` IP address to the external IP of the function runner service running in the `management` cluster. -3. You can alternatively specify `KUBECONFIG` in an `env` section of the configuration instead of using the `--kubeconfig` flag. +After the environemnt is set you can start the porch API server localy on your machine. There are multiple ways to do that, the simplest is to run it in a VSCode IDE: -``` - { - "name": "Launch Server", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "${workspaceFolder}/cmd/porch/main.go", - "args": [ - "--secure-port=9443", - "--v=7", - "--standalone-debug-mode", - "--kubeconfig=${userHome}/.kube/kind-management-config", - "--cache-directory=${workspaceFolder}/.cache", - "--function-runner=172.18.255.201:9445" - ], - "cwd": "${workspaceFolder}" - }, -``` +1. Edit your local `.vscode.launch.json` file as follows: Change the `--kubeconfig` argument of the `Launch Server` configuration to point to a KUBECONFIG file that is set to the kind cluster as the current context. -You can now launch the Porch server locally in VSCode by selecting the "Launch Server" configuration on the VSCode "Run and Debug" window. for +1. You can now launch the Porch server locally in VSCode by selecting the "Launch Server" configuration on the VSCode "Run and Debug" window. for more information please refer to the [VSCode debugging documentation](https://code.visualstudio.com/docs/editor/debugging). -
-Sample output - -``` -kubectl patch svc -n porch-system function-runner -p '{"spec": {"type": "LoadBalancer"}}'Starting: /home/ubuntu/go/bin/dlv dap --listen=127.0.0.1:40695 --log-dest=3 from /home/ubuntu/porch/cmd/porch -DAP server listening at: 127.0.0.1:40695 -Type 'dlv help' for list of commands. -I0311 15:53:26.802270 2101307 dynamic_serving_content.go:113] "Loaded a new cert/key pair" name="serving-cert::apiserver.local.config/certificates/apiserver.crt::apiserver.local.config/certificates/apiserver.key" -W0311 15:53:26.963694 2101307 authentication.go:339] No authentication-kubeconfig provided in order to lookup client-ca-file in configmap/extension-apiserver-authentication in kube-system, so client certificate authentication won't work. -W0311 15:53:26.963716 2101307 authentication.go:363] No authentication-kubeconfig provided in order to lookup requestheader-client-ca-file in configmap/extension-apiserver-authentication in kube-system, so request-header client certificate authentication won't work. -W0311 15:53:26.963878 2101307 recommended.go:152] Neither kubeconfig is provided nor service-account is mounted, so APIPriorityAndFairness will be disabled -I0311 15:53:26.963942 2101307 maxinflight.go:140] "Initialized nonMutatingChan" len=400 -I0311 15:53:26.963953 2101307 maxinflight.go:146] "Initialized mutatingChan" len=200 -I0311 15:53:26.963979 2101307 timing_ratio_histogram.go:202] "TimingRatioHistogramVec.NewForLabelValuesSafe hit the inefficient case" fqName="apiserver_flowcontrol_read_vs_write_current_requests" labelValues=[executing readOnly] -I0311 15:53:26.963990 2101307 timing_ratio_histogram.go:202] "TimingRatioHistogramVec.NewForLabelValuesSafe hit the inefficient case" fqName="apiserver_flowcontrol_read_vs_write_current_requests" labelValues=[executing mutating] -I0311 15:53:26.964000 2101307 maxinflight.go:117] "Set denominator for readonly requests" limit=400 -I0311 15:53:26.964006 2101307 maxinflight.go:121] "Set denominator for mutating requests" limit=200 -I0311 15:53:26.964030 2101307 config.go:762] Not requested to run hook priority-and-fairness-config-consumer -I0311 15:53:26.966686 2101307 loader.go:373] Config loaded from file: /home/ubuntu/.kube/kind-management-config -I0311 15:53:26.967652 2101307 round_trippers.go:463] GET https://127.0.0.1:31000/api?timeout=32s -I0311 15:53:26.967666 2101307 round_trippers.go:469] Request Headers: -I0311 15:53:26.967672 2101307 round_trippers.go:473] Accept: application/json;g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList,application/json -I0311 15:53:26.967677 2101307 round_trippers.go:473] User-Agent: __debug_bin3534874763/v0.0.0 (linux/amd64) kubernetes/$Format -I0311 15:53:26.975046 2101307 round_trippers.go:574] Response Status: 200 OK in 7 milliseconds -I0311 15:53:26.975945 2101307 round_trippers.go:463] GET https://127.0.0.1:31000/apis?timeout=32s -I0311 15:53:26.975958 2101307 round_trippers.go:469] Request Headers: -I0311 15:53:26.975964 2101307 round_trippers.go:473] Accept: application/json;g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList,application/json -I0311 15:53:26.975968 2101307 round_trippers.go:473] User-Agent: __debug_bin3534874763/v0.0.0 (linux/amd64) kubernetes/$Format -I0311 15:53:26.976802 2101307 round_trippers.go:574] Response Status: 200 OK in 0 milliseconds -I0311 15:53:26.979575 2101307 loader.go:373] Config loaded from file: /home/ubuntu/.kube/kind-management-config -I0311 15:53:26.979853 2101307 grpcruntime.go:41] Dialing grpc function runner "172.18.255.201:9445" -I0311 15:53:26.979897 2101307 clientconn.go:318] "[core] [Channel #1] Channel created\n" -I0311 15:53:26.979924 2101307 logging.go:43] "[core] [Channel #1] original dial target is: \"172.18.255.201:9445\"\n" -I0311 15:53:26.979941 2101307 logging.go:43] "[core] [Channel #1] dial target \"172.18.255.201:9445\" parse failed: parse \"172.18.255.201:9445\": first path segment in URL cannot contain colon\n" -I0311 15:53:26.979951 2101307 logging.go:43] "[core] [Channel #1] fallback to scheme \"passthrough\"\n" -I0311 15:53:26.979974 2101307 logging.go:43] "[core] [Channel #1] parsed dial target is: {URL:{Scheme:passthrough Opaque: User: Host: Path:/172.18.255.201:9445 RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}\n" -I0311 15:53:26.979990 2101307 logging.go:43] "[core] [Channel #1] Channel authority set to \"172.18.255.201:9445\"\n" -I0311 15:53:26.980145 2101307 logging.go:43] "[core] [Channel #1] Resolver state updated: {\n \"Addresses\": [\n {\n \"Addr\": \"172.18.255.201:9445\",\n \"ServerName\": \"\",\n \"Attributes\": null,\n \"BalancerAttributes\": null,\n \"Metadata\": null\n }\n ],\n \"Endpoints\": [\n {\n \"Addresses\": [\n {\n \"Addr\": \"172.18.255.201:9445\",\n \"ServerName\": \"\",\n \"Attributes\": null,\n \"BalancerAttributes\": null,\n \"Metadata\": null\n }\n ],\n \"Attributes\": null\n }\n ],\n \"ServiceConfig\": null,\n \"Attributes\": null\n} (resolver returned new addresses)\n" -I0311 15:53:26.980192 2101307 logging.go:43] "[core] [Channel #1] Channel switches to new LB policy \"pick_first\"\n" -I0311 15:53:26.980251 2101307 pickfirst.go:141] "[core] [pick-first-lb 0xc001813980] Received new config {\n \"shuffleAddressList\": false\n}, resolver state {\n \"Addresses\": [\n {\n \"Addr\": \"172.18.255.201:9445\",\n \"ServerName\": \"\",\n \"Attributes\": null,\n \"BalancerAttributes\": null,\n \"Metadata\": null\n }\n ],\n \"Endpoints\": [\n {\n \"Addresses\": [\n {\n \"Addr\": \"172.18.255.201:9445\",\n \"ServerName\": \"\",\n \"Attributes\": null,\n \"BalancerAttributes\": null,\n \"Metadata\": null\n }\n ],\n \"Attributes\": null\n }\n ],\n \"ServiceConfig\": null,\n \"Attributes\": null\n}\n" -I0311 15:53:26.980284 2101307 clientconn.go:962] "[core] [Channel #1 SubChannel #2] Subchannel created\n" -I0311 15:53:26.980300 2101307 logging.go:43] "[core] [Channel #1] Channel Connectivity change to CONNECTING\n" -I0311 15:53:26.980365 2101307 logging.go:43] "[core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING\n" -I0311 15:53:26.980395 2101307 logging.go:43] "[core] [Channel #1 SubChannel #2] Subchannel picks a new address \"172.18.255.201:9445\" to connect\n" -I0311 15:53:26.980492 2101307 pickfirst.go:184] "[core] [pick-first-lb 0xc001813980] Received SubConn state update: 0xc001813bc0, {ConnectivityState:CONNECTING ConnectionError:}\n" -I0311 15:53:26.980803 2101307 logging.go:43] "[core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY\n" -I0311 15:53:26.980831 2101307 pickfirst.go:184] "[core] [pick-first-lb 0xc001813980] Received SubConn state update: 0xc001813bc0, {ConnectivityState:READY ConnectionError:}\n" -I0311 15:53:26.980845 2101307 logging.go:43] "[core] [Channel #1] Channel Connectivity change to READY\n" -I0311 15:53:26.994444 2101307 apiserver.go:297] Cert storage dir not provided, skipping webhook setup -I0311 15:53:26.994524 2101307 background.go:52] Background routine starting ... -I0311 15:53:26.996985 2101307 healthz.go:176] Installing health checkers for (/healthz): "ping","log","poststarthook/max-in-flight-filter","poststarthook/storage-object-count-tracker-hook" -I0311 15:53:26.997336 2101307 healthz.go:176] Installing health checkers for (/livez): "ping","log","poststarthook/max-in-flight-filter","poststarthook/storage-object-count-tracker-hook" -I0311 15:53:26.997732 2101307 healthz.go:176] Installing health checkers for (/readyz): "ping","log","poststarthook/max-in-flight-filter","poststarthook/storage-object-count-tracker-hook","shutdown" -I0311 15:53:26.998191 2101307 genericapiserver.go:484] MuxAndDiscoveryComplete has all endpoints registered and discovery information is complete -I0311 15:53:26.998572 2101307 dynamic_serving_content.go:132] "Starting controller" name="serving-cert::apiserver.local.config/certificates/apiserver.crt::apiserver.local.config/certificates/apiserver.key" -I0311 15:53:26.998666 2101307 tlsconfig.go:200] "Loaded serving cert" certName="serving-cert::apiserver.local.config/certificates/apiserver.crt::apiserver.local.config/certificates/apiserver.key" certDetail="\"localhost@1709900706\" [serving] validServingFor=[127.0.0.1,localhost,localhost] issuer=\"localhost-ca@1709900706\" (2024-03-08 11:25:05 +0000 UTC to 2025-03-08 11:25:05 +0000 UTC (now=2024-03-11 15:53:26.998640146 +0000 UTC))" -I0311 15:53:26.998865 2101307 named_certificates.go:53] "Loaded SNI cert" index=0 certName="self-signed loopback" certDetail="\"apiserver-loopback-client@1710172406\" [serving] validServingFor=[apiserver-loopback-client] issuer=\"apiserver-loopback-client-ca@1710172406\" (2024-03-11 14:53:26 +0000 UTC to 2025-03-11 14:53:26 +0000 UTC (now=2024-03-11 15:53:26.998844612 +0000 UTC))" -I0311 15:53:26.998890 2101307 secure_serving.go:210] Serving securely on [::]:9443 -I0311 15:53:26.998906 2101307 genericapiserver.go:589] [graceful-termination] waiting for shutdown to be initiated -I0311 15:53:26.998920 2101307 tlsconfig.go:240] "Starting DynamicServingCertificateController" -I0311 15:53:27.333650 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1/packagerevisions" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:27.333969 2101307 round_trippers.go:463] GET https://127.0.0.1:31000/apis/config.porch.kpt.dev/v1alpha1/repositories -I0311 15:53:27.333982 2101307 round_trippers.go:469] Request Headers: -I0311 15:53:27.333990 2101307 round_trippers.go:473] Accept: application/json, */* -I0311 15:53:27.333995 2101307 round_trippers.go:473] User-Agent: __debug_bin3534874763/v0.0.0 (linux/amd64) kubernetes/$Format -I0311 15:53:27.335504 2101307 round_trippers.go:574] Response Status: 200 OK in 1 milliseconds -I0311 15:53:27.336224 2101307 httplog.go:132] "HTTP" verb="LIST" URI="/apis/porch.kpt.dev/v1alpha1/packagerevisions?limit=500&resourceVersion=0" latency="2.73421ms" userAgent="kube-controller-manager/v1.29.2 (linux/amd64) kubernetes/4b8e819/metadata-informers" audit-ID="2bcc1626-35fb-495b-a4cf-fd99a83c7689" srcIP="172.18.0.2:24183" resp=200 -I0311 15:53:27.337502 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1/packagerevisions" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:27.337598 2101307 get.go:257] "Starting watch" path="/apis/porch.kpt.dev/v1alpha1/packagerevisions" resourceVersion="" labels="" fields="" timeout="9m23s" -I0311 15:53:27.337712 2101307 watchermanager.go:93] added watcher 0xc001a99080; there are now 1 active watchers and 1 slots -I0311 15:53:27.337793 2101307 round_trippers.go:463] GET https://127.0.0.1:31000/apis/config.porch.kpt.dev/v1alpha1/repositories -I0311 15:53:27.337803 2101307 round_trippers.go:469] Request Headers: -I0311 15:53:27.337809 2101307 round_trippers.go:473] Accept: application/json, */* -I0311 15:53:27.337813 2101307 round_trippers.go:473] User-Agent: __debug_bin3534874763/v0.0.0 (linux/amd64) kubernetes/$Format -I0311 15:53:27.338998 2101307 round_trippers.go:574] Response Status: 200 OK in 1 milliseconds -I0311 15:53:27.339083 2101307 watch.go:201] watch 0xc0025eb8f0: moving watch into streaming mode after sentAdd 0, sentBacklog 0, sentNewBacklog 0 -I0311 15:53:27.995010 2101307 background.go:76] Starting watch ... -I0311 15:53:27.995248 2101307 round_trippers.go:463] GET https://127.0.0.1:31000/apis/config.porch.kpt.dev/v1alpha1/repositories?allowWatchBookmarks=true&watch=true -I0311 15:53:27.995260 2101307 round_trippers.go:469] Request Headers: -I0311 15:53:27.995268 2101307 round_trippers.go:473] Accept: application/json, */* -I0311 15:53:27.995273 2101307 round_trippers.go:473] User-Agent: __debug_bin3534874763/v0.0.0 (linux/amd64) kubernetes/$Format -I0311 15:53:27.996235 2101307 round_trippers.go:574] Response Status: 200 OK in 0 milliseconds -I0311 15:53:27.996299 2101307 background.go:88] Watch successfully started. -I0311 15:53:29.226891 2101307 handler.go:133] porch-apiserver: GET "/apis" satisfied by gorestful with webservice /apis -I0311 15:53:29.227219 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis" latency="433.918µs" userAgent="" audit-ID="8a1a3928-6cb3-4cc1-87b2-1650858cbe05" srcIP="172.18.0.2:24183" resp=406 -I0311 15:53:29.227817 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:29.228088 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="394.332µs" userAgent="" audit-ID="7d0e929b-2f88-40de-8332-6070b1511f1e" srcIP="172.18.0.2:24183" resp=200 -I0311 15:53:29.318292 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:29.318395 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:29.318402 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:29.318466 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="265.744µs" userAgent="Go-http-client/2.0" audit-ID="75639942-377e-4154-8415-68a76ef6f3d4" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:29.318478 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:29.318527 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="197.304µs" userAgent="Go-http-client/2.0" audit-ID="ae8435b4-c8db-4660-86c5-19cd8305459e" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:29.318562 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="267.733µs" userAgent="Go-http-client/2.0" audit-ID="eda93660-81fa-4528-b30c-17769417f8b0" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:29.318589 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="163.598µs" userAgent="Go-http-client/2.0" audit-ID="df104da4-f2a8-4ac9-a18f-016efc24cd5d" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:29.318593 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:29.318746 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="220.87µs" userAgent="Go-http-client/2.0" audit-ID="1b821621-376c-494c-8490-4646d04a88e0" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:29.320659 2101307 secure_serving.go:296] http: TLS handshake error from 172.18.0.2:44304: EOF -I0311 15:53:29.320719 2101307 secure_serving.go:296] http: TLS handshake error from 172.18.0.2:11578: EOF -I0311 15:53:59.314770 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:59.314797 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:59.314774 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:59.314774 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:59.314996 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="400.618µs" userAgent="Go-http-client/2.0" audit-ID="82ea0403-a6b2-4222-abb4-de91f0d26a0c" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:59.315027 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="394.241µs" userAgent="Go-http-client/2.0" audit-ID="3e956684-e5aa-48ab-a2c3-fb896ef80017" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:59.314996 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="368.308µs" userAgent="Go-http-client/2.0" audit-ID="6f327a77-a5bb-4eec-b632-8ef9300d7472" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:59.314777 2101307 handler.go:143] porch-apiserver: GET "/apis/porch.kpt.dev/v1alpha1" satisfied by gorestful with webservice /apis/porch.kpt.dev/v1alpha1 -I0311 15:53:59.315181 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="587.412µs" userAgent="Go-http-client/2.0" audit-ID="ab5efec5-0f49-41fb-a058-b64d96933437" srcIP="172.18.0.2:6653" resp=200 -I0311 15:53:59.315200 2101307 httplog.go:132] "HTTP" verb="GET" URI="/apis/porch.kpt.dev/v1alpha1" latency="594.044µs" userAgent="Go-http-client/2.0" audit-ID="eecef25f-6825-4be7-94c9-86cc7e1966d4" srcIP="172.18.0.2:6653" resp=200 -I0311 15:54:00.364529 2101307 handler.go:153] porch-apiserver: GET "/openapi/v2" satisfied by nonGoRestful -I0311 15:54:00.364560 2101307 pathrecorder.go:241] porch-apiserver: "/openapi/v2" satisfied by exact match -I0311 15:54:00.380302 2101307 handler.go:153] porch-apiserver: GET "/openapi/v2" satisfied by nonGoRestful -I0311 15:54:00.380326 2101307 pathrecorder.go:241] porch-apiserver: "/openapi/v2" satisfied by exact match -I0311 15:54:00.380694 2101307 httplog.go:132] "HTTP" verb="GET" URI="/openapi/v2" latency="16.285147ms" userAgent="" audit-ID="35d93c8e-31a0-4b5e-8f5b-6bc76760b905" srcIP="172.18.0.2:24183" resp=304 -I0311 15:54:00.380740 2101307 httplog.go:132] "HTTP" verb="GET" URI="/openapi/v2" latency="540.523µs" userAgent="" audit-ID="b313e554-539d-4e3d-b4e0-223c2baf5a48" srcIP="172.18.0.2:24183" resp=304 -I0311 15:54:26.995316 2101307 background.go:115] Background task 2024-03-11 15:54:26.995287314 +0000 UTC m=+60.349999574 -I0311 15:54:26.995356 2101307 background.go:188] background-refreshing repositories -I0311 15:54:26.995487 2101307 round_trippers.go:463] GET https://127.0.0.1:31000/apis/config.porch.kpt.dev/v1alpha1/repositories -I0311 15:54:26.995496 2101307 round_trippers.go:469] Request Headers: -I0311 15:54:26.995504 2101307 round_trippers.go:473] Accept: application/json, */* -I0311 15:54:26.995509 2101307 round_trippers.go:473] User-Agent: __debug_bin3534874763/v0.0.0 (linux/amd64) kubernetes/$Format -I0311 15:54:26.997313 2101307 round_trippers.go:574] Response Status: 200 OK in 1 milliseconds -``` - -
- -Check that the apiservice is now Ready: +1. Check that the apiservice is now Ready: ``` kubectl get apiservice v1alpha1.porch.kpt.dev ``` @@ -375,11 +55,7 @@ Sample output: NAME SERVICE AVAILABLE AGE v1alpha1.porch.kpt.dev porch-system/api True 18m ``` - - Check the porch api-resources: - -We should now also have the `porch.kpt.dev/v1alpha1` resources available ``` kubectl api-resources | grep porch ``` @@ -396,7 +72,7 @@ packages porch.kpt.dev/v1alpha1 Check to ensure that the apiserver is serving requests: ``` -curl https://localhost:9443/apis/porch.kpt.dev/v1alpha1 -k +curl https://localhost:4443/apis/porch.kpt.dev/v1alpha1 -k ```
@@ -475,8 +151,30 @@ curl https://localhost:9443/apis/porch.kpt.dev/v1alpha1 -k ```
+# Build the CLI + +Build the porchctl CLI in the git root folder by + +``` +make porchctl +``` + +and then copy the result from `.build/porchctl` to somewhere in your $PATH. + + +# Run the end-to-end test +Make sure that the porch server is still running in VS Code and start the end-to-end tests from the git root folder as follows: +``` +E2E=1 go test -v ./test/e2e +``` + +and also: +``` +E2E=1 go test -v ./test/e2e/cli +``` + +Both of the above commands should succeed. -
# Create Repositories using your local Porch server From 030fd85eb52339bbbcee07657c070d23e9ad35f6 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Mon, 27 May 2024 22:36:42 +0200 Subject: [PATCH 09/32] Update the dev env setup docs --- .../porch-development-environment/README.md | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index a029c3a2..eeca0e3a 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -1,4 +1,17 @@ -# Setting up a development environment for Porch +# Table of contents + +- [Table of contents](#table-of-contents) +- [Setting up the development environment for Porch](#setting-up-the-development-environment-for-porch) + * [Setup the environment everything automatically](#setup-the-environment-everything-automatically) + * [Configure VSCode to run the Porch (api)server](#configure-vscode-to-run-the-porch-apiserver) + * [Build the CLI](#build-the-cli) + * [Test that everything works as expected](#test-that-everything-works-as-expected) + + [Run the porch unit tests](#run-the-porch-unit-tests) + + [Run the end-to-end tests](#run-the-end-to-end-tests) +- [Create Repositories using your local Porch server](#create-repositories-using-your-local-porch-server) +- [Restart from scratch](#restart-from-scratch) + +# Setting up the development environment for Porch This tutorial gives short instructions on how to set up a development environment for Porch. It outlines the steps to get a [kind](https://kind.sigs.k8s.io/) cluster up and running to which a Porch instance running in Visual Studio Code can connect to and interact with. @@ -6,16 +19,15 @@ It is highly recommended to go through the [Starting with Porch tutorial](https: > **_NOTE:_** The code itself can be run on a remote VM and we can use the [VSCode Remote SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) plugin to connect to it as our Dev environment. -
-# Setup the environment everything automatically +## Setup the environment everything automatically This [setup script](bin/setup.sh) automatically bulids a porch development environment. Please note that this is not the only possible way to build a working porch development environment, and feel free to customize your own. The setup script will perform the following steps: 1. Install a kind cluster. The name of the cluster is read from PORCH_TEST_CLUSTER environment variable, otherwise it defaults to `porch-test`. - The configuration of the cluster is taken from [here](kind_porch_test_cluster.yaml). + The configuration of the cluster is taken from [here](bin/kind_porch_test_cluster.yaml). 1. Install the MetalLB load balancer into the cluster, in order to `LoadBalancer` typed Services to work properly. @@ -36,8 +48,10 @@ The setup script will perform the following steps: That's it. If you want to run the steps manually, please use the code of the script as a detailed description. +The setup script is idempotent in the sense that you can rerun it without cleaning up first. This also means that if the script is interrupted for any reason, and you run it again it should continue the process where it left off. + -# Configure VSCode to run the Porch (api)server +## Configure VSCode to run the Porch (api)server After the environemnt is set you can start the porch API server localy on your machine. There are multiple ways to do that, the simplest is to run it in a VSCode IDE: @@ -151,7 +165,8 @@ curl https://localhost:4443/apis/porch.kpt.dev/v1alpha1 -k ``` -# Build the CLI + +## Build the CLI Build the porchctl CLI in the git root folder by @@ -162,20 +177,28 @@ make porchctl and then copy the result from `.build/porchctl` to somewhere in your $PATH. -# Run the end-to-end test -Make sure that the porch server is still running in VS Code and start the end-to-end tests from the git root folder as follows: +## Test that everything works as expected + +Make sure that the porch server is still running in VS Code and than run the following tests from the git root folder. + +### Run the porch unit tests + +``` +make test +``` + +### Run the end-to-end tests + +Test porch directly via its API: ``` E2E=1 go test -v ./test/e2e ``` -and also: +Test porch via its CLI: ``` E2E=1 go test -v ./test/e2e/cli ``` -Both of the above commands should succeed. - - # Create Repositories using your local Porch server To connect Porch to Gitea, follow [step 7 in the Starting with Porch](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch#Connect-the-Gitea-repositories-to-Porch) tutorial to create the repositories in Porch. @@ -207,4 +230,18 @@ external-blueprints git Package false True https://github.com/n management git Package false True http://172.18.255.200:3000/nephio/management.git ``` -You now have a locally running Porch (api)server. Happy developing! \ No newline at end of file +You now have a locally running Porch (api)server. Happy developing! + + +# Restart from scratch + +Sometimes the development cluster gets cluttered and you may experience weird behaviour from porch. +In this case you might want to restart with a clean slate, by deleting the dvelopemnt cluster with the follwoing command: +``` +kind delete cluster --name porch-test +``` + +and running the [setup script](bin/setup.sh) again: +``` +docs/tutorials/porch-development-environment/bin/setup.sh +``` \ No newline at end of file From d96f6db405d124b7daf043a81573a2fced81e6a8 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Mon, 27 May 2024 22:59:43 +0200 Subject: [PATCH 10/32] minor improvements in dev env documentation. --- .../porch-development-environment/README.md | 15 +++++++++------ .../porch-development-environment/bin/setup.sh | 11 ++++++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index eeca0e3a..b7d3b96e 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -31,20 +31,23 @@ The setup script will perform the following steps: 1. Install the MetalLB load balancer into the cluster, in order to `LoadBalancer` typed Services to work properly. -1. Install the Gitea git server into the cluster. This can be used to test porch during development, but it is not used in automated end-to-end tests. - - Gitea is exposed to the host via the port 3000. The GUI is accessible via the URL: http://localhost:3000/nephio , and also via: http://172.18.255.200:3000/nephio (username: nephio, password: secret). +1. Install the Gitea git server into the cluster. + This can be used to test porch during development, but it is not used in automated end-to-end tests. + Gitea is exposed to the host via port 3000. The GUI is accessible via http://localhost:3000/nephio, or http://172.18.255.200:3000/nephio (username: nephio, password: secret). > **_NOTE:_** If you are using WSL2 (Windows Subsystem for Linux), then Gitea is also accessible from the Windows host via the http://localhost:3000/nephio URL. -1. Generate the PKI resources (key pairs and certificates) necessary for end-to-end tests. +1. Generate the PKI resources (key pairs and certificates) required for end-to-end tests. 1. Install porch CRDs into the cluster. 1. Build the porch containers and loads them into the nodes of the kind cluster. -1. Deploy all porch components in the kind cluster, except the porch-server (porch's aggregated API server). - The script also exposes the function-runner service via 172.18.255.201:9445 +1. Deploy all porch components in the kind cluster, except the porch-server (porch's aggregated API server). + The function-runner service will be exposed to the host via 172.18.255.201:9445. + +1. Build the porch CLI binary. + The result will be generated as `.build/porchctl`. That's it. If you want to run the steps manually, please use the code of the script as a detailed description. diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index 28829b91..f33209d7 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -105,12 +105,10 @@ kubectl wait --namespace gitea statefulset gitea \ ############################################ h1 Create git repos in gitea curl -k -H "content-type: application/json" "http://nephio:secret@${gitea_ip}:3000/api/v1/user/repos" --data "{\"name\":\"$git_repo_name\"}" - TMP_DIR=$(mktemp -d) cd "$TMP_DIR" git clone "http://nephio:secret@${gitea_ip}:3000/nephio/$git_repo_name" cd "$git_repo_name" - if ! git rev-parse -q --verify refs/remotes/origin/main >/dev/null; then echo "Add main branch to git repo:" git switch -c main @@ -132,6 +130,7 @@ deployments/local/makekeys.sh ############################################ h1 Install CRDs +cd "${git_root}" kubectl apply -f api/porchconfig/v1alpha1/config.porch.kpt.dev_repositories.yaml kubectl apply -f api/porchconfig/v1alpha1/config.porch.kpt.dev_functions.yaml kubectl apply -f controllers/config/crd/bases/config.porch.kpt.dev_packagevariants.yaml @@ -141,6 +140,7 @@ kubectl apply -f internal/api/porchinternal/v1alpha1/config.porch.kpt.dev_packag ############################################ h1 Load container images into kind cluster +cd "${git_root}" export IMAGE_TAG=v2.0.0 export KIND_CONTEXT_NAME="$porch_cluster_name" if ! docker exec -it "$porch_cluster_name-control-plane" crictl images | grep -q docker.io/nephio/test-git-server ; then @@ -155,7 +155,7 @@ fi ############################################ h1 Install all porch components, except porch-server - +cd "${git_root}" make deployment-config-no-sa cd .build/deploy-no-sa # expose function-runner to local processes @@ -219,6 +219,11 @@ kpt fn render kpt live init || true kpt live apply --inventory-policy=adopt +############################################ +h1 "Build the porch CLI (.build/porchctl)" +cd "${git_root}" +make porchctl + ############################################ echo From c9c91f7269d7965cd3cd8ca3e38db01e86bfd9c7 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Mon, 27 May 2024 23:38:30 +0200 Subject: [PATCH 11/32] Document the requirement to register the api service in /etc/hosts for local porch-server test --- docs/tutorials/porch-development-environment/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index b7d3b96e..67428c81 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -191,13 +191,18 @@ make test ``` ### Run the end-to-end tests +In order for the end-to-end tests to run properly for a locally running API server, you have to add the following line to your `/etc/hosts` file: +``` +127.0.0.1 api.porch-system.svc +``` +TODO: remove this requirement -Test porch directly via its API: +To test porch directly via its API: ``` E2E=1 go test -v ./test/e2e ``` -Test porch via its CLI: +To test porch via its CLI: ``` E2E=1 go test -v ./test/e2e/cli ``` From 684dca84ad33bbbeca7318b9c0cf18844d496ac6 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:44:16 +0200 Subject: [PATCH 12/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 67428c81..11596844 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -15,7 +15,7 @@ This tutorial gives short instructions on how to set up a development environment for Porch. It outlines the steps to get a [kind](https://kind.sigs.k8s.io/) cluster up and running to which a Porch instance running in Visual Studio Code can connect to and interact with. -It is highly recommended to go through the [Starting with Porch tutorial](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch) before this one, if you are not familiar with how porch works. +if you are not familiar with how porch works, it is highly recommended that you go through the [Starting with Porch tutorial](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch) before going through this one. > **_NOTE:_** The code itself can be run on a remote VM and we can use the [VSCode Remote SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) plugin to connect to it as our Dev environment. From 9b3bffdcae85be9f7337d6f2efc0e6eec4ee11f9 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:51:07 +0200 Subject: [PATCH 13/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- .../porch-development-environment/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 11596844..311bc80f 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -17,7 +17,17 @@ This tutorial gives short instructions on how to set up a development environmen a [kind](https://kind.sigs.k8s.io/) cluster up and running to which a Porch instance running in Visual Studio Code can connect to and interact with. if you are not familiar with how porch works, it is highly recommended that you go through the [Starting with Porch tutorial](https://github.com/nephio-project/porch/tree/main/docs/tutorials/starting-with-porch) before going through this one. -> **_NOTE:_** The code itself can be run on a remote VM and we can use the [VSCode Remote SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) plugin to connect to it as our Dev environment. +> **_NOTE:_** As your Dev environment, you can run the code on a remote VM and use the [VSCode Remote SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) plugin to connect to it. + +### Extra steps for MacOS users +The script the `make deployment-config-no-sa` target to generate the deployment files for porch. The scripts called by this make target use recent `bash` additions and expect the gnu version of the `sed` command. MacOS comes with `bash` 3.x.x by default and with a version of `sed` that is incompatible with gnu `sed`. + +1. Install `bash` 4.x.x or better of `bash` using homebrew, see [this this post for details](https://apple.stackexchange.com/questions/193411/update-bash-to-version-4-0-on-osx) +2. Install `gsed` using homebrew, see [this post for details](https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux) +3. `sudo ln -s /opt/homebrew/bin/gsed /opt/homebrew/bin/sed` create a soft link for `sed` from `gsed` +4. Ensure that `/opt/homebrew/bin` is earlier in your path than `/bin` and `/usr/bin` + +> **_NOTE:_** The changes above **permanently** change the `bash` version and `sed` for **all** applications and may cause side effects. You may wish to revert the changes (particularly the `sed-->gsed` soft link) when you complete your work on Porch. ## Setup the environment everything automatically From 24e305e527791e8961571cbdf3d920c6d1932968 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:51:25 +0200 Subject: [PATCH 14/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 311bc80f..e95d7d78 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -33,7 +33,7 @@ The script the `make deployment-config-no-sa` target to generate the deployment ## Setup the environment everything automatically This [setup script](bin/setup.sh) automatically bulids a porch development environment. -Please note that this is not the only possible way to build a working porch development environment, and feel free to customize your own. +Please note that this is only one of many possible ways of building a working porch development environment so feel free to customize it to suit your own environment. The setup script will perform the following steps: 1. Install a kind cluster. The name of the cluster is read from PORCH_TEST_CLUSTER environment variable, otherwise it defaults to `porch-test`. From 004c683e0e21e112e97f1db20287234f4b7b2ea4 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:51:41 +0200 Subject: [PATCH 15/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index e95d7d78..d32b00ce 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -36,7 +36,7 @@ This [setup script](bin/setup.sh) automatically bulids a porch development envir Please note that this is only one of many possible ways of building a working porch development environment so feel free to customize it to suit your own environment. The setup script will perform the following steps: 1. Install a kind cluster. - The name of the cluster is read from PORCH_TEST_CLUSTER environment variable, otherwise it defaults to `porch-test`. + The name of the cluster is read from the PORCH_TEST_CLUSTER environment variable, otherwise it defaults to `porch-test`. The configuration of the cluster is taken from [here](bin/kind_porch_test_cluster.yaml). 1. Install the MetalLB load balancer into the cluster, in order to `LoadBalancer` typed Services to work properly. From 618d52d330e40994f2adb8edcc2b552d28ed903e Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:51:59 +0200 Subject: [PATCH 16/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index d32b00ce..86c7cf46 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -39,7 +39,7 @@ The setup script will perform the following steps: The name of the cluster is read from the PORCH_TEST_CLUSTER environment variable, otherwise it defaults to `porch-test`. The configuration of the cluster is taken from [here](bin/kind_porch_test_cluster.yaml). -1. Install the MetalLB load balancer into the cluster, in order to `LoadBalancer` typed Services to work properly. +1. Install the MetalLB load balancer into the cluster, in order to allow `LoadBalancer` typed Services to work properly. 1. Install the Gitea git server into the cluster. This can be used to test porch during development, but it is not used in automated end-to-end tests. From 596d200830b6b4945b3a6ca75cf3e122163bd6ef Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:52:12 +0200 Subject: [PATCH 17/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 86c7cf46..12927259 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -51,7 +51,7 @@ The setup script will perform the following steps: 1. Install porch CRDs into the cluster. -1. Build the porch containers and loads them into the nodes of the kind cluster. +1. Build the porch containers and load them into the nodes of the kind cluster. 1. Deploy all porch components in the kind cluster, except the porch-server (porch's aggregated API server). The function-runner service will be exposed to the host via 172.18.255.201:9445. From 76a40944ad948413d2b1d1c66a71a9822763cb0f Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:52:24 +0200 Subject: [PATCH 18/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 12927259..15b4b358 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -59,7 +59,7 @@ The setup script will perform the following steps: 1. Build the porch CLI binary. The result will be generated as `.build/porchctl`. -That's it. If you want to run the steps manually, please use the code of the script as a detailed description. +That's it! If you want to run the steps manually, please use the code of the script as a detailed description. The setup script is idempotent in the sense that you can rerun it without cleaning up first. This also means that if the script is interrupted for any reason, and you run it again it should continue the process where it left off. From 1c6cc25fb5e83052b6327fe9adefd16f5787a3f8 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:52:35 +0200 Subject: [PATCH 19/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 15b4b358..4196f856 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -66,7 +66,7 @@ The setup script is idempotent in the sense that you can rerun it without cleani ## Configure VSCode to run the Porch (api)server -After the environemnt is set you can start the porch API server localy on your machine. There are multiple ways to do that, the simplest is to run it in a VSCode IDE: +Once the environment is set up you can start the porch API server locally on your machine. There are multiple ways to do that, the simplest way is to run it in a VSCode IDE: 1. Edit your local `.vscode.launch.json` file as follows: Change the `--kubeconfig` argument of the `Launch Server` configuration to point to a KUBECONFIG file that is set to the kind cluster as the current context. From 7baa21632c04d0c05786f8ddbc86c625b2f1000a Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:52:49 +0200 Subject: [PATCH 20/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 4196f856..3d520335 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -68,7 +68,7 @@ The setup script is idempotent in the sense that you can rerun it without cleani Once the environment is set up you can start the porch API server locally on your machine. There are multiple ways to do that, the simplest way is to run it in a VSCode IDE: -1. Edit your local `.vscode.launch.json` file as follows: Change the `--kubeconfig` argument of the `Launch Server` configuration to point to a KUBECONFIG file that is set to the kind cluster as the current context. +1. Edit your local `.vscode/launch.json` file as follows: Change the `--kubeconfig` argument of the `Launch Server` configuration to point to a KUBECONFIG file that is set to the kind cluster as the current context. 1. You can now launch the Porch server locally in VSCode by selecting the "Launch Server" configuration on the VSCode "Run and Debug" window. for more information please refer to the [VSCode debugging documentation](https://code.visualstudio.com/docs/editor/debugging). From 108c0a57ef341a3cad563835eac191425517bced Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:53:06 +0200 Subject: [PATCH 21/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 3d520335..609e4305 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -70,7 +70,7 @@ Once the environment is set up you can start the porch API server locally on you 1. Edit your local `.vscode/launch.json` file as follows: Change the `--kubeconfig` argument of the `Launch Server` configuration to point to a KUBECONFIG file that is set to the kind cluster as the current context. -1. You can now launch the Porch server locally in VSCode by selecting the "Launch Server" configuration on the VSCode "Run and Debug" window. for +1. You can now launch the Porch server locally in VSCode by selecting the "Launch Server" configuration on the VSCode "Run and Debug" window. For more information please refer to the [VSCode debugging documentation](https://code.visualstudio.com/docs/editor/debugging). 1. Check that the apiservice is now Ready: From f3ca8fa6756ece207f64ab29ece5306cdee96b02 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:53:17 +0200 Subject: [PATCH 22/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 609e4305..9cf76f32 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -73,7 +73,7 @@ Once the environment is set up you can start the porch API server locally on you 1. You can now launch the Porch server locally in VSCode by selecting the "Launch Server" configuration on the VSCode "Run and Debug" window. For more information please refer to the [VSCode debugging documentation](https://code.visualstudio.com/docs/editor/debugging). -1. Check that the apiservice is now Ready: +1. Check that the apiservice is ready: ``` kubectl get apiservice v1alpha1.porch.kpt.dev ``` From 5b60313e3675f6198d488116a8ba5186769242ba Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:53:26 +0200 Subject: [PATCH 23/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 9cf76f32..7ac33cac 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -30,7 +30,7 @@ The script the `make deployment-config-no-sa` target to generate the deployment > **_NOTE:_** The changes above **permanently** change the `bash` version and `sed` for **all** applications and may cause side effects. You may wish to revert the changes (particularly the `sed-->gsed` soft link) when you complete your work on Porch. -## Setup the environment everything automatically +## Setup the environment for everything automatically This [setup script](bin/setup.sh) automatically bulids a porch development environment. Please note that this is only one of many possible ways of building a working porch development environment so feel free to customize it to suit your own environment. From 2b4db855310132ccffa7e4e89d7ecae9febfeb34 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:54:34 +0200 Subject: [PATCH 24/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 7ac33cac..883bc077 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -179,7 +179,7 @@ curl https://localhost:4443/apis/porch.kpt.dev/v1alpha1 -k -## Build the CLI +## Add the CLI binary to the path Build the porchctl CLI in the git root folder by From 8b02be8ea32506ab84236e550f1f2920fefa2bf6 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 12:54:50 +0200 Subject: [PATCH 25/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Liam Fallon <35595825+liamfallon@users.noreply.github.com> --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 883bc077..03fd36c6 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -187,7 +187,7 @@ Build the porchctl CLI in the git root folder by make porchctl ``` -and then copy the result from `.build/porchctl` to somewhere in your $PATH. +Copy the .build/porchctl` binary to somewhere in your $PATH. ## Test that everything works as expected From 4111d2e0d0ce4d2b52925a6cb986f7c04dffb116 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 13:01:20 +0200 Subject: [PATCH 26/32] Update docs/tutorials/porch-development-environment/README.md --- .../porch-development-environment/README.md | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 03fd36c6..e0039dd7 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -179,15 +179,9 @@ curl https://localhost:4443/apis/porch.kpt.dev/v1alpha1 -k -## Add the CLI binary to the path +## Add the CLI binary to your PATH -Build the porchctl CLI in the git root folder by - -``` -make porchctl -``` - -Copy the .build/porchctl` binary to somewhere in your $PATH. +Copy the `.build/porchctl` binary (that was built by the setup script) to somewhere in your $PATH. ## Test that everything works as expected @@ -201,11 +195,6 @@ make test ``` ### Run the end-to-end tests -In order for the end-to-end tests to run properly for a locally running API server, you have to add the following line to your `/etc/hosts` file: -``` -127.0.0.1 api.porch-system.svc -``` -TODO: remove this requirement To test porch directly via its API: ``` From 6facb88ed439ef074330e189b1aedac28af7ebbd Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 15:31:52 +0200 Subject: [PATCH 27/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Fiachra Corcoran --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index e0039dd7..f449c6cd 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -186,7 +186,7 @@ Copy the `.build/porchctl` binary (that was built by the setup script) to somewh ## Test that everything works as expected -Make sure that the porch server is still running in VS Code and than run the following tests from the git root folder. +Make sure that the porch server is still running in VS Code and than run the following tests from the project root. ### Run the porch unit tests From 505d3f1eeba61a9e76feb23a8136e7873aba2087 Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 15:32:29 +0200 Subject: [PATCH 28/32] Update docs/tutorials/porch-development-environment/README.md Co-authored-by: Fiachra Corcoran --- docs/tutorials/porch-development-environment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index f449c6cd..1a43124a 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -243,7 +243,7 @@ You now have a locally running Porch (api)server. Happy developing! # Restart from scratch Sometimes the development cluster gets cluttered and you may experience weird behaviour from porch. -In this case you might want to restart with a clean slate, by deleting the dvelopemnt cluster with the follwoing command: +In this case you might want to restart with a clean slate, by deleting the development cluster with the following command: ``` kind delete cluster --name porch-test ``` From 9836cd9da2e1db8a29a4008f11478fef6361022d Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 15:41:51 +0200 Subject: [PATCH 29/32] Update docs/tutorials/porch-development-environment/README.md --- .../porch-development-environment/README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/tutorials/porch-development-environment/README.md b/docs/tutorials/porch-development-environment/README.md index 1a43124a..7a1c2d41 100644 --- a/docs/tutorials/porch-development-environment/README.md +++ b/docs/tutorials/porch-development-environment/README.md @@ -88,13 +88,14 @@ kubectl api-resources | grep porch ``` Sample output: ``` -... - -functions porch.kpt.dev/v1alpha1 true Function -packagerevisionresources porch.kpt.dev/v1alpha1 true PackageRevisionResources -packagerevisions porch.kpt.dev/v1alpha1 true PackageRevision -packages porch.kpt.dev/v1alpha1 true Package - +packagerevs config.porch.kpt.dev/v1alpha1 true PackageRev +packagevariants config.porch.kpt.dev/v1alpha1 true PackageVariant +packagevariantsets config.porch.kpt.dev/v1alpha2 true PackageVariantSet +repositories config.porch.kpt.dev/v1alpha1 true Repository +functions porch.kpt.dev/v1alpha1 true Function +packagerevisionresources porch.kpt.dev/v1alpha1 true PackageRevisionResources +packagerevisions porch.kpt.dev/v1alpha1 true PackageRevision +packages porch.kpt.dev/v1alpha1 true PorchPackage ``` Check to ensure that the apiserver is serving requests: From c0d58ed30082e58af049fc1e849b093e724bf55d Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 15:49:07 +0200 Subject: [PATCH 30/32] dev-env setup script: de-duplicating CRD installation --- .../porch-development-environment/bin/setup.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index f33209d7..1693a539 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -128,16 +128,6 @@ h1 Generate certs and keys cd "${git_root}" deployments/local/makekeys.sh -############################################ -h1 Install CRDs -cd "${git_root}" -kubectl apply -f api/porchconfig/v1alpha1/config.porch.kpt.dev_repositories.yaml -kubectl apply -f api/porchconfig/v1alpha1/config.porch.kpt.dev_functions.yaml -kubectl apply -f controllers/config/crd/bases/config.porch.kpt.dev_packagevariants.yaml -kubectl apply -f controllers/config/crd/bases/config.porch.kpt.dev_packagevariantsets.yaml -kubectl apply -f internal/api/porchinternal/v1alpha1/config.porch.kpt.dev_packagerevs.yaml - - ############################################ h1 Load container images into kind cluster cd "${git_root}" From 2e27c1962e93e77b81faeaace569cf7ff6d6442a Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 16:09:15 +0200 Subject: [PATCH 31/32] dev-env setup script: actually remove porch-server from the deployment package (instead of just flagging it to be ignored) Co-authored-by: Fiachra Corcoran --- docs/tutorials/porch-development-environment/bin/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/porch-development-environment/bin/setup.sh b/docs/tutorials/porch-development-environment/bin/setup.sh index 1693a539..7a4bd9b0 100755 --- a/docs/tutorials/porch-development-environment/bin/setup.sh +++ b/docs/tutorials/porch-development-environment/bin/setup.sh @@ -162,11 +162,11 @@ for resource in ctx.resource_list["items"]: resource["spec"]["ports"][0]["nodePort"] = 30001' # "remove" porch-server from package kpt fn eval \ - --image gcr.io/kpt-fn/set-annotations:v0.1.4 \ + --image gcr.io/kpt-fn/starlark:v0.5.0 \ --match-kind Deployment \ --match-name porch-server \ --match-namespace porch-system \ - -- "config.kubernetes.io/local-config=true" + -- 'source=ctx.resource_list["items"] = []' # make the api service point to the local porch-server if [ "$(uname)" = "Darwin" ] then From af2b432b32e672ff6bcfdeee4c7d5019db39abad Mon Sep 17 00:00:00 2001 From: Istvan Kispal Date: Tue, 28 May 2024 16:12:05 +0200 Subject: [PATCH 32/32] Revert "Bump up local kube-apiserver version to 1.30.1 to keep it aligned with the go-client module" This reverts commit 8aa0e944a1ca83e63b639fdade4710d95a5a16f1. --- build/Dockerfile.apiserver | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/Dockerfile.apiserver b/build/Dockerfile.apiserver index 629970ad..0cacc1ce 100644 --- a/build/Dockerfile.apiserver +++ b/build/Dockerfile.apiserver @@ -15,13 +15,14 @@ FROM golang:1.22.2-bookworm as builder WORKDIR /workspace/src -RUN git clone https://github.com/kubernetes/kubernetes --branch v1.30.1 --depth=1 +RUN git clone https://github.com/kubernetes/kubernetes --branch v1.23.2 --depth=1 WORKDIR /workspace/src/kubernetes RUN apt-get update && apt-get install --yes rsync -RUN make kube-apiserver +RUN make generated_files +RUN CGO_ENABLED=0 go build -o /workspace/artifacts/kube-apiserver ./cmd/kube-apiserver FROM gcr.io/distroless/static -COPY --from=builder /workspace/src/kubernetes/_output/local/bin/linux/amd64/kube-apiserver /kube-apiserver +COPY --from=builder /workspace/artifacts/kube-apiserver /kube-apiserver #USER 65532:65532