Skip to content

Commit 98306e4

Browse files
committed
wip
1 parent 6bc9b1f commit 98306e4

12 files changed

+23
-9
lines changed

venonactl/cmd/install-agent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var installAgentCmdOptions struct {
4343
kubernetesRunnerType bool
4444
tolerations string
4545
envVars string
46+
dockerRegistry string
4647
}
4748

4849
var installAgentCmd = &cobra.Command{
@@ -96,6 +97,7 @@ var installAgentCmd = &cobra.Command{
9697
s.Image.Tag = version
9798
s.Version.Current.Version = version
9899
}
100+
s.DockerRegistry = installAgentCmdOptions.dockerRegistry
99101
if installAgentCmdOptions.envVars != "" {
100102
s.AdditionalEnvVars = make(map[string]string)
101103
parts := strings.Split(installAgentCmdOptions.envVars, ",")
@@ -138,6 +140,7 @@ func init() {
138140
installAgentCmd.Flags().StringVar(&installAgentCmdOptions.kube.nodeSelector, "kube-node-selector", "", "The kubernetes node selector \"key=value\" to be used by venona resources (default is no node selector)")
139141
installAgentCmd.Flags().StringVar(&installAgentCmdOptions.tolerations, "tolerations", "", "The kubernetes tolerations as JSON string to be used by venona resources (default is no tolerations)")
140142
installAgentCmd.Flags().StringVar(&installAgentCmdOptions.envVars, "envVars", "", "More env vars to be declared \"key=value\"")
143+
installAgentCmd.Flags().StringVar(&installAgentCmdOptions.dockerRegistry, "docker-registry", "", "The prefix for the container registry that will be used for pulling the required components images. Example: --docker-registry=\"docker.io\"")
141144

142145
installAgentCmd.Flags().BoolVar(&installAgentCmdOptions.kube.inCluster, "in-cluster", false, "Set flag if venona is been installed from inside a cluster")
143146
installAgentCmd.Flags().BoolVar(&installAgentCmdOptions.dryRun, "dry-run", false, "Set to true to simulate installation")

venonactl/cmd/install-monitor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818

1919
import (
2020
"fmt"
21+
2122
"github.com/codefresh-io/venona/venonactl/pkg/plugins"
2223
"github.com/codefresh-io/venona/venonactl/pkg/store"
2324
"github.com/spf13/cobra"
@@ -34,6 +35,7 @@ var installMonitorAgentCmdOptions struct {
3435
helm3 bool
3536
codefreshToken string
3637
codefreshHost string
38+
dockerRegistry string
3739
}
3840

3941
// installK8sAgentCmd represents the install command
@@ -64,6 +66,7 @@ var installMonitorAgentCmd = &cobra.Command{
6466

6567
s.ClusterId = installMonitorAgentCmdOptions.clusterId
6668
s.Helm3 = installMonitorAgentCmdOptions.helm3
69+
s.DockerRegistry = installMonitorAgentCmdOptions.dockerRegistry
6770

6871
if installMonitorAgentCmdOptions.codefreshHost == "" {
6972
installMonitorAgentCmdOptions.codefreshHost = "https://g.codefresh.io"
@@ -103,6 +106,7 @@ func init() {
103106
installMonitorAgentCmd.Flags().StringVar(&installMonitorAgentCmdOptions.kube.context, "kube-context-name", viper.GetString("kube-context"), "Name of the kubernetes context on which monitor should be installed (default is current-context) [$KUBE_CONTEXT]")
104107
installMonitorAgentCmd.Flags().StringVar(&installMonitorAgentCmdOptions.clusterId, "clusterId", "", "Cluster Id")
105108
installMonitorAgentCmd.Flags().StringVar(&installMonitorAgentCmdOptions.codefreshToken, "codefreshToken", "", "Codefresh token")
109+
installMonitorAgentCmd.Flags().StringVar(&installAgentCmdOptions.dockerRegistry, "docker-registry", "", "The prefix for the container registry that will be used for pulling the required components images. Example: --docker-registry=\"docker.io\"")
106110

107111
installMonitorAgentCmd.Flags().StringVar(&installMonitorAgentCmdOptions.codefreshHost, "codefreshHost", "", "Override codefresh host if you use your own codefresh installation")
108112

venonactl/cmd/install-runtime.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var installRuntimeCmdOptions struct {
3535
nodeSelector string
3636
}
3737
storageClass string
38+
dockerRegistry string
3839
runtimeEnvironmentName string
3940
kubernetesRunnerType bool
4041
tolerations string
@@ -82,6 +83,7 @@ var installRuntimeCmd = &cobra.Command{
8283
}
8384

8485
s.KubernetesAPI.NodeSelector = installRuntimeCmdOptions.kube.nodeSelector
86+
s.DockerRegistry = installRuntimeCmdOptions.dockerRegistry
8587

8688
builder := plugins.NewBuilder(lgr)
8789
isDefault := isUsingDefaultStorageClass(installRuntimeCmdOptions.storageClass)
@@ -164,6 +166,7 @@ func init() {
164166
installRuntimeCmd.Flags().StringVar(&installRuntimeCmdOptions.kube.namespace, "kube-namespace", viper.GetString("kube-namespace"), "Name of the namespace on which venona should be installed [$KUBE_NAMESPACE]")
165167
installRuntimeCmd.Flags().StringVar(&installRuntimeCmdOptions.kube.context, "kube-context-name", viper.GetString("kube-context"), "Name of the kubernetes context on which venona should be installed (default is current-context) [$KUBE_CONTEXT]")
166168
installRuntimeCmd.Flags().StringVar(&installRuntimeCmdOptions.storageClass, "storage-class", "", "Set a name of your custom storage class, note: this will not install volume provisioning components")
169+
installRuntimeCmd.Flags().StringVar(&installAgentCmdOptions.dockerRegistry, "docker-registry", "", "The prefix for the container registry that will be used for pulling the required components images. Example: --docker-registry=\"docker.io\"")
167170

168171
installRuntimeCmd.Flags().BoolVar(&installRuntimeCmdOptions.kube.inCluster, "in-cluster", false, "Set flag if venona is been installed from inside a cluster")
169172
installRuntimeCmd.Flags().BoolVar(&installRuntimeCmdOptions.dryRun, "dry-run", false, "Set to true to simulate installation")

venonactl/pkg/plugins/helper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func ExecuteTemplate(tplStr string, data interface{}) (string, error) {
121121

122122
buf := bytes.NewBufferString("")
123123
err = template.Execute(buf, data)
124+
fmt.Println(buf)
124125
if err != nil {
125126
return "", err
126127
}

venonactl/pkg/plugins/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type (
5656
RegisterWithAgent bool
5757
MarkAsDefault bool
5858
StorageClass string
59+
DockerRegistry string
5960
IsDefaultStorageClass bool
6061
KubeBuilder interface {
6162
BuildClient() (*kubernetes.Clientset, error)

venonactl/pkg/store/store.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ type (
2121
Values struct {
2222
AppName string
2323

24-
Mode string
25-
Image *Image
26-
AgentToken string
24+
Mode string
25+
Image *Image
26+
DockerRegistry string
27+
AgentToken string
2728

2829
ServerCert *certs.ServerCert
2930

@@ -113,6 +114,7 @@ func (s *Values) BuildValues() map[string]interface{} {
113114
"ConfigPath": s.KubernetesAPI.ConfigPath,
114115
"Context": s.KubernetesAPI.ContextName,
115116
"NodeSelector": s.KubernetesAPI.NodeSelector,
117+
"DockerRegistry": s.DockerRegistry,
116118
"Tolerations": s.KubernetesAPI.Tolerations,
117119
"AgentToken": s.AgentAPI.Token,
118120
"AgentId": s.AgentAPI.Id,

venonactl/pkg/templates/kubernetes/cron-job.dind-volume-cleanup.vp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
restartPolicy: Never
2121
containers:
2222
- name: dind-volume-cleanup
23-
image: codefresh/dind-volume-cleanup
23+
image: {{ if ne .DockerRegistry ""}} {{- .DockerRegistry }}/codefresh/dind-volume-cleanup {{- else }}codefresh/dind-volume-cleanup {{- end}}
2424
env:
2525
- name: PROVISIONED_BY
2626
value: codefresh.io/dind-volume-provisioner-{{ .AppName }}-{{ .Namespace }}

venonactl/pkg/templates/kubernetes/daemonset.dind-lv-monitor.vp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
{{ .Tolerations | indent 8 }}
3333
{{ end }}
3434
containers:
35-
- image: codefresh/dind-volume-utils:v5
35+
- image: {{ if ne .DockerRegistry ""}} {{- .DockerRegistry }}/codefresh/dind-volume-utils:v5 {{- else }}codefresh/dind-volume-utils:v5{{- end}}
3636
name: lv-cleaner
3737
imagePullPolicy: Always
3838
command:

venonactl/pkg/templates/kubernetes/deployment.dind-volume-provisioner.vp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
{{ end }}
3232
containers:
3333
- name: dind-volume-provisioner
34-
image: {{ .Storage.VolumeProvisioner.Image }}
34+
image: {{ if ne .DockerRegistry ""}} {{- .DockerRegistry }}/{{ .Storage.VolumeProvisioner.Image.Name }} {{- else }} {{- .Storage.VolumeProvisioner.Image.Name }} {{- end}}
3535
imagePullPolicy: Always
3636
resources:
3737
requests:

venonactl/pkg/templates/kubernetes/deployment.monitor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
{{- end }}
2828
containers:
2929
- name: {{ .Monitor.AppName }}
30-
image: "{{ .Monitor.Image.Name }}:{{ .Monitor.Image.Tag }}"
30+
image: {{ if ne .DockerRegistry ""}} {{- .DockerRegistry }}/{{ .Monitor.Image.Name }}:{{ .Monitor.Image.Tag }} {{- else }} {{- .Monitor.Image.Name }}:{{ .Monitor.Image.Tag }} {{- end}}
3131
imagePullPolicy: Always
3232
env:
3333
- name: SERVICE_NAME

0 commit comments

Comments
 (0)