Skip to content

Commit dd7f344

Browse files
Cr 1290 removed runnerType option and added runtime service account (#201)
* removed runnerType option and added runtime service account
1 parent 5cb68b8 commit dd7f344

18 files changed

+100
-83
lines changed

venona/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.4
1+
1.5.5

venonactl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.4
1+
1.5.5

venonactl/cmd/install-agent.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ var installAgentCmdOptions struct {
4040
venona struct {
4141
version string
4242
}
43-
agentToken string
44-
agentID string
45-
kubernetesRunnerType bool
46-
tolerations string
47-
envVars []string
48-
dockerRegistry string
49-
templateValues []string
50-
templateFileValues []string
51-
templateValueFiles []string
52-
resources map[string]interface{}
43+
agentToken string
44+
agentID string
45+
tolerations string
46+
envVars []string
47+
dockerRegistry string
48+
templateValues []string
49+
templateFileValues []string
50+
templateValueFiles []string
51+
resources map[string]interface{}
5352
}
5453

5554
var installAgentCmd = &cobra.Command{
@@ -85,7 +84,6 @@ var installAgentCmd = &cobra.Command{
8584
//mergeValueStrArray(&installAgentCmdOptions.envVars, "envVars", nil, "More env vars to be declared \"key=value\"")
8685

8786
mergeValueBool(templateValuesMap, "InCluster", &installAgentCmdOptions.kube.inCluster)
88-
mergeValueBool(templateValuesMap, "kubernetesRunnerType", &installAgentCmdOptions.kubernetesRunnerType)
8987

9088
s := store.GetStore()
9189
lgr := createLogger("Install-agent", verbose, logFormatter)
@@ -192,7 +190,6 @@ func init() {
192190

193191
installAgentCmd.Flags().BoolVar(&installAgentCmdOptions.kube.inCluster, "in-cluster", false, "Set flag if venona is been installed from inside a cluster")
194192
installAgentCmd.Flags().BoolVar(&installAgentCmdOptions.dryRun, "dry-run", false, "Set to true to simulate installation")
195-
installAgentCmd.Flags().BoolVar(&installAgentCmdOptions.kubernetesRunnerType, "kubernetes-runner-type", false, "Set the runner type to kubernetes (alpha feature)")
196193

197194
installAgentCmd.Flags().StringArrayVar(&installAgentCmdOptions.templateValues, "set-value", []string{}, "Set values for templates --set-value agentId=12345")
198195
installAgentCmd.Flags().StringArrayVar(&installAgentCmdOptions.templateFileValues, "set-file", []string{}, "Set values for templates from file")

venonactl/cmd/install-runtime.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ var installRuntimeCmdOptions struct {
3838
storageClass string
3939
dockerRegistry string
4040
runtimeEnvironmentName string
41-
kubernetesRunnerType bool
4241
tolerations string
4342
templateValues []string
4443
templateFileValues []string
@@ -90,7 +89,6 @@ var installRuntimeCmd = &cobra.Command{
9089

9190
mergeValueBool(templateValuesMap, "InCluster", &installRuntimeCmdOptions.kube.inCluster)
9291
mergeValueBool(templateValuesMap, "insecure", &installRuntimeCmdOptions.insecure)
93-
mergeValueBool(templateValuesMap, "kubernetesRunnerType", &installRuntimeCmdOptions.kubernetesRunnerType)
9492

9593
s := store.GetStore()
9694
lgr := createLogger("Install-runtime", verbose, logFormatter)
@@ -136,18 +134,13 @@ var installRuntimeCmd = &cobra.Command{
136134
StorageClass: installRuntimeCmdOptions.storageClass,
137135
IsDefaultStorageClass: isDefault,
138136
DryRun: installRuntimeCmdOptions.dryRun,
139-
KubernetesRunnerType: installRuntimeCmdOptions.kubernetesRunnerType,
140137
CodefreshHost: cfAPIHost,
141138
CodefreshToken: installRuntimeCmdOptions.codefreshToken,
142139
RuntimeEnvironment: installRuntimeCmdOptions.runtimeEnvironmentName,
143140
ClusterNamespace: installRuntimeCmdOptions.kube.namespace,
144141
Insecure: installRuntimeCmdOptions.insecure,
145142
}
146143

147-
if installRuntimeCmdOptions.kubernetesRunnerType {
148-
builder.Add(plugins.EnginePluginType)
149-
}
150-
151144
if isDefault {
152145
builderInstallOpt.StorageClass = plugins.DefaultStorageClassNamePrefix
153146
}
@@ -164,6 +157,7 @@ var installRuntimeCmd = &cobra.Command{
164157
// s.ClusterInCodefresh = installRuntimeCmdOptions.clusterNameInCodefresh
165158

166159
builder.Add(plugins.RuntimeEnvironmentPluginType)
160+
builder.Add(plugins.EnginePluginType)
167161

168162
if isDefault {
169163
builder.Add(plugins.VolumeProvisionerPluginType)
@@ -202,7 +196,6 @@ func init() {
202196
installRuntimeCmd.Flags().BoolVar(&installRuntimeCmdOptions.insecure, "insecure", false, "Set to true to disable TLS when communicating with the codefresh platform")
203197
installRuntimeCmd.Flags().BoolVar(&installRuntimeCmdOptions.kube.inCluster, "in-cluster", false, "Set flag if venona is been installed from inside a cluster")
204198
installRuntimeCmd.Flags().BoolVar(&installRuntimeCmdOptions.dryRun, "dry-run", false, "Set to true to simulate installation")
205-
installRuntimeCmd.Flags().BoolVar(&installRuntimeCmdOptions.kubernetesRunnerType, "kubernetes-runner-type", false, "Set the runner type to kubernetes (alpha feature)")
206199
installRuntimeCmd.Flags().StringVar(&installRuntimeCmdOptions.kube.nodeSelector, "kube-node-selector", "", "The kubernetes node selector \"key=value\" to be used by venona resources (default is no node selector)")
207200
installRuntimeCmd.Flags().StringVar(&installRuntimeCmdOptions.tolerations, "tolerations", "", "The kubernetes tolerations as JSON string to be used by venona resources (default is no tolerations)")
208201

venonactl/cmd/install-venona.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ var installCmdOptions struct {
4242
installOnlyRuntimeEnvironment bool
4343
skipRuntimeInstallation bool
4444
runtimeEnvironmentName string
45-
kubernetesRunnerType bool
4645
buildNodeSelector string
4746
buildAnnotations []string
4847
tolerationJSONString string

venonactl/cmd/uninstall-runtime.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ var uninstallRuntimeCmd = &cobra.Command{
6262

6363
builder := plugins.NewBuilder(lgr)
6464
if uninstallRunimeCmdOptions.kube.context == "" {
65-
dieOnError(fmt.Errorf("Context name is required in order to uninstall agent"))
65+
dieOnError(fmt.Errorf("Context name is required in order to uninstall runtime"))
6666
}
6767
if uninstallRunimeCmdOptions.kube.namespace == "" {
68-
dieOnError(fmt.Errorf("Namespace name is required to in order to uninstall agent"))
68+
dieOnError(fmt.Errorf("Namespace name is required to in order to uninstall runtime"))
6969
}
7070
s.KubernetesAPI.ContextName = uninstallRunimeCmdOptions.kube.context
7171
s.KubernetesAPI.Namespace = uninstallRunimeCmdOptions.kube.namespace
@@ -102,6 +102,7 @@ var uninstallRuntimeCmd = &cobra.Command{
102102
builder.Add(plugins.VolumeProvisionerPluginType)
103103
}
104104
builder.Add(plugins.RuntimeAttachType)
105+
builder.Add(plugins.EnginePluginType)
105106
deleteOptions.ClusterNamespace = uninstallRunimeCmdOptions.kube.namespace
106107
deleteOptions.AgentNamespace = uninstallRunimeCmdOptions.kubeVenona.namespace
107108
deleteOptions.RuntimeEnvironment = uninstallRunimeCmdOptions.runtimeEnvironmentName

venonactl/pkg/codefresh/cfapi.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type (
4444
Insecure bool
4545
StorageClass string
4646
IsDefaultStorageClass bool
47-
KubernetesRunnerType bool
4847
BuildNodeSelector map[string]string
4948
Annotations map[string]string
5049
}
@@ -64,7 +63,6 @@ type (
6463
markAsDefault bool
6564
storageClass string
6665
isDefaultStorageClass bool
67-
kubernetesRunnerType bool
6866
buildNodeSelector map[string]string
6967
annotations map[string]string
7068
}
@@ -101,7 +99,6 @@ func NewCodefreshAPI(opt *APIOptions) API {
10199
registerWithAgent: opt.RegisterWithAgent,
102100
storageClass: opt.StorageClass,
103101
isDefaultStorageClass: opt.IsDefaultStorageClass,
104-
kubernetesRunnerType: opt.KubernetesRunnerType,
105102
buildNodeSelector: opt.BuildNodeSelector,
106103
annotations: opt.Annotations,
107104
}
@@ -186,9 +183,6 @@ func (a *api) Register() (*codefresh.RuntimeEnvironment, error) {
186183
HasAgent: a.registerWithAgent,
187184
Cluster: a.clustername,
188185
}
189-
if a.kubernetesRunnerType {
190-
options.RunnerType = codefresh.KubernetesRunnerType
191-
}
192186
if len(a.buildNodeSelector) != 0 {
193187
options.NodeSelector = a.buildNodeSelector
194188
}

venonactl/pkg/plugins/app-proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (u *appProxyPlugin) Install(opt *InstallOptions, v Values) (Values, error)
6363
host := objx.New(v["AppProxy"]).Get("Host").Str()
6464
pathPrefix := objx.New(v["AppProxy"]).Get("PathPrefix").Str()
6565
appProxyURL := fmt.Sprintf("https://%v%v", host, pathPrefix)
66-
u.logger.Info(fmt.Sprintf("\napp proxy is running at: %v", appProxyURL))
66+
u.logger.Info(fmt.Sprintf("app proxy is running at: %v", appProxyURL))
6767
return v, nil
6868
}
6969

venonactl/pkg/plugins/engine.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"fmt"
2121

2222
"github.com/codefresh-io/venona/venonactl/pkg/logger"
23-
"github.com/codefresh-io/venona/venonactl/pkg/obj/kubeobj"
2423
templates "github.com/codefresh-io/venona/venonactl/pkg/templates/kubernetes"
25-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2624
)
2725

2826
// enginePlugin installs assets on Kubernetes Dind runtimectl Env
@@ -96,49 +94,6 @@ func (u *enginePlugin) Delete(deleteOpt *DeleteOptions, v Values) error {
9694
}
9795

9896
func (u *enginePlugin) Upgrade(opt *UpgradeOptions, v Values) (Values, error) {
99-
100-
// replace of sa creates new secert with sa creds
101-
// avoid it till patch fully implemented
102-
var skipUpgradeFor = map[string]interface{}{
103-
"service-account.venona.yaml": nil,
104-
}
105-
106-
var err error
107-
108-
kubeClientset, err := opt.KubeBuilder.BuildClient()
109-
if err != nil {
110-
u.logger.Error(fmt.Sprintf("Cannot create kubernetes clientset: %v ", err))
111-
return nil, err
112-
}
113-
114-
// special case when we need to get the token from the remote to no regenrate it
115-
// whole flow should be more like kubectl apply that build a patch
116-
// based on remote object and candidate object
117-
118-
secret, err := kubeClientset.CoreV1().Secrets(opt.ClusterNamespace).Get(opt.Name, metav1.GetOptions{})
119-
if err != nil {
120-
return nil, err
121-
}
122-
token := secret.Data["codefresh.token"]
123-
v["AgentToken"] = string(token)
124-
125-
kubeObjects, err := getKubeObjectsFromTempalte(v, engineFilesPattern, u.logger)
126-
if err != nil {
127-
return nil, err
128-
}
129-
130-
for fileName, local := range kubeObjects {
131-
if _, ok := skipUpgradeFor[fileName]; ok {
132-
u.logger.Debug(fmt.Sprintf("Skipping upgrade of %s: should be ignored", fileName))
133-
continue
134-
}
135-
136-
_, _, err := kubeobj.ReplaceObject(kubeClientset, local, opt.ClusterNamespace)
137-
if err != nil {
138-
return nil, err
139-
}
140-
}
141-
14297
return v, nil
14398
}
14499

venonactl/pkg/plugins/plugin.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ type (
6969
EnsureNamespaceExists(cs *kubernetes.Clientset) error
7070
}
7171
DryRun bool
72-
KubernetesRunnerType bool
7372
BuildNodeSelector map[string]string
7473
Annotations map[string]string
7574
RuntimeEnvironment string

0 commit comments

Comments
 (0)