Skip to content

Commit 4629d79

Browse files
committed
Force out-of-cluster installation with Docker EE.
1 parent 045a8a2 commit 4629d79

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

cli/cmd/install.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,15 @@ func discoverInstallationEnvironment() error {
230230
useKubernetesRBAC = true
231231
if ucpBearerToken != "" || ucpHost != "" {
232232
useKubernetesRBAC = false
233+
233234
if ucpClient, err = ucpclient.NewClient(ucpHost, ucpBearerToken); err != nil {
234235
return err
235236
}
237+
238+
if inCluster {
239+
log.Info("In-cluster installation is not supported with Docker EE, running outside cluster.")
240+
inCluster = false
241+
}
236242
}
237243

238244
// Prepare input file paths
@@ -1634,6 +1640,19 @@ func installTridentInCluster() (returnError error) {
16341640
commandArgs = append(commandArgs, "--trident-image")
16351641
commandArgs = append(commandArgs, tridentImage)
16361642
}
1643+
if etcdImage != "" {
1644+
commandArgs = append(commandArgs, "--etcd-image")
1645+
commandArgs = append(commandArgs, etcdImage)
1646+
}
1647+
if ucpBearerToken != "" {
1648+
commandArgs = append(commandArgs, "--ucp-bearer-token")
1649+
commandArgs = append(commandArgs, ucpBearerToken)
1650+
}
1651+
if ucpHost != "" {
1652+
commandArgs = append(commandArgs, "--ucp-host")
1653+
commandArgs = append(commandArgs, ucpHost)
1654+
}
1655+
commandArgs = append(commandArgs, "--in-cluster=false")
16371656

16381657
// Create the install pod
16391658
returnError = client.CreateObjectByYAML(k8sclient.GetInstallerPodYAML(

cli/cmd/uninstall.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func init() {
2626
uninstallCmd.Flags().BoolVar(&csi, "csi", false, "Uninstall CSI Trident (alpha, not for production clusters).")
2727
uninstallCmd.Flags().StringVar(&tridentImage, "trident-image", "", "The Trident image to use for an in-cluster uninstall operation.")
2828
uninstallCmd.Flags().MarkHidden("trident-image")
29-
uninstallCmd.Flags().BoolVar(&inCluster, "in-cluster", false, "Run the installer as a job in the cluster.")
29+
uninstallCmd.Flags().BoolVar(&inCluster, "in-cluster", true, "Run the installer as a job in the cluster.")
3030
uninstallCmd.Flags().MarkHidden("in-cluster")
3131

3232
uninstallCmd.Flags().StringVar(&ucpBearerToken, "ucp-bearer-token", "", "UCP authorization token (for Docker UCP only).")
@@ -90,9 +90,15 @@ func discoverUninstallationEnvironment() error {
9090
useKubernetesRBAC = true
9191
if ucpBearerToken != "" || ucpHost != "" {
9292
useKubernetesRBAC = false
93+
9394
if ucpClient, err = ucpclient.NewClient(ucpHost, ucpBearerToken); err != nil {
9495
return err
9596
}
97+
98+
if inCluster {
99+
log.Info("In-cluster uninstallation is not supported with Docker EE, running outside cluster.")
100+
inCluster = false
101+
}
96102
}
97103

98104
// Infer installation namespace if not specified
@@ -449,6 +455,19 @@ func uninstallTridentInCluster() (returnError error) {
449455
if csi {
450456
commandArgs = append(commandArgs, "--csi")
451457
}
458+
if tridentImage != "" {
459+
commandArgs = append(commandArgs, "--trident-image")
460+
commandArgs = append(commandArgs, tridentImage)
461+
}
462+
if ucpBearerToken != "" {
463+
commandArgs = append(commandArgs, "--ucp-bearer-token")
464+
commandArgs = append(commandArgs, ucpBearerToken)
465+
}
466+
if ucpHost != "" {
467+
commandArgs = append(commandArgs, "--ucp-host")
468+
commandArgs = append(commandArgs, ucpHost)
469+
}
470+
commandArgs = append(commandArgs, "--in-cluster=false")
452471

453472
// Create the uninstall pod
454473
returnError = client.CreateObjectByYAML(k8sclient.GetUninstallerPodYAML(

cli/k8s_client/yaml_factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ metadata:
851851
name: trident-installer
852852
rules:
853853
- apiGroups: [""]
854-
resources: ["namespaces", "pods", "pods/exec", "persistentvolumes", "persistentvolumeclaims", "secrets", "serviceaccounts", "services", "events", "nodes", "configmaps"]
854+
resources: ["namespaces", "pods", "pods/exec", "persistentvolumes", "persistentvolumeclaims", "persistentvolumeclaims/status", "secrets", "serviceaccounts", "services", "events", "nodes", "configmaps"]
855855
verbs: ["*"]
856856
- apiGroups: ["extensions"]
857857
resources: ["deployments", "daemonsets"]
@@ -877,7 +877,7 @@ metadata:
877877
name: trident-installer
878878
rules:
879879
- apiGroups: [""]
880-
resources: ["namespaces", "pods", "pods/exec", "persistentvolumes", "persistentvolumeclaims", "secrets", "serviceaccounts", "services", "events", "nodes", "configmaps"]
880+
resources: ["namespaces", "pods", "pods/exec", "persistentvolumes", "persistentvolumeclaims", "persistentvolumeclaims/status", "secrets", "serviceaccounts", "services", "events", "nodes", "configmaps"]
881881
verbs: ["*"]
882882
- apiGroups: ["extensions"]
883883
resources: ["deployments", "daemonsets"]

0 commit comments

Comments
 (0)