Skip to content

Commit

Permalink
Merge pull request #4 from Mirantis/fix-ingress-reconcile
Browse files Browse the repository at this point in the history
Fix an issue where ingress was being reconcilled when it is not specified in the specs
  • Loading branch information
ranyodh authored Nov 1, 2023
2 parents 5ad1934 + 9ec6096 commit bafbdec
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 15 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Docker Image

on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build docker image
working-directory: .
run: make docker-build
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: Build Boundless Operator Docker Image
name: Build and Push Docker Image

on:
push:
branches: [ "main" ]
pull_request:
types: [opened, reopened]
branches: [ "main" ]

jobs:
build-and-push:
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/blueprint_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ type BlueprintSpec struct {

// Component defines the core and addons components that should be installed
type Component struct {
Core Core `json:"core,omitempty"`
Core *Core `json:"core,omitempty"`
Addons []AddonSpec `json:"addons,omitempty"`
}

type Core struct {
Ingress IngressSpec `json:"ingress,omitempty"`
Ingress *IngressSpec `json:"ingress,omitempty"`
}

// BlueprintStatus defines the observed state of Blueprint
Expand Down
12 changes: 10 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions controllers/blueprint_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ func (r *BlueprintReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}
}

logger.Info("Reconciling ingress")
err = r.createOrUpdateIngress(ctx, logger, ingressResource(&instance.Spec.Components.Core.Ingress))
if err != nil {
logger.Error(err, "Failed to reconcile ingress", "Name", instance.Spec.Components.Core.Ingress)
return ctrl.Result{Requeue: true}, err
if instance.Spec.Components.Core != nil && instance.Spec.Components.Core.Ingress != nil {
logger.Info("Reconciling ingress")
err = r.createOrUpdateIngress(ctx, logger, ingressResource(instance.Spec.Components.Core.Ingress))
if err != nil {
logger.Error(err, "Failed to reconcile ingress", "Name", instance.Spec.Components.Core.Ingress)
return ctrl.Result{Requeue: true}, err
}
}

for _, addon := range instance.Spec.Components.Addons {
Expand Down Expand Up @@ -101,7 +103,7 @@ func (r *BlueprintReconciler) createOrUpdateAddon(ctx context.Context, logger lo
return nil
}

logger.Info("Creating add-on", "Name", existing.Name)
logger.Info("Creating add-on", "Name", obj.GetName())
err = r.Create(ctx, obj)
if err != nil {
return fmt.Errorf("failed to create add-on %s: %w", obj.GetName(), err)
Expand All @@ -128,7 +130,7 @@ func (r *BlueprintReconciler) createOrUpdateIngress(ctx context.Context, logger
return nil
}

logger.Info("Creating ingress", "Name", existing.Name)
logger.Info("Creating ingress", "Name", obj.GetName())
err = r.Create(ctx, obj)
if err != nil {
return fmt.Errorf("failed to create ingress %s: %w", obj.GetName(), err)
Expand Down

0 comments on commit bafbdec

Please sign in to comment.