Skip to content

Commit

Permalink
Make manager the default container (vmware-tanzu#384)
Browse files Browse the repository at this point in the history
This change makes `manager` the default container so that commands
like `kubectl exec` and `kubectl logs` pick that container by default.

Also handle a few trivial things like:
- Changing the now unsupported `verbosity` with `-v` flag in kind load
- Removing the incorrect kustomize path since we now add HOSTOSARCH in
the binary path

*Testing Done*:
- Generated the manifests and verified that the annotation is present:
$ grep -r 'kubectl.kubernetes.io/default-container: manager' artifacts/local-deployment.yaml
artifacts/local-deployment.yaml:
kubectl.kubernetes.io/default-container: manager

- Verified that kubectl logs pick up the default container

╭─parunesh@parunesh-a01 ~/go/src/aruneshpa/vm-operator ‹topic/parunesh/VMSVC-1677/make-manager-the-default-container›
╰─$ k logs -n vmware-system-vmop vmware-system-vmop-controller-manager-6f8d6f8c78-wh5z8 | head
Defaulted container "manager" out of: manager, kube-rbac-proxy
I0206 20:42:47.145487       1 main.go:53] entrypoint "msg"="Starting VM Operator controller" "buildnumber"="00000000" "buildtype"="dev" "commit"="42c578ddf9bd43d579475ddf23948f6a3fa7fc53" "version"="1.8.0-479-g42c578dd"
  • Loading branch information
aruneshpa authored Feb 7, 2024
1 parent af9c0ad commit cb30275
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ deploy-local-kind: docker-build load-kind ## Deploy controller in the kind clust

.PHONY: load-kind
load-kind: ## Load the image into the kind cluster
kind load docker-image $(IMG) --name $(KIND_CLUSTER_NAME) --loglevel debug
kind load docker-image $(IMG) --name $(KIND_CLUSTER_NAME) -v 10

## --------------------------------------
## Development - run
Expand Down
1 change: 1 addition & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resources:
- ../crd/external-crds/topology.tanzu.vmware.com_vspherezones.yaml

patchesStrategicMerge:
- manager_default_container_patch.yaml
- manager_auth_proxy_patch.yaml
- manager_webhook_patch.yaml
- manager_replicas_patch.yaml
Expand Down
10 changes: 10 additions & 0 deletions config/default/manager_default_container_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This patch marks "manager" as the default container. This means `kubectl logs` and
# `kubectl exec` will pick the "manager" container unless a different container is
# specified using the --container flag.
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
annotations:
kubectl.kubernetes.io/default-container: manager
4 changes: 3 additions & 1 deletion hack/deploy-local-certmanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ CERT_MANAGER_URL="${CERT_MANAGER_URL:?}"

mkdir -p artifacts

./hack/tools/bin/kustomize build \
# Since we modify the PATH var at the beginning of Makefile, kustomize
# should always be available.
kustomize build \
--load-restrictor LoadRestrictionsNone \
"${CERT_MANAGER_URL}" \
>artifacts/cert-manager.yaml
Expand Down

0 comments on commit cb30275

Please sign in to comment.