Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduces conditional control plane installation #10

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: reworks smcp creation
It relies on owner reference so can be cleaned up as other resources
bartoszmajsak committed Aug 30, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a340f0222a7e01d75d9107cb9d99060f607db35b
10 changes: 0 additions & 10 deletions pkg/kfapp/ossm/feature/cleanup.go
Original file line number Diff line number Diff line change
@@ -137,13 +137,3 @@ func RemoveExtensionProvider(feature *Feature) error {
return err

}

func DeleteControlPlane(feature *Feature) error {
meshNs := feature.Spec.Mesh.Namespace
meshName := feature.Spec.Mesh.Name

return feature.dynamicClient.
Resource(smcpGVR).
Namespace(meshNs).
Delete(context.Background(), meshName, metav1.DeleteOptions{})
}
6 changes: 4 additions & 2 deletions pkg/kfapp/ossm/feature/verification.go
Original file line number Diff line number Diff line change
@@ -51,16 +51,18 @@ func WaitForControlPlaneToBeReady(feature *Feature) error {
return wait.PollImmediate(250*time.Millisecond, 5*time.Minute, func() (done bool, err error) {
smcp := feature.Spec.Mesh.Name
smcpNs := feature.Spec.Mesh.Namespace

log.Info("polling for control plane to be ready", "name", smcp, "namespace", smcpNs)
status, err := CheckControlPlaneStatus(feature.dynamicClient, smcp, smcpNs)

return status == "Ready", err
})
}

func CheckControlPlaneStatus(dynamicClient dynamic.Interface, name, namespace string) (string, error) {
unstructObj, err := dynamicClient.Resource(smcpGVR).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{})
unstructObj, err := dynamicClient.Resource(smcpGVR).Namespace(namespace).Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
log.Info("Failed to find SMCP")
log.Info("Failed to find Service Mesh Control Plane")

return "", err
}
4 changes: 2 additions & 2 deletions pkg/kfapp/ossm/ossm_installer.go
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ func (o *OssmInstaller) enableFeatures() error {
return internalError(errors.WithStack(err))
}

if smcpInstallation, err := feature.CreateFeature("install-control-plane").
if smcpInstallation, err := feature.CreateFeature("control-plane-install-managed").
For(o.PluginSpec).
UsingConfig(o.config).
Manifests(
@@ -106,7 +106,6 @@ func (o *OssmInstaller) enableFeatures() error {
Postconditions(
feature.WaitForControlPlaneToBeReady,
).
OnDelete(feature.DeleteControlPlane).
Load(); err != nil {
return err
} else {
@@ -222,6 +221,7 @@ func (o *OssmInstaller) CleanupResources() error {
// between the features when it comes to clean-up. This is based on the assumption, that features
// are created in the correct order or are self-contained.
for i := len(o.features) - 1; i >= 0; i-- {
log.Info("cleanup", "name", o.features[i].Name)
cleanupErrors = multierror.Append(cleanupErrors, o.features[i].Cleanup())
}

Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ metadata:
spec:
version: v2.4
tracing:
type: none
type: None
addons:
prometheus:
enabled: true