Skip to content

Commit

Permalink
chart adjustments (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarededwards authored Oct 22, 2023
1 parent 21db80b commit 10480a1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 34 deletions.
48 changes: 29 additions & 19 deletions charts/kubefirst-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,28 @@ spec:
secretKeyRef:
name: {{ .Values.existingSecret | default "kubefirst-initial-secrets" }}
key: K1_ACCESS_TOKEN
- name: INSTALL_METHOD
value: {{ .Values.installMethod | default "helm" | quote }}
- name: CLOUD_PROVIDER
value: {{ .Values.global.cloudProvider | default "unset" }}
- name: CLUSTER_ID
value: {{ .Values.clusterId | default $clusterId }}
value: {{ .Values.global.clusterId | default $clusterId }}
- name: CLUSTER_TYPE
value: {{ .Values.clusterType | default "bootstrap" | quote }}
- name: USE_TELEMETRY
value: {{ .Values.useTelemetry | default "true" | quote }}
value: {{ .Values.global.clusterType | default "bootstrap" | quote }}
- name: DOMAIN_NAME
value: {{ .Values.global.domainName | default "unset" }}
- name: GIT_PROVIDER
value: {{ .Values.global.gitProvider | default "unset" }}
- name: INSTALL_METHOD
value: {{ .Values.global.installMethod | default "helm" | quote }}
- name: KUBEFIRST_CLIENT
value: {{ .Values.global.kubefirstClient | default "api" }} # deprecated
- name: KUBEFIRST_TEAM
value: {{ .Values.kubefirstTeam | default "false" | quote }}
value: {{ .Values.global.kubefirstTeam | default "false" | quote }}
- name: KUBEFIRST_TEAM_INFO
value: {{ .Values.kubefirstTeamInfo | default "" | quote }}
value: {{ .Values.global.kubefirstTeamInfo | default "" | quote }}
- name: KUBEFIRST_VERSION
value: {{ .Values.global.kubefirstVersion | default "unset" }}
- name: USE_TELEMETRY
value: {{ .Values.global.useTelemetry | default "true" | quote }}
{{- if .Values.env }}
{{- range $envVar := .Values.env }}
- name: {{ $envVar.name }}
Expand Down Expand Up @@ -166,23 +174,25 @@ spec:
"cluster-zero",
]
env:
- name: KUBEFIRST_VERSION
value: {{ .Values.global.kubefirstVersion | default "unset" }}
- name: CLOUD_PROVIDER
value: {{ .Values.cloudProvider | default "unset" }}
value: {{ .Values.global.cloudProvider | default "unset" }}
- name: CLUSTER_ID
value: {{ $clusterId | default "unset" }}
value: {{ .Values.global.clusterId | default $clusterId }}
- name: CLUSTER_TYPE
value: {{ .Values.clusterType | default "bootstrap" }}
value: {{ .Values.global.clusterType | default "bootstrap" | quote }}
- name: DOMAIN_NAME
value: {{ .Values.domainName | default "unset" }}
value: {{ .Values.global.domainName | default "unset" }}
- name: GIT_PROVIDER
value: {{ .Values.gitProvider | default "unset" }}
value: {{ .Values.global.gitProvider | default "unset" }}
- name: INSTALL_METHOD
value: {{ .Values.installMethod | default "helm" }}
value: {{ .Values.global.installMethod | default "helm" | quote }}
- name: KUBEFIRST_CLIENT
value: {{ .Values.kubefirstClient | default "api" }} # deprecated
value: {{ .Values.global.kubefirstClient | default "api" }} # deprecated
- name: KUBEFIRST_TEAM
value: {{ .Values.kubefirstTeam | default "" }}
value: {{ .Values.global.kubefirstTeam | default "false" | quote }}
- name: KUBEFIRST_TEAM_INFO
value: {{ .Values.kubefirstTeamInfo | default "" }}
value: {{ .Values.global.kubefirstTeamInfo | default "" | quote }}
- name: KUBEFIRST_VERSION
value: {{ .Values.global.kubefirstVersion | default "unset" }}
- name: USE_TELEMETRY
value: {{ .Values.global.useTelemetry | default "true" | quote }}
21 changes: 10 additions & 11 deletions charts/kubefirst-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ image:
hook:
repository: public.ecr.aws/kubefirst/metrics-client
pullPolicy: Always
tag: 0.1.1
tag: v0.2.1

imagePullSecrets: []
nameOverride: ''
Expand Down Expand Up @@ -104,16 +104,15 @@ mongodbUsername: ''
initContainer:
enabled: false

cloudProvider: ''
clusterId: ''
clusterType: ''
domainName: ''
gitProvider: ''
installMethod: ''
kubefirstClient: ''
kubefirstTeam: ''
kubefirstTeamInfo: ''


global:
kubefirstVersion: ''
cloudProvider: ''
clusterId: ''
clusterType: ''
domainName: ''
gitProvider: ''
installMethod: ''
kubefirstClient: ''
kubefirstTeam: ''
kubefirstTeamInfo: ''
6 changes: 3 additions & 3 deletions internal/telemetry/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ func Heartbeat(segmentClient *telemetry.SegmentClient, dbClient *db.MongoDBClien
}

func HeartbeatWorkloadClusters(segmentClient *telemetry.SegmentClient, dbClient *db.MongoDBClient) error {

clusters, _ := dbClient.GetClusters()

for _, cluster := range clusters {
if cluster.Status == constants.ClusterStatusProvisioned {
for _, workloadCluster := range cluster.WorkloadClusters {
if workloadCluster.Status == constants.ClusterStatusProvisioned {

workloadClient := telemetry.SegmentClient{
workloadClient := &telemetry.SegmentClient{
TelemetryEvent: telemetry.TelemetryEvent{
CliVersion: segmentClient.TelemetryEvent.CliVersion,
CloudProvider: workloadCluster.CloudProvider,
Expand All @@ -53,7 +53,7 @@ func HeartbeatWorkloadClusters(segmentClient *telemetry.SegmentClient, dbClient
}
defer workloadClient.Client.Close()

telemetry.SendEvent(&workloadClient, telemetry.KubefirstHeartbeat, "")
telemetry.SendEvent(workloadClient, telemetry.KubefirstHeartbeat, "")
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/segment/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ func InitClient() *telemetry.SegmentClient {
machineID, _ := machineid.ID()
sc := analytics.New(telemetry.SegmentIOWriteKey)

kubefirstVersion := os.Getenv("KUBEFIRST_VERSION")
if kubefirstVersion == "" {
kubefirstVersion = "development"
}

c := telemetry.SegmentClient{
TelemetryEvent: telemetry.TelemetryEvent{
CliVersion: os.Getenv("KUBEFIRST_VERSION"),
CliVersion: kubefirstVersion,
CloudProvider: os.Getenv("CLOUD_PROVIDER"),
ClusterID: os.Getenv("CLUSTER_ID"),
ClusterType: os.Getenv("CLUSTER_TYPE"),
Expand Down

0 comments on commit 10480a1

Please sign in to comment.