@@ -41,27 +41,35 @@ type InstallationConfig struct {
41
41
// InstallGatewayAPI installs the specified version of the Gateway API resources.
42
42
func InstallGatewayAPI (apiVersion string ) ([]byte , error ) {
43
43
apiPath := fmt .Sprintf ("%s/v%s/standard-install.yaml" , gwInstallBasePath , apiVersion )
44
+ GinkgoWriter .Printf ("Installing Gateway API version %q at API path %q\n " , apiVersion , apiPath )
44
45
45
46
cmd := exec .CommandContext (
46
47
context .Background (),
47
48
"kubectl" , "apply" , "-f" , apiPath ,
48
49
)
49
50
output , err := cmd .CombinedOutput ()
50
51
if err != nil {
52
+ GinkgoWriter .Printf ("Error installing Gateway API version %q: %v\n " , apiVersion , err )
53
+
51
54
return output , err
52
55
}
56
+ GinkgoWriter .Printf ("Successfully installed Gateway API version %q\n " , apiVersion )
53
57
54
58
return nil , nil
55
59
}
56
60
57
61
// UninstallGatewayAPI uninstalls the specified version of the Gateway API resources.
58
62
func UninstallGatewayAPI (apiVersion string ) ([]byte , error ) {
59
63
apiPath := fmt .Sprintf ("%s/v%s/standard-install.yaml" , gwInstallBasePath , apiVersion )
64
+ GinkgoWriter .Printf ("Uninstalling Gateway API version %q at API path %q\n " , apiVersion , apiPath )
60
65
61
66
output , err := exec .CommandContext (context .Background (), "kubectl" , "delete" , "-f" , apiPath ).CombinedOutput ()
62
67
if err != nil && ! strings .Contains (string (output ), "not found" ) {
68
+ GinkgoWriter .Printf ("Error uninstalling Gateway API version %q: %v\n " , apiVersion , err )
69
+
63
70
return output , err
64
71
}
72
+ GinkgoWriter .Printf ("Successfully uninstalled Gateway API version %q\n " , apiVersion )
65
73
66
74
return nil , nil
67
75
}
@@ -94,9 +102,14 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
94
102
95
103
// CreateLicenseSecret creates the NGINX Plus JWT secret.
96
104
func CreateLicenseSecret (k8sClient client.Client , namespace , filename string ) error {
105
+ GinkgoWriter .Printf ("Creating NGINX Plus license secret in namespace %q from file %q\n " , namespace , filename )
106
+
97
107
conf , err := os .ReadFile (filename )
98
108
if err != nil {
99
- return fmt .Errorf ("error reading file %q: %w" , filename , err )
109
+ readFileErr := fmt .Errorf ("error reading file %q: %w" , filename , err )
110
+ GinkgoWriter .Printf ("ERROR: %v\n " , readFileErr )
111
+
112
+ return readFileErr
100
113
}
101
114
102
115
ctx , cancel := context .WithTimeout (context .Background (), DefaultTimeoutConfig ().CreateTimeout )
@@ -109,7 +122,10 @@ func CreateLicenseSecret(k8sClient client.Client, namespace, filename string) er
109
122
}
110
123
111
124
if err := k8sClient .Create (ctx , ns ); err != nil && ! apierrors .IsAlreadyExists (err ) {
112
- return fmt .Errorf ("error creating namespace: %w" , err )
125
+ createNSErr := fmt .Errorf ("error creating namespace: %w" , err )
126
+ GinkgoWriter .Printf ("ERROR: %v\n " , createNSErr )
127
+
128
+ return createNSErr
113
129
}
114
130
115
131
secret := & core.Secret {
@@ -123,7 +139,10 @@ func CreateLicenseSecret(k8sClient client.Client, namespace, filename string) er
123
139
}
124
140
125
141
if err := k8sClient .Create (ctx , secret ); err != nil && ! apierrors .IsAlreadyExists (err ) {
126
- return fmt .Errorf ("error creating secret: %w" , err )
142
+ createSecretErr := fmt .Errorf ("error creating secret: %w" , err )
143
+ GinkgoWriter .Printf ("ERROR: %v\n " , createSecretErr )
144
+
145
+ return createSecretErr
127
146
}
128
147
129
148
return nil
@@ -170,6 +189,7 @@ func UninstallNGF(cfg InstallationConfig, k8sClient client.Client) ([]byte, erro
170
189
args := []string {
171
190
"uninstall" , cfg .ReleaseName , "--namespace" , cfg .Namespace ,
172
191
}
192
+ GinkgoWriter .Printf ("Uninstalling NGF with command: helm %v\n " , strings .Join (args , " " ))
173
193
174
194
output , err := exec .CommandContext (context .Background (), "helm" , args ... ).CombinedOutput ()
175
195
if err != nil && ! strings .Contains (string (output ), "release: not found" ) {
@@ -204,6 +224,7 @@ func UninstallNGF(cfg InstallationConfig, k8sClient client.Client) ([]byte, erro
204
224
func setTelemetryArgs (cfg InstallationConfig ) []string {
205
225
var args []string
206
226
227
+ GinkgoWriter .Printf ("Setting telemetry to %v\n " , cfg .Telemetry )
207
228
if cfg .Telemetry {
208
229
args = append (args , formatValueSet ("nginxGateway.productTelemetry.enable" , "true" )... )
209
230
} else {
0 commit comments