Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api/v1beta1/classifierreport_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ const (

ClassifierReportKind = "ClassifierReport"

// This is the namespace/name of the secret containing the kubeconfig
// This is the name of the secret containing the kubeconfig
// to send ClassifierReport to management cluster when classifier agent
// is configured to send ClassifierReports
ClassifierSecretName = "classifier-agent"
ClassifierSecretNamespace = "projectsveltos"
ClassifierSecretName = "classifier-agent"
)

// ReportPhase describes the state of a classifierReport/healthReport/eventReport/reloaderReport.
Expand Down
4 changes: 2 additions & 2 deletions lib/licenses/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ type LicenseVerificationResult struct {
// and various booleans indicating its validity status, along with a human-readable message.
// The RawError field will contain any technical errors encountered during the process.
// Requires permission to read Secret in projectsveltos namespace.
func VerifyLicenseSecret(ctx context.Context, c client.Client,
func VerifyLicenseSecret(ctx context.Context, c client.Client, sveltosNamespace string,
publicKey *rsa.PublicKey, logger logr.Logger) LicenseVerificationResult {

secretNsName := types.NamespacedName{
Namespace: "projectsveltos",
Namespace: sveltosNamespace,
Name: "sveltos-license",
}

Expand Down
35 changes: 21 additions & 14 deletions lib/licenses/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:lll,gosec // This file has long lines due to signed licenses
//nolint:lll // This file has long lines due to signed licenses
package license_test

import (
"context"
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -43,16 +44,18 @@ var _ = Describe("License", func() {
})

It("Detect Expired License", func() {
sveltosNamespace := randomString()
// Expired license
secret := `apiVersion: v1
secret := fmt.Sprintf(`apiVersion: v1
kind: Secret
metadata:
name: sveltos-license
namespace: projectsveltos
namespace: %s
type: Opaque
data:
licenseData: eyJpZCI6IjY0Mzk5ZTY3LTdhMjctNDY5MS05YzU1LWY4NmY0YjQ4MGFkOSIsImN1c3RvbWVyTmFtZSI6IkFjbWUgSW5jIiwiZmVhdHVyZXMiOlsiUHVsbE1vZGUiXSwiZXhwaXJhdGlvbkRhdGUiOiIyMDI0LTA3LTI1VDExOjU3OjIxLjk2MTYwOFoiLCJpc3N1ZWRBdCI6IjIwMjUtMDctMjVUMTE6NTc6MjEuOTYxNjA4WiJ9
licenseSignature: Nk+Q3x/ZBg2DydTMcAhGzi8+xCBma4bsLfKXlN5f217/OqJVcfFDqlG3Q46nVRI92i/hOvXVAeEOnBpv8/0iDbUvSZB1fBilkyzglcH00hC7Y3CFF9CnxcmLlqWBl5ucL+MTmzCsgxMHhzklOF4oCMAAbigfty9xVCXE81rQN0jKPktZcVui15uubs7PVgXkvc7+NZrmmchXnECXz912S8ayllRWcgKL482xi8bf9XsKubg+mzQm/S4KvPBR1R8Yugnp1byyZmpzQmNMF1KYC5YT/vVqk7ojVZTPVG9y1SxnpFXGVO+4HRBnbEWoVnifg5U74FcU3kiIgOxpUoylsX88PCfZXdaJT5Mh65cZJVRx1RTYLgnBX260gzaLzuPF33uu5IZ1J182Si5RatkvNdPQd7mtLC2T/lyQK4gMqS2g0iidlxA2iwEeqC/UV42aeXrel3KRJ38TL0SNiCpMLly3ueC5sftdvRWARNel7aV/DAE+nfANIBO9YuLpiJY9EMndr1mpGclMZF6KbXkzOnEqbsiNmXANl7Y2lAKORWElC58IznD0WKFoFuc1ZltUDecGEFoExkdstrIPJ8HYi0dJ0OBaHfQNlo7MjEuHWkmZ1XoeUqMPxjFBrULlX74Lbowqif1lDnZhmZTTJs+qqGYLz424HtcVmir8UD5IboQ=`
licenseSignature: Nk+Q3x/ZBg2DydTMcAhGzi8+xCBma4bsLfKXlN5f217/OqJVcfFDqlG3Q46nVRI92i/hOvXVAeEOnBpv8/0iDbUvSZB1fBilkyzglcH00hC7Y3CFF9CnxcmLlqWBl5ucL+MTmzCsgxMHhzklOF4oCMAAbigfty9xVCXE81rQN0jKPktZcVui15uubs7PVgXkvc7+NZrmmchXnECXz912S8ayllRWcgKL482xi8bf9XsKubg+mzQm/S4KvPBR1R8Yugnp1byyZmpzQmNMF1KYC5YT/vVqk7ojVZTPVG9y1SxnpFXGVO+4HRBnbEWoVnifg5U74FcU3kiIgOxpUoylsX88PCfZXdaJT5Mh65cZJVRx1RTYLgnBX260gzaLzuPF33uu5IZ1J182Si5RatkvNdPQd7mtLC2T/lyQK4gMqS2g0iidlxA2iwEeqC/UV42aeXrel3KRJ38TL0SNiCpMLly3ueC5sftdvRWARNel7aV/DAE+nfANIBO9YuLpiJY9EMndr1mpGclMZF6KbXkzOnEqbsiNmXANl7Y2lAKORWElC58IznD0WKFoFuc1ZltUDecGEFoExkdstrIPJ8HYi0dJ0OBaHfQNlo7MjEuHWkmZ1XoeUqMPxjFBrULlX74Lbowqif1lDnZhmZTTJs+qqGYLz424HtcVmir8UD5IboQ=`,
sveltosNamespace)

u, err := k8s_utils.GetUnstructured([]byte(secret))
Expect(err).To(BeNil())
Expand All @@ -66,22 +69,24 @@ data:
publicKey, err := license.GetPublicKey()
Expect(err).To(BeNil())

licenseVerificationResult := license.VerifyLicenseSecret(context.TODO(), c, publicKey, logger)
licenseVerificationResult := license.VerifyLicenseSecret(context.TODO(), c, sveltosNamespace, publicKey, logger)
Expect(licenseVerificationResult.RawError).To(BeNil())
Expect(licenseVerificationResult.IsExpired).To(BeTrue())
})

It("Get Features from license", func() {
sveltosNamespace := randomString()
// This contains a valid license (valid for one managed cluster only)
secret := `apiVersion: v1
secret := fmt.Sprintf(`apiVersion: v1
kind: Secret
metadata:
name: sveltos-license
namespace: projectsveltos
namespace: %s
type: Opaque
data:
licenseData: eyJpZCI6IjY0MzNmYzk0LTE2MDYtNGZkOC04YTFkLThjYzg5NjRjOTk0MyIsImN1c3RvbWVyTmFtZSI6IkFjbWUgSW5jIiwiZ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YilRg+WF+vOKdlidz+pruUcqGvByRsL3OcENN9NItSyP9S2Hkz7Wb0ENfaMhND5jqH8NIfsjNTTE8TeUtTphmUwiRyXV65Tkdv3nLA1ektoSS+fc318KEV0EjIwZPo5Yq7KZls9l7mBKZXj4YSy2Rhj6cD5NOMoAKdt5S82t2amQhWbShCCgWyDOmrBRXiyD9OK8y3TKQ6zQYGCwOYtpCZV+uD1WBdTwhrG0lnGZkfdzkkt4pftMx6YFGopFMLc5/REOPaSWtWGoR9/bwS4s0EWkDCyFrAatxtwhEbOV4pOx5uV2ap/j4v7Ag0PpHJnlnYkW/Z6q5VCov8U1I6OFaCcBoI1MDruubD0qiL2eE25kpTT//cWA/3qxEyh54UqQPeZo6Lno3dW3YlZr62uPXniOzHuOlGWikKK/Wly1gUHfjOUR2PyohC9u3BL9HAZp5IRz4/vXflVqAlv0yWaEbaXHQ=`,
sveltosNamespace)

u, err := k8s_utils.GetUnstructured([]byte(secret))
Expect(err).To(BeNil())
Expand All @@ -95,7 +100,7 @@ data:
publicKey, err := license.GetPublicKey()
Expect(err).To(BeNil())

licenseVerificationResult := license.VerifyLicenseSecret(context.TODO(), c, publicKey, logger)
licenseVerificationResult := license.VerifyLicenseSecret(context.TODO(), c, sveltosNamespace, publicKey, logger)
Expect(licenseVerificationResult.RawError).To(BeNil())
Expect(licenseVerificationResult.IsExpired).To(BeFalse())
Expect(licenseVerificationResult.IsInGracePeriod).To(BeFalse())
Expand All @@ -115,16 +120,18 @@ data:
},
}

sveltosNamespace := randomString()
// This contains a valid license (valid for one managed cluster only) that contains a Cluster fingerprint
secret := `apiVersion: v1
secret := fmt.Sprintf(`apiVersion: v1
kind: Secret
metadata:
name: sveltos-license
namespace: projectsveltos
namespace: %s
type: Opaque
data:
licenseData: eyJpZCI6IjI3NWU2MzUyLTFiYzUtNDUyOC04OTUwLWZhY2Q0MzdlMTI0YyIsImN1c3RvbWVyTmFtZSI6IkFjbWUgSW5jIiwiZmVhdHVyZXMiOlsiUHVsbE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5EzF5DpuNvNMxFLXJ9uXCOdt4N/G4k5O7oLTArnkp8cF0897SHnaeUuQBJzsswL4ZYbB3ikLRdXpr/ZW7+rmYc7Y/KpCcAb65LxPWCy28gJm1GP1olM9WkKuiR1z1jOLSgx0UhyATaDxNa60Jkk4RWaTlJMjXNxuEaZ7ptFlrcpV+d/3mSbWlNFKu5/u1iEMO9Jw4BHWKUvT8fpXw1FY07CRdcbHvtOn7Brm2SZCrTmzjFvS1STtgVLErd12f0dqpQ70XNz0q1BlHLVroyMzDFyksonne1KA9GhCNtjRzsXQzImdU/rJYv1bxoWK1c7hSJB4Bht4Gg75WVsjoLIhW0ME9b0E+j/LFukFIVeqb4j+QGDmDJhgvwLvxHl8XZqH/8kyn6rK29sro0Y7Kiqr3NkEsiwQSqj3Rf0nVyutpQBhW5aqEM5eyh1IY8nLYX7gGS3h7FfiPw61tj664w/PwTHIjwsvkpJ9hGbikadDBd3Ihj9Al9x5kCTkNmBpM07+UK3vK2HFYFDSZdAjWmMQx0O1suANKvl0kUu8ptYsw=`,
sveltosNamespace)

u, err := k8s_utils.GetUnstructured([]byte(secret))
Expect(err).To(BeNil())
Expand All @@ -138,7 +145,7 @@ data:
publicKey, err := license.GetPublicKey()
Expect(err).To(BeNil())

licenseVerificationResult := license.VerifyLicenseSecret(context.TODO(), c, publicKey, logger)
licenseVerificationResult := license.VerifyLicenseSecret(context.TODO(), c, sveltosNamespace, publicKey, logger)
Expect(licenseVerificationResult.RawError).To(BeNil())
Expect(licenseVerificationResult.IsExpired).To(BeFalse())
Expect(licenseVerificationResult.IsInGracePeriod).To(BeFalse())
Expand All @@ -151,7 +158,7 @@ data:
currentNs.UID = "000cbaab-1234-4932-a111-8c5cff6c9752"
Expect(c.Update(context.TODO(), currentNs)).To(Succeed())

licenseVerificationResult = license.VerifyLicenseSecret(context.TODO(), c, publicKey, logger)
licenseVerificationResult = license.VerifyLicenseSecret(context.TODO(), c, sveltosNamespace, publicKey, logger)
Expect(licenseVerificationResult.RawError).ToNot(BeNil())
Expect(licenseVerificationResult.RawError.Error()).To(ContainSubstring("License is not valid for this cluster (fingerprint mismatch)"))
})
Expand Down
6 changes: 6 additions & 0 deletions lib/licenses/licenses_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/cluster-api/util"
)

func TestControllers(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Controllers Suite")
}

func randomString() string {
const length = 10
return util.RandomString(length)
}
2 changes: 1 addition & 1 deletion lib/roles/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func GetServiceAccountNameInManagedCluster(namespace, name string) string {
// A RoleRequest contains the Namespace/Name of the ServiceAccount in the management
// cluster for which a RoleRequest was issued (request to grant permission in managed clusters).
// When processing a RoleRequest, Sveltos creates a ServiceAccount in the managed cluster.
// Such ServiceAccount is created in the "projectsveltos" namespace.
// Such ServiceAccount is created in the namespace.
// This method returns the name of the ServiceAccount in the managed cluster (name cannot
// match the one in the management cluster to avoid clashes)
return fmt.Sprintf("%s--%s", namespace, name)
Expand Down
21 changes: 10 additions & 11 deletions lib/sharding/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func IsShardAMatch(shardKey string, cluster client.Object) bool {
// returns a bool indicating whether the cluster:shard pair has changed and an error
// if any occurred
func RegisterClusterShard(ctx context.Context, c client.Client, component libsveltosv1beta1.Component,
feature, shard, clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) (bool, error) {
sveltosNamespace, feature, shard, clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) (bool, error) {

cm, err := getConfigMap(ctx, c, component, feature)
cm, err := getConfigMap(ctx, c, component, sveltosNamespace, feature)
if err != nil {
return false, err
}
Expand Down Expand Up @@ -109,9 +109,9 @@ func RegisterClusterShard(ctx context.Context, c client.Client, component libsve
// UnregisterClusterShard removes the cluster entry from the shard-tracking ConfigMap.
// Call this when a cluster is fully deleted so stale entries do not accumulate.
func UnregisterClusterShard(ctx context.Context, c client.Client, component libsveltosv1beta1.Component,
feature, clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) error {
sveltosNamespace, feature, clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) error {

cm, err := getConfigMap(ctx, c, component, feature)
cm, err := getConfigMap(ctx, c, component, sveltosNamespace, feature)
if err != nil {
return err
}
Expand All @@ -130,8 +130,7 @@ func UnregisterClusterShard(ctx context.Context, c client.Client, component libs
}

const (
configMapName = "clustersharding"
configMapNamespace = "projectsveltos"
configMapName = "clustersharding"
)

func getConfigMapName(component libsveltosv1beta1.Component, feature string) string {
Expand All @@ -141,28 +140,28 @@ func getConfigMapName(component libsveltosv1beta1.Component, feature string) str
}

func getConfigMap(ctx context.Context, c client.Client, component libsveltosv1beta1.Component,
feature string) (*corev1.ConfigMap, error) {
sveltosNamespace, feature string) (*corev1.ConfigMap, error) {

cm := &corev1.ConfigMap{}
name := getConfigMapName(component, feature)

err := c.Get(ctx, types.NamespacedName{Namespace: configMapNamespace, Name: name}, cm)
err := c.Get(ctx, types.NamespacedName{Namespace: sveltosNamespace, Name: name}, cm)
if err != nil {
if apierrors.IsNotFound(err) {
return createConfigMap(ctx, c, component, feature)
return createConfigMap(ctx, c, component, sveltosNamespace, feature)
}
}

return cm, nil
}

func createConfigMap(ctx context.Context, c client.Client, component libsveltosv1beta1.Component,
feature string) (*corev1.ConfigMap, error) {
sveltosNamespace, feature string) (*corev1.ConfigMap, error) {

name := getConfigMapName(component, feature)
cm := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: configMapNamespace,
Namespace: sveltosNamespace,
Name: name,
},
}
Expand Down
15 changes: 8 additions & 7 deletions lib/sharding/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,45 @@ var _ = Describe("Sharding", func() {
}

shard := randomString()
sveltosNamespace := randomString()
// First time, add entry and return false since cluster:shard was never changed
shardChanged, err := sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", shard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
sveltosNamespace, "helm", shard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeFalse())

// return false since cluster:shard was never changed
shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", shard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
sveltosNamespace, "helm", shard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeFalse())

// return true since cluster:shard has changed
newShard := randomString()
shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
sveltosNamespace, "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeTrue())

// return false since cluster:shard has not changed (and previous step updated configMap)
shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
sveltosNamespace, "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeFalse())

// register capi cluster with same namespace/name of sveltoscluster used so far
shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi)
sveltosNamespace, "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeFalse())

shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi)
sveltosNamespace, "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeFalse())

shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager,
"helm", randomString(), cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi)
sveltosNamespace, "helm", randomString(), cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi)
Expect(err).To(BeNil())
Expect(shardChanged).To(BeTrue())
})
Expand Down
1 change: 0 additions & 1 deletion lib/sveltos_upgrade/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package sveltos_upgrade

const (
ConfigMapNamespace = configMapNamespace
SveltosAgentConfigMapName = sveltosAgentConfigMapName
DriftDetectionConfigMapName = driftDetectionConfigMapName
ConfigMapKey = configMapKey
Expand Down
Loading