You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setupLog.Error(errors.New(fmt.Sprintf("interval %s is invalid, must be greater than or equal to '30s'", healthCheckInterval)), "invalid health check interval")
201
201
os.Exit(1)
202
202
}
203
203
204
+
// Create a shared client cache to avoid re-authenticating (fetching new OAuth tokens)
205
+
// for every certificate request. Clients are cached by configuration hash.
206
+
clientCache:=command.NewClientCache()
207
+
setupLog.Info("initialized Command client cache for OAuth token reuse")
Copy file name to clipboardExpand all lines: e2e/README.md
+84-11Lines changed: 84 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,19 +13,30 @@ The test suite does the following:
13
13
This is currently configured as a Bash script, so it is necessary to run this on a UNIX-compatible machine.
14
14
15
15
## Requirements
16
-
- An available Command instance is running and configured as described in the [root README](../README.md#configuring-command)
17
-
- OAuth is used to communicate with Command
16
+
17
+
**Local tools:**
18
18
- Docker (>= 28.2.2)
19
-
- Minikube (>= v1.35.0)
20
19
- kubectl (>= v1.32.2)
21
20
- helm (>= v3.17.1)
22
21
- cmctl (>= v2.1.1)
22
+
- Minikube (>= v1.35.0) - only required if using `USE_MINIKUBE=true`
23
+
24
+
**Kubernetes cluster:**
25
+
- By default, tests run against your current kubeconfig context
26
+
- Set `USE_MINIKUBE=true` to use minikube instead
27
+
28
+
**Command instance:**
29
+
- An available Command instance configured as described in the [root README](../README.md#configuring-command)
30
+
- OAuth credentials for API access
31
+
- An enrollment pattern (default: "Default Pattern") with CSR Enrollment enabled
32
+
- A security role (default: "InstanceOwner") with Enrollment permissions
23
33
24
34
On the Command side:
25
35
- An enrollment pattern is created called "Test Enrollment Pattern" that is has CSR Enrollment, CSR Generation, and PFX Enrollment enabled
26
36
- A security role by the name of "InstanceOwner" exists and has the ability to perform Enrollment
27
37
28
38
## Configuring the environment variables
39
+
29
40
command-cert-manager-issuer interacts with an external Command instance. An environment variable file `.env` can be used to store the environment variables to be used to talk to the Command instance.
30
41
31
42
A `.env.example` file is available as a template for your environment variables.
@@ -35,24 +46,86 @@ A `.env.example` file is available as a template for your environment variables.
35
46
cp .env.example .env
36
47
```
37
48
38
-
Modify the fields as needed.
49
+
### Required variables
50
+
51
+
| Variable | Description |
52
+
|----------|-------------|
53
+
|`HOSTNAME`| Command instance hostname |
54
+
|`API_PATH`| API path (default: `KeyfactorAPI`) |
55
+
|`OAUTH_TOKEN_URL`| OAuth token endpoint URL |
56
+
|`OAUTH_CLIENT_ID`| OAuth client ID |
57
+
|`OAUTH_CLIENT_SECRET`| OAuth client secret |
58
+
|`CERTIFICATE_TEMPLATE`| Certificate template short name |
59
+
|`CERTIFICATE_AUTHORITY_LOGICAL_NAME`| CA logical name in Command |
60
+
61
+
### Optional variables
62
+
63
+
| Variable | Description | Default |
64
+
|----------|-------------|---------|
65
+
|`IMAGE_TAG`| Docker image version to test |`2.5.0`|
66
+
|`HELM_CHART_VERSION`| Helm chart version |`2.5.0`|
67
+
|`E2E_ENROLLMENT_PATTERN_NAME`| Enrollment pattern name |`Default Pattern`|
68
+
|`E2E_OWNER_ROLE_NAME`| Owner role name |`InstanceOwner`|
69
+
|`DISABLE_CA_CHECK`| Skip TLS CA verification |`false`|
70
+
|`USE_MINIKUBE`| Use minikube instead of current kubeconfig |`false`|
71
+
|`IMAGE_REGISTRY`| Registry to push local builds (when `IMAGE_TAG=local`) | - |
39
72
40
73
## Configuring the trusted certificate store
74
+
41
75
The issuer created in the end-to-end tests can leverage the `caSecretName` specification to determine a collection of CAs to trust in order to establish a trusted connection with the remote Keyfactor Command instance. The certificates defined in this secret will be pulled from the `certs` folder in this directory.
42
76
43
-
Please place the CA certificates for the Keyfactor Command instance you'd like to connect to (the intermediate and/or root CAs) under `certs` directory.
77
+
Place the CA certificates for the Keyfactor Command instance you'd like to connect to (the intermediate and/or root CAs) under `certs` directory.
44
78
45
79
> NOTE: This check can be disabled by setting the env variable `DISABLE_CA_CHECK=true`.
46
80
47
-
## Running the script
81
+
## Running the tests
82
+
83
+
### Using current kubeconfig context (default)
84
+
85
+
```bash
86
+
# Configure your .env file first
87
+
source .env
88
+
89
+
# Run the tests
90
+
./run_tests.sh
91
+
```
92
+
93
+
Or from the project root:
94
+
```bash
95
+
make test-e2e
96
+
```
97
+
98
+
### Using minikube
48
99
49
100
```bash
50
-
# enable the script to be executed
51
-
chmod +x ./run_tests.sh
101
+
export USE_MINIKUBE=true
102
+
source .env
103
+
./run_tests.sh
104
+
```
52
105
53
-
# load the environment variables
106
+
### Testing a specific version
107
+
108
+
```bash
109
+
export IMAGE_TAG="2.4.0"
110
+
export HELM_CHART_VERSION="2.4.0"
54
111
source .env
112
+
./run_tests.sh
113
+
```
55
114
56
-
# run the end-to-end tests
115
+
### Testing local changes
116
+
117
+
```bash
118
+
# With minikube (image built directly into minikube's docker)
119
+
export IMAGE_TAG="local"
120
+
export HELM_CHART_VERSION="local"
121
+
export USE_MINIKUBE=true
122
+
source .env
57
123
./run_tests.sh
58
-
```
124
+
125
+
# With a remote cluster (requires pushing to a registry)
0 commit comments