Skip to content

Commit

Permalink
Store license secret name/namespace in trial status secret
Browse files Browse the repository at this point in the history
  • Loading branch information
thbkrkr committed Nov 22, 2019
1 parent 53014de commit ccb03d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/common/license/trial.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import (
const (
TrialStatusSecretKey = "trial-status"
TrialPubkeyKey = "pubkey"

TrialLicenseSecretName = "trial.k8s.elastic.co/secret-name" // nolint
TrialLicenseSecretNamespace = "trial.k8s.elastic.co/secret-namespace" // nolint
)

func InitTrial(c k8s.Client, operatorNamespace string, secret corev1.Secret, l *EnterpriseLicense) (*rsa.PublicKey, error) {
Expand Down Expand Up @@ -56,6 +59,10 @@ func InitTrial(c k8s.Client, operatorNamespace string, secret corev1.Secret, l *
Labels: map[string]string{
LicenseLabelName: l.License.UID,
},
Annotations: map[string]string{
TrialLicenseSecretName: secret.Name,
TrialLicenseSecretNamespace: secret.Namespace,
},
},
Data: map[string][]byte{
TrialPubkeyKey: pubkeyBytes,
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/license/trial/trial_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ func add(mgr manager.Manager, r *ReconcileTrials) error {
return []reconcile.Request{
{
NamespacedName: types.NamespacedName{
Namespace: obj.Meta.GetNamespace(),
Name: string(licensing.LicenseTypeEnterpriseTrial),
Namespace: secret.Annotations[licensing.TrialLicenseSecretNamespace],
Name: secret.Annotations[licensing.TrialLicenseSecretName],
},
},
}
Expand Down

0 comments on commit ccb03d8

Please sign in to comment.