Skip to content

Commit

Permalink
Remove peerpods config management.
Browse files Browse the repository at this point in the history
Newer version of cloud-api-adaptor removes the need to use peerpod config.
This commit removes the associated code.

Signed-off-by: Julien Ropé <[email protected]>
  • Loading branch information
littlejawa committed Feb 12, 2025
1 parent 8971b4b commit 4b01583
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 58 deletions.
4 changes: 0 additions & 4 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ plugins:
projectName: sandboxed-containers-operator
repo: github.com/openshift/sandboxed-containers-operator
resources:
- group: confidentialcontainers
kind: PeerPodConfig
path: github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl/api/v1alpha1
version: v1alpha1
- controller: true
domain: kataconfiguration.openshift.io
group: kataconfiguration
Expand Down
41 changes: 3 additions & 38 deletions controllers/openshift_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
"strings"
"time"

"github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl/api/v1alpha1"

appsv1 "k8s.io/api/apps/v1"

"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -1238,7 +1236,7 @@ func (r *KataConfigOpenShiftReconciler) processKataConfigInstallRequest() (ctrl.
}
}

// create Pod VM image PeerPodConfig CRD and runtimeclass for peerpods
// create Pod VM image CRD and runtimeclass for peerpods
if r.kataConfig.Spec.EnablePeerPods {
//Get pull-secret from openshift-config ns and save it as auth-json-secret in our ns
//This will be used by the podvm image provider to pull the pause image for embedding
Expand Down Expand Up @@ -2264,28 +2262,8 @@ func (r *KataConfigOpenShiftReconciler) enablePeerPodsMc() error {

// Create the PeerPodConfig CRDs and misc configs required for peer-pods
func (r *KataConfigOpenShiftReconciler) enablePeerPodsMiscConfigs() error {
peerPodConfig := v1alpha1.PeerPodConfig{
TypeMeta: metav1.TypeMeta{},
ObjectMeta: metav1.ObjectMeta{
Name: peerpodConfigCrdName,
Namespace: OperatorNamespace,
},
Spec: v1alpha1.PeerPodConfigSpec{
CloudSecretName: "peer-pods-secret",
ConfigMapName: "peer-pods-cm",
Limit: DEFAULT_PEER_PODS,
NodeSelector: r.getNodeSelectorAsMap(),
},
}

err := r.Client.Create(context.TODO(), &peerPodConfig)
if err != nil && !k8serrors.IsAlreadyExists(err) {
r.Log.Info("Error in creating peerpodconfig", "err", err)
return err
}

// Create the mutating webhook deployment
err = r.createMutatingWebhookDeployment()
err := r.createMutatingWebhookDeployment()
if err != nil {
r.Log.Info("Error in creating mutating webhook deployment for peerpods", "err", err)
return err
Expand Down Expand Up @@ -2315,19 +2293,6 @@ func (r *KataConfigOpenShiftReconciler) enablePeerPodsMiscConfigs() error {
}

func (r *KataConfigOpenShiftReconciler) disablePeerPods() error {
peerPodConfig := v1alpha1.PeerPodConfig{
TypeMeta: metav1.TypeMeta{},
ObjectMeta: metav1.ObjectMeta{
Name: peerpodConfigCrdName,
Namespace: OperatorNamespace,
},
}
err := r.Client.Delete(context.TODO(), &peerPodConfig)
if err != nil {
// error during removing peerpodconfig. Just log the error and move on.
r.Log.Info("Error found deleting PeerPodConfig. If the PeerPodConfig object exists after uninstallation it can be safely deleted manually", "err", err)
}

mc := mcfgv1.MachineConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "machineconfiguration.openshift.io/v1",
Expand All @@ -2338,7 +2303,7 @@ func (r *KataConfigOpenShiftReconciler) disablePeerPods() error {
},
}

err = r.Client.Delete(context.TODO(), &mc)
err := r.Client.Delete(context.TODO(), &mc)
if err != nil {
// error during removing mc. Just log the error and move on.
r.Log.Info("Error found deleting mc. If the MachineConfig object exists after uninstallation it can be safely deleted manually",
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.22.7

require (
github.com/confidential-containers/cloud-api-adaptor/src/peerpod-ctrl v0.9.0
github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl v0.9.0
github.com/coreos/ignition/v2 v2.15.0
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/go-logr/logr v1.4.2
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ github.com/confidential-containers/cloud-api-adaptor/src/cloud-providers v0.9.0
github.com/confidential-containers/cloud-api-adaptor/src/cloud-providers v0.9.0/go.mod h1:7Yxc6fhrLQW5nvDH5ePHouqwCNNIK7GJR5LrHiFZqhg=
github.com/confidential-containers/cloud-api-adaptor/src/peerpod-ctrl v0.9.0 h1:IEKJAdZtXsKyrWuxXyeOLIXIAyb+JgHxhRoLeeLnzIQ=
github.com/confidential-containers/cloud-api-adaptor/src/peerpod-ctrl v0.9.0/go.mod h1:79OIEUk6RI6URAiEicZVrmhGHJA7LhuBvRxBQzOHS5A=
github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl v0.9.0 h1:gXSLIfj459Uez/z0Whpsck09ZTuqBlfKGwPzpEj1HfI=
github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl v0.9.0/go.mod h1:nosM1LC4W8IKeUpb6HtfXTE8bBj9JgeZ2SP0EIHf3T8=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
Expand Down
13 changes: 0 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os"

peerpodcontrollers "github.com/confidential-containers/cloud-api-adaptor/src/peerpod-ctrl/controllers"
peerpodconfigcontrollers "github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl/controllers"
configv1 "github.com/openshift/api/config/v1"
mcfgapi "github.com/openshift/api/machineconfiguration/v1"
secv1 "github.com/openshift/api/security/v1"
Expand Down Expand Up @@ -51,7 +50,6 @@ import (
_ "sigs.k8s.io/controller-tools/pkg/loader"

peerpod "github.com/confidential-containers/cloud-api-adaptor/src/peerpod-ctrl/api/v1alpha1"
peerpodconfig "github.com/confidential-containers/cloud-api-adaptor/src/peerpodconfig-ctrl/api/v1alpha1"
ccov1 "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1"

kataconfigurationv1 "github.com/openshift/sandboxed-containers-operator/api/v1"
Expand Down Expand Up @@ -79,8 +77,6 @@ func init() {

utilruntime.Must(kataconfigurationv1.AddToScheme(scheme))

utilruntime.Must(peerpodconfig.AddToScheme(scheme))

utilruntime.Must(peerpod.AddToScheme(scheme))

utilruntime.Must(configv1.AddToScheme(scheme))
Expand Down Expand Up @@ -153,15 +149,6 @@ func main() {
os.Exit(1)
}

if err = (&peerpodconfigcontrollers.PeerPodConfigReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("RemotePodConfig"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create RemotePodConfig controller for OpenShift cluster", "controller", "RemotePodConfig")
os.Exit(1)
}

if err = (&peerpodcontrollers.PeerPodReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down

0 comments on commit 4b01583

Please sign in to comment.