Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#359 from abays/remove_oscl…
Browse files Browse the repository at this point in the history
…ient_default

Remove OSClient default image
  • Loading branch information
openshift-merge-robot authored Jun 26, 2023
2 parents e6eb4f3 + 676698c commit 2e76d6f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ build: generate fmt vet ## Build manager binary.

.PHONY: run
run: export ENABLE_WEBHOOKS?=false
run: export OPENSTACKCLIENT_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-openstackclient:current-podified
run: manifests generate fmt vet ## Run a controller from your host.
/bin/bash hack/clean_local_webhook.sh
go run ./main.go
Expand Down Expand Up @@ -340,7 +339,6 @@ operator-lint: gowork ## Runs operator-lint
# $oc delete -n openstack mutatingwebhookconfiguration/mopenstackcontrolplane.kb.io
SKIP_CERT ?=false
.PHONY: run-with-webhook
run-with-webhook: export OPENSTACKCLIENT_IMAGE_URL_DEFAULT=quay.io/podified-antelope-centos9/openstack-openstackclient:current-podified
run-with-webhook: manifests generate fmt vet ## Run a controller from your host.
/bin/bash hack/configure_local_webhook.sh
go run ./main.go
2 changes: 0 additions & 2 deletions config/default/manager_default_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ spec:
containers:
- name: manager
env:
- name: OPENSTACKCLIENT_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-openstackclient:current-podified
- name: RABBITMQ_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-rabbitmq:current-podified
9 changes: 4 additions & 5 deletions controllers/core/openstackcontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ import (
// OpenStackControlPlaneReconciler reconciles a OpenStackControlPlane object
type OpenStackControlPlaneReconciler struct {
client.Client
Scheme *runtime.Scheme
Kclient kubernetes.Interface
Log logr.Logger
OpenStackClientContainerImage string
Scheme *runtime.Scheme
Kclient kubernetes.Interface
Log logr.Logger
}

//+kubebuilder:rbac:groups=core.openstack.org,resources=openstackcontrolplanes,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -248,7 +247,7 @@ func (r *OpenStackControlPlaneReconciler) reconcileNormal(ctx context.Context, i
return ctrlResult, nil
}

ctrlResult, err = openstack.ReconcileOpenStackClient(ctx, instance, helper, r.OpenStackClientContainerImage)
ctrlResult, err = openstack.ReconcileOpenStackClient(ctx, instance, helper)
if err != nil {
return ctrl.Result{}, err
} else if (ctrlResult != ctrl.Result{}) {
Expand Down
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,10 @@ func main() {
}

if err = (&corecontrollers.OpenStackControlPlaneReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Kclient: kclient,
Log: ctrl.Log.WithName("controllers").WithName("OpenStackControlPlane"),
OpenStackClientContainerImage: os.Getenv("OPENSTACKCLIENT_IMAGE_URL_DEFAULT"),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Kclient: kclient,
Log: ctrl.Log.WithName("controllers").WithName("OpenStackControlPlane"),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "OpenStackControlPlane")
os.Exit(1)
Expand Down
4 changes: 1 addition & 3 deletions pkg/openstack/openstackclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (
)

// ReconcileOpenStackClient -
func ReconcileOpenStackClient(ctx context.Context, instance *corev1beta1.OpenStackControlPlane, helper *helper.Helper, openstackClientImage string) (ctrl.Result, error) {
func ReconcileOpenStackClient(ctx context.Context, instance *corev1beta1.OpenStackControlPlane, helper *helper.Helper) (ctrl.Result, error) {

openstackclient := &clientv1beta1.OpenStackClient{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -46,8 +46,6 @@ func ReconcileOpenStackClient(ctx context.Context, instance *corev1beta1.OpenSta

helper.GetLogger().Info("Reconciling OpenStackClient", "OpenStackClient.Namespace", instance.Namespace, "OpenStackClient.Name", openstackclient.Name)
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), openstackclient, func() error {
openstackclient.Spec.ContainerImage = openstackClientImage

// the following are created/owned by keystoneclient
openstackclient.Spec.OpenStackConfigMap = "openstack-config"
openstackclient.Spec.OpenStackConfigSecret = "openstack-config-secret"
Expand Down

0 comments on commit 2e76d6f

Please sign in to comment.