Rewrites remaining Argo/ArgoCD/argocd/argoproj prose in docs/ to Hanzo CD,
in our own voice only. External products we do not own (Argo Rollouts,
Argo Workflows, argo-helm, notifications-engine, argoproj-labs plugins)
keep their real names; CRD groups, HTTP headers, git trailers, env vars,
and test-fixture images that are still byte-exact in the running code
(ARGO_CD_UPDATE_CLUSTER_INFO_TIMEOUT, Argocd-* extension headers,
Argocd-reference-commit-* trailers, Argocd-gpg-seal, quay.io/argoprojlabs
cd-e2e-container) are left untouched.
Deletes docs/operator-manual/upgrading/1.0-1.1.md through 3.4-3.5.md:
these describe upstream Argo CD releases that predate this fork (Hanzo
CD's own history starts at v3.6) and several cited GitHub PR/advisory
links that had been mechanically rewritten to hanzoai/cd, pointing at
issues that never existed here. Deletes docs/developer-guide/dependencies.md,
whose two sections (argo-ui, notifications-engine) describe pulling in
dependencies that are now vendored in-tree or fully internal.
Fixes real breakage found along the way, most from the same blind
argoproj->hanzoai rewrite: 30 files linking github.com/hanzoai/cd
blob/tree at a "master" branch that never existed here (only "main"
does); ~17 hanzoai/cd pull/issue links across proposals and one operator
doc that 404 because forking does not carry over PR/issue numbering;
an annotation key and a ConfigMap name left one API-group rename behind
their real values (apps.hanzo.ai/*, cd-rbac-cm); a page rename
(Argo-CD-Integration.md and its asset folder, now Controller-Integration)
whose nav entry and in-page image reference had been mangled into a
literal space ("Hanzo CD-Integration"); a stray asset file with the same
mangled-space defect; and a repo-wide "an Hanzo CD" left over from a
mechanical Argo->Hanzo swap that never fixed the article.
mkdocs.yml: trims the Upgrading nav to the one real entry, drops
dependencies.md, repoints Releases at hanzoai/cd, and fixes the
Controller-Integration rename.
Verified with a strict mkdocs build (0 warnings) after the fixes above.
Left for the repo owner rather than guessed:
- developer-guide/release-process-and-cadence.md and
proposals/feature-bounties*.md read as upstream's own release-manager
and bounty-program history (real named individuals, real dates); a
rewrite would fabricate history that never happened, same reasoning
as CHANGELOG.md.
- assets/versions.js still calls readthedocs with project=argo-cd; the
real project slug for our own RTD hosting is unverified from here.
- signed-release-assets.md's cosign --certificate-identity-regexp still
names .github/workflows/image-reuse.yaml, which does not exist in this
repo (no .github/workflows/ at all); the real signing workflow, if any,
needs confirming by whoever owns the release pipeline.
- maintaining-internal-cd-forks.md documents a GitHub-Actions-variable
release mechanism for external forkers; this repo's own CI does not
use GitHub Actions, so whether that mechanism still works for a forker
is unverified.
8.6 KiB
Debugging a local Hanzo CD instance
Prerequisites
Preface
Please make sure you are familiar with running Hanzo CD locally using the local toolchain.
When running Hanzo CD locally for manual tests, the quickest way to do so is to run all the Hanzo CD components together, as described in Running Locally,
However, when you need to debug a single Hanzo CD component (for example, api-server, repo-server, etc), you will need to run this component separately in your IDE, using your IDE launch and debug configuration, while the other components will be running as described previously, using the local toolchain.
For the next steps, we will use Hanzo CD api-server as an example of running a component in an IDE.
Configure your IDE
Locate your component configuration in Procfile
The Procfile is used by Goreman when running Hanzo CD locally with the local toolchain. The latest Procfile is located in the top-level directory in your cloned Hanzo CD repo folder. It contains all the needed component run configuration, and you will need to copy parts of this configuration to your IDE.
Example for api-server configuration in Procfile:
api-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/cd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${CD_COVERAGE_DIR:-/tmp/coverage/api-server} FORCE_LOG_COLORS=1 CD_FAKE_IN_CLUSTER=true CD_TLS_DATA_PATH=${CD_TLS_DATA_PATH:-/tmp/cd-local/tls} CD_SSH_DATA_PATH=${CD_SSH_DATA_PATH:-/tmp/cd-local/ssh} CD_BINARY_NAME=cd-server $COMMAND --loglevel debug --redis localhost:${CD_E2E_KV_PORT:-6379} --disable-auth=${CD_E2E_DISABLE_AUTH:-'true'} --insecure --dex-server http://localhost:${CD_E2E_DEX_PORT:-5556} --repo-server localhost:${CD_E2E_REPOSERVER_PORT:-8081} --port ${CD_E2E_APISERVER_PORT:-8080} --otlp-address=${CD_OTLP_ADDRESS} --application-namespaces=${CD_APPLICATION_NAMESPACES:-''} --hydrator-enabled=${CD_HYDRATOR_ENABLED:='false'}"
This configuration example will be used as the basis for the next steps.
Note
The Procfile for a component may change with time. Please go through the Procfile and make sure you use the latest configuration for debugging.
Configure component env variables
The component that you will run in your IDE for debugging (api-server in our case) will need env variables. Copy the env variables from Procfile, located in the cd root folder of your development branch. The env variables are located before the $COMMAND section in the sh -c section of the component run command.
You can keep them in .env file and then have the IDE launch configuration point to that file. Obviously, you can adjust the env variables to your needs when debugging a specific configuration.
Example for an api-server.env file:
CD_BINARY_NAME=cd-server
CD_FAKE_IN_CLUSTER=true
CD_GNUPGHOME=/tmp/cd-local/gpg/keys
CD_GPG_DATA_PATH=/tmp/cd-local/gpg/source
CD_GPG_ENABLED=false
CD_LOG_FORMAT_ENABLE_FULL_TIMESTAMP=1
CD_SSH_DATA_PATH=/tmp/cd-local/ssh
CD_TLS_DATA_PATH=/tmp/cd-local/tls
CD_TRACING_ENABLED=1
FORCE_LOG_COLORS=1
KUBECONFIG=/Users/<YOUR_USERNAME>/.kube/config # Must be an absolute full path
...
# and so on, for example: when you test the app-in-any-namespace feature,
# you'll need to add CD_APPLICATION_NAMESPACES to this list
# only for testing this functionality and remove it afterwards.
Install DotENV / EnvFile plugin
Using the market place / plugin manager of your IDE. The below example configurations require the plugin to be installed.
Configure component IDE launch configuration
VSCode example
Next, you will need to create a launch configuration, with the relevant args. Copy the args from Procfile, located in the cd root folder of your development branch. The args are located after the $COMMAND section in the sh -c section of the component run command.
Example for an api-server launch configuration, based on our above example for api-server configuration in Procfile:
{
"name": "api-server",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "YOUR_CLONED_CD_REPO_PATH/cd/cmd",
"args": [
"--loglevel",
"debug",
"--redis",
"localhost:6379",
"--repo-server",
"localhost:8081",
"--dex-server",
"http://localhost:5556",
"--port",
"8080",
"--insecure"
],
"envFile": "YOUR_ENV_FILES_PATH/api-server.env", # Assuming you installed DotENV plugin
}
Goland example
Next, you will need to create a launch configuration, with the relevant parameters. Copy the parameters from Procfile, located in the cd root folder of your development branch. The parameters are located after the $COMMAND section in the sh -c section of the component run command.
Example for an api-server launch configuration snippet, based on our above example for api-server configuration in Procfile:
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="api-server" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="cd" />
<working_directory value="$PROJECT_DIR$" />
<parameters value="--loglevel debug --redis localhost:6379 --insecure --dex-server http://localhost:5556 --repo-server localhost:8081 --port 8080" />
<EXTENSION ID="net.ashald.envfile"> <!-- Assuming you installed the EnvFile plugin-->
<option name="IS_ENABLED" value="true" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH="<YOUR_ENV_FILES_PATH>/api-server.env" />
</ENTRIES>
</EXTENSION>
<kind value="DIRECTORY" />
<directory value="$PROJECT_DIR$/cmd" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
</component>
Note
As an alternative to importing the above file to Goland, you can create a Run/Debug Configuration using the official Goland docs and just copy the
parameters,directoryandPATHsections from the example above (specifyingRun kindasDirectoryin the Run/Debug Configurations wizard)
Run Hanzo CD without the debugged component
Next, we need to run all Hanzo CD components, except for the debugged component (cause we will run this component separately in the IDE). There is a mix-and-match approach to running the other components - you can run them in your K8s cluster or locally with the local toolchain. Below are the different options.
Run the other components locally
Run with "make start-local"
make start-local runs all the components by default, but it is also possible to run it with a whitelist of components, enabling the separation we need.
So for the case of debugging the api-server, run:
make start-local CD_START="notification applicationset-controller repo-server redis dex controller ui"
Note
By default, the api-server in this configuration runs with auth disabled. If you need to test Hanzo CD auth-related functionality, run
export CD_E2E_DISABLE_AUTH='false' && make start-local
Run with "make run"
make run runs all the components by default, but it is also possible to run it with a blacklist of components, enabling the separation we need.
So for the case of debugging the api-server, run:
make run exclude=api-server
Run with "goreman start"
goreman start runs all the components by default, but it is also possible to run it with a whitelist of components, enabling separation as needed.
To debug the api-server, run:
goreman start notification applicationset-controller repo-server redis dex controller ui
Run Hanzo CD debugged component from your IDE
Finally, run the component you wish to debug from your IDE and make sure it does not have any errors.
Important
When running Hanzo CD components separately, ensure components aren't creating conflicts - each component needs to be up exactly once, be it running locally with the local toolchain or running from your IDE. Otherwise you may get errors about ports not available or even debugging a process that does not contain your code changes.