Skip to content

Commit

Permalink
add clusterID and instanceID params
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig O'Donnell committed Sep 8, 2023
1 parent 741aff7 commit b27734c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions chart/templates/replicated-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ stringData:
{{- .Values.statusInformers | toYaml | nindent 6 }}
{{- end }}
managedBy: {{ .Values.managedBy | default "Helm" | quote }}
clusterID: {{ .Values.clusterID | default "" | quote }}
instanceID: {{ .Values.instanceID | default "" | quote }}
{{- if (.Values.integration).licenseID }}
integration-license-id: {{ .Values.integration.licenseID }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ integration:
mockData: ""

managedBy: Helm
clusterID: ""
instanceID: ""
2 changes: 2 additions & 0 deletions cmd/replicated/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func APICmd() *cobra.Command {
ReplicatedAppEndpoint: replicatedConfig.ReplicatedAppEndpoint,
StatusInformers: replicatedConfig.StatusInformers,
ManagedBy: replicatedConfig.ManagedBy,
ClusterID: replicatedConfig.ClusterID,
InstanceID: replicatedConfig.InstanceID,
Namespace: namespace,
}
apiserver.Start(params)
Expand Down
11 changes: 7 additions & 4 deletions pkg/apiserver/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ func bootstrap(params APIServerParams) error {
return errors.Wrap(err, "failed to get clientset")
}

// retrieve replicated and app ids
replicatedID, appID, err := util.GetReplicatedAndAppIDs(clientset, params.Namespace)
if err != nil {
return errors.Wrap(err, "failed to get replicated and app ids")
replicatedID, appID := params.ClusterID, params.InstanceID
if replicatedID == "" || appID == "" {
// retrieve replicated and app ids
replicatedID, appID, err = util.GetReplicatedAndAppIDs(clientset, params.Namespace)
if err != nil {
return errors.Wrap(err, "failed to get replicated and app ids")
}
}
if replicatedID == "" {
return backoff.Permanent(errors.New("Replicated ID not found"))
Expand Down
2 changes: 2 additions & 0 deletions pkg/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type APIServerParams struct {
ReplicatedAppEndpoint string
StatusInformers []appstatetypes.StatusInformerString
ManagedBy string
ClusterID string
InstanceID string
Namespace string
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type ReplicatedConfig struct {
ReplicatedAppEndpoint string `yaml:"replicatedAppEndpoint"`
StatusInformers []appstatetypes.StatusInformerString `yaml:"statusInformers"`
ManagedBy string `yaml:"managedBy"`
ClusterID string `yaml:"clusterID"`
InstanceID string `yaml:"instanceID"`
}

func ParseReplicatedConfig(config []byte) (*ReplicatedConfig, error) {
Expand Down

0 comments on commit b27734c

Please sign in to comment.