Skip to content

Fix getting-started guide: Use full paths for YAML files and correct kubeconfig references#1451

Merged
devdattakulkarni merged 3 commits intocloud-ark:masterfrom
anniegracehu:update-getting-started-directory-instructions
Feb 9, 2026
Merged

Fix getting-started guide: Use full paths for YAML files and correct kubeconfig references#1451
devdattakulkarni merged 3 commits intocloud-ark:masterfrom
anniegracehu:update-getting-started-directory-instructions

Conversation

@anniegracehu
Copy link
Copy Markdown
Collaborator

@anniegracehu anniegracehu commented Jan 26, 2026

Summary

This PR fixes the Network Isolation Testing section in examples/getting-started.md and the kubectl-allow-network-traffic / kubectl-deny-network-traffic plugin wrappers so that:

  1. Commands work correctly when run from the repository root (no directory changes needed)
  2. The documented -k flag works as advertised
  3. CRD registration timing issues are prevented

Changes

Getting Started Guide (examples/getting-started.md)

YAML file paths: Changed from relative filenames (requiring cd into subdirectories) to full relative paths from repository root:

  • examples/multitenancy/hello-world/hello-world-service-composition.yaml
  • examples/multitenancy/hello-world/hs1.yaml
  • examples/multitenancy/hello-world/hs2.yaml
  • examples/multitenancy/hello-world/hs1-no-replicas.yaml
  • examples/multitenancy/hello-world/hs2-no-replicas.yaml

Kubeconfig filename: Changed from provider.conf to kubeplus-saas-provider.json (the actual file created by provider-kubeconfig.py in the root directory).

CRD wait step: Added a wait loop between ResourceComposition creation and instance creation to ensure the HelloWorldService CRD is registered, preventing "resource mapping not found" errors.

Network traffic commands: Updated to include -k kubeplus-saas-provider.json flag (now works correctly with the wrapper fix below).

Plugin Wrappers (plugins/kubectl-allow-network-traffic, plugins/kubectl-deny-network-traffic)

Fixed -k flag parsing: The wrappers now reorder arguments so that -k (when present) comes before the subcommand, matching what argparse expects.

Current behavior (on master): kubectl allow-network-traffic hs1 hs2 -k file → wrapper passes allow hs1 hs2 -k file → argparse fails

Fixed behavior (this PR): kubectl allow-network-traffic hs1 hs2 -k file → wrapper reorders to -k file allow hs1 hs2 → argparse parses correctly

This makes the documented CLI shape (kubectl allow network traffic <ns1> <ns2> [-k <kubeconfig>]) work as intended.

Testing

Verified end-to-end on Minikube with Cilium CNI:

  1. ✅ Fresh Minikube cluster (minikube start --cni=cilium)
  2. ✅ KubePlus installation and provider kubeconfig generation
  3. ✅ HelloWorldService ResourceComposition creation and CRD registration wait
  4. ✅ HelloWorldService instance creation (hs1, hs2)
  5. ✅ Network traffic allow: kubectl allow-network-traffic hs1 hs2 -k kubeplus-saas-provider.json
  6. ✅ Network traffic deny: kubectl deny-network-traffic hs1 hs2 -k kubeplus-saas-provider.json

All commands work correctly from the repository root without requiring directory changes.

…t kubeconfig

Update all YAML file references to use full relative paths from repository root:
- examples/multitenancy/hello-world/hello-world-service-composition.yaml
- examples/multitenancy/hello-world/hs1.yaml
- examples/multitenancy/hello-world/hs2.yaml
- examples/multitenancy/hello-world/hs1-no-replicas.yaml
- examples/multitenancy/hello-world/hs2-no-replicas.yaml

Update all kubeconfig references to use kubeplus-saas-provider.json (the
actual file created by provider-kubeconfig.py in the root directory) instead
of provider.conf.

This allows users to run commands from the repository root without
needing to change directories or create additional config files.
- Update getting-started.md to use full paths for YAML files from repo root
- Fix kubeconfig references to use kubeplus-saas-provider.json (actual file created)
- Add CRD wait step before creating HelloWorldService instances
- Fix kubectl-allow-network-traffic and kubectl-deny-network-traffic wrappers
  to properly handle -k flag by reordering arguments for argparse compatibility
- Add -k flag back to allow/deny commands in getting-started guide

This allows users to run all commands from the repository root without
needing to change directories, and ensures the -k flag works correctly
as documented in kubectl-kubeplus-commands help text.
ns2="$2"
shift 2

# "$@" now contains any remaining flags (e.g. -k kubeplus-saas-provider.json)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

shift 2

# "$@" now contains any remaining flags (e.g. -k kubeplus-saas-provider.json)
python3 "$KUBEPLUS_HOME/plugins/network_traffic.py" "$@" allow "$ns1" "$ns2"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By shifting out ns1 and ns2, there is no issue of duplicates in $@.

@devdattakulkarni
Copy link
Copy Markdown
Contributor

@anniegracehu Looks good!!

# This wrapper passes all arguments to our Python script.
python3 "$KUBEPLUS_HOME/plugins/network_traffic.py" allow "$@"
# Usage (as advertised in kubectl-kubeplus-commands):
# kubectl allow network traffic <ns1> <ns2> [-k <kubeconfig>]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this change work if we don't provide the kubeconfig parameter (i.e., if -k is missing)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it works without -k.
Without -k, the plugin uses the default kubeconfig. For me, that is the same cluster with enough access, so it works
Screenshot 2026-02-03 at 9 08 56 AM

@anniegracehu anniegracehu self-assigned this Feb 3, 2026
@devdattakulkarni devdattakulkarni merged commit 78f205d into cloud-ark:master Feb 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants