Skip to content

Commit

Permalink
Merge pull request #263 from kube-tarian/plugins-api-impl
Browse files Browse the repository at this point in the history
get capten plugins apis implementation
  • Loading branch information
vramk23 authored Oct 25, 2023
2 parents f2895e1 + f1db35b commit a6a6c56
Show file tree
Hide file tree
Showing 22 changed files with 1,128 additions and 463 deletions.
42 changes: 42 additions & 0 deletions capten/agent/pkg/agent/get_capten_plugins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package agent

import (
"context"

"github.com/kube-tarian/kad/capten/agent/pkg/pb/captenpluginspb"
)

func (a *Agent) GetCaptenPlugins(ctx context.Context, request *captenpluginspb.GetCaptenPluginsRequest) (
*captenpluginspb.GetCaptenPluginsResponse, error) {
a.log.Infof("Get Capten Plugins %s request recieved")

res, err := a.as.GetAllApps()
if err != nil {
return &captenpluginspb.GetCaptenPluginsResponse{
Status: captenpluginspb.StatusCode_INTERNAL_ERROR,
StatusMessage: "failed to fetch pluginss",
}, nil
}

plugins := make([]*captenpluginspb.CaptenPlugin, 0)
for _, r := range res {
appConfig := r.GetConfig()
if len(appConfig.PluginName) == 0 {
continue
}

plugins = append(plugins, &captenpluginspb.CaptenPlugin{
PluginName: r.GetConfig().GetPluginName(),
PluginDescription: r.GetConfig().GetPluginDescription(),
LaunchIcon: r.GetConfig().GetIcon(),
LaunchURL: r.GetConfig().GetLaunchURL(),
InstallStatus: r.GetConfig().GetInstallStatus(),
RuntimeStatus: r.GetConfig().GetRuntimeStatus(),
})
}

a.log.Infof("Fetched %d capten plugins", len(plugins))
return &captenpluginspb.GetCaptenPluginsResponse{Status: captenpluginspb.StatusCode_OK,
StatusMessage: "successfully fetched plugin",
Plugins: plugins}, nil
}
259 changes: 140 additions & 119 deletions capten/agent/pkg/pb/agentpb/agent.pb.go

Large diffs are not rendered by default.

369 changes: 317 additions & 52 deletions capten/agent/pkg/pb/captenpluginspb/capten_plugins.pb.go

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions capten/agent/pkg/pb/captenpluginspb/capten_plugins_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charts/server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.23
version: 0.1.24

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.23.0"
appVersion: "1.24.0"
8 changes: 0 additions & 8 deletions charts/server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ spec:
value: "{{ .Values.astra.entityName }}"
- name: ASTRA_CRED_IDENTIFIER
value: "{{ .Values.astra.credIdentifier }}"
- name: CASSANDRA_ADDRESSES
value: "{{ .Values.cassandra.dbAddresses }}"
- name: CASSANDRA_SERVICE_USERNAME
value: "{{ .Values.cassandra.dbUserName }}"
- name: CASSANDRA_ENTITY_NAME
value: "{{ .Values.cassandra.entityName }}"
- name: CASSANDRA_DB_NAME
value: "{{ .Values.cassandra.dbName }}"
- name: ORY_ENTITY_NAME
value: {{ .Values.ory.entityName }}
- name: ORY_CRED_IDENTIFIER
Expand Down
18 changes: 8 additions & 10 deletions charts/server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ vault:
role: vault-role-capten-server
policyNames: "vault-policy-certs-admin,vault-policy-service-cred-read,vault-policy-generic-cred-admin"

cassandra:
dbAddresses: cassandra.cassandra.svc.cluster.local
dbUserName: admin
entityName: cassandra
dbName: capten-server

iam:
address: iam:9091

Expand Down Expand Up @@ -61,10 +55,12 @@ serviceAccount:

podAnnotations: {}

podSecurityContext: {}
podSecurityContext:
{}
# fsGroup: 2000

securityContext: {}
securityContext:
{}
# capabilities:
# drop:
# - ALL
Expand All @@ -80,7 +76,8 @@ service:
ingress:
enabled: false
className: ""
annotations: {}
annotations:
{}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
Expand All @@ -93,7 +90,8 @@ ingress:
# hosts:
# - chart-example.local

resources: {}
resources:
{}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
Expand Down
2 changes: 2 additions & 0 deletions proto/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ message AppConfig {
string runtimeStatus = 16;
bool defualtApp = 17;
string lastUpdateTime = 18;
string pluginName = 19;
string pluginDescription = 20;
}

message AppValues {
Expand Down
4 changes: 3 additions & 1 deletion proto/capten_plugins.proto
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ message CaptenPlugin {
string pluginName = 1;
string pluginDescription = 2;
string launchURL = 3;
string launchIcon = 4;
bytes launchIcon = 4;
string installStatus = 5;
string runtimeStatus = 6;
}

message GetCaptenPluginsRequest {
Expand Down
2 changes: 2 additions & 0 deletions server/data/store-apps/conf/argo-cd-v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ReleaseName: "argo-cd"
Icon: "argo-cd.svg"
Version: "1.0.0"
CreateNamespace: true
PluginName: ArgoCD
PluginDescription: "Configure ArgoCD projects and resources"
LaunchURL: https://argo.{{.DomainName}}
LaunchUIDescription: "Intelops ArgoCD"
LaunchUIIcon: "argo-cd.svg"
Expand Down
2 changes: 2 additions & 0 deletions server/data/store-apps/conf/crossplane-v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ Namespace: "crossplane-system"
ReleaseName: "crossplane"
Version: "1.0.0"
CreateNamespace: true
PluginName: "Crossplane"
PluginDescription: "Configure Infra with Crossplane"
OverrideValues:
DomainName: "{{.DomainName}}"
4 changes: 3 additions & 1 deletion server/data/store-apps/conf/tekton-v0.1.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ RepoURL: "https://kube-tarian.github.io/helmrepo-supporting-tools"
Namespace: "tekton"
ReleaseName: "tekton"
Version: "0.1.1"
CreateNamespace: true
PluginName: "Tekton"
PluginDescription: "Configure Build pipeline with Tekton"
CreateNamespace: true
40 changes: 40 additions & 0 deletions server/pkg/api/get_capten_plugins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package api

import (
"context"

"github.com/kube-tarian/kad/server/pkg/pb/captenpluginspb"
)

func (s *Server) GetCaptenPlugins(ctx context.Context, request *captenpluginspb.GetCaptenPluginsRequest) (
*captenpluginspb.GetCaptenPluginsResponse, error) {
orgId, clusterId, err := validateOrgClusterWithArgs(ctx)
if err != nil {
s.log.Infof("request validation failed", err)
return &captenpluginspb.GetCaptenPluginsResponse{
Status: captenpluginspb.StatusCode_INVALID_ARGUMENT,
StatusMessage: "request validation failed",
}, nil
}
s.log.Infof("Get Capten Plugins %s request for cluster %s recieved, [org: %s]",
clusterId, orgId)

a, err := s.agentHandeler.GetAgent(orgId, clusterId)
if err != nil {
s.log.Error("failed to connect to agent", err)
return &captenpluginspb.GetCaptenPluginsResponse{Status: captenpluginspb.StatusCode_INTERNAL_ERROR,
StatusMessage: "failed to connect to agent"}, nil
}

resp, err := a.GetCaptenPluginsClient().GetCaptenPlugins(ctx, &captenpluginspb.GetCaptenPluginsRequest{})
if err != nil {
s.log.Error("failed to get cluster capten plugins from agent", err)
return &captenpluginspb.GetCaptenPluginsResponse{Status: captenpluginspb.StatusCode_INTERNAL_ERROR,
StatusMessage: "failed to get cluster application from agent"}, nil
}

s.log.Infof("Fetched %d capten plugins from the cluster %s, [org: %s]", len(resp.Plugins), clusterId, orgId)
return &captenpluginspb.GetCaptenPluginsResponse{Status: captenpluginspb.StatusCode_OK,
StatusMessage: "successfully fetched the data from agent",
Plugins: resp.Plugins}, nil
}
89 changes: 0 additions & 89 deletions server/pkg/cassandra-client/client.go

This file was deleted.

Loading

0 comments on commit a6a6c56

Please sign in to comment.