Skip to content

Commit

Permalink
Merge pull request #23 from varad-ahirwadkar/rsct-image
Browse files Browse the repository at this point in the history
Allow RSCT image to configure runtime via the RSCT spec
  • Loading branch information
Power Cloud Robot authored Jul 18, 2024
2 parents 432cbbd + ab32ea3 commit 1b3e7af
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
6 changes: 4 additions & 2 deletions api/v1alpha1/rsct_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ type RSCTSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of RSCT. Edit rsct_types.go to remove/update
Foo string `json:"foo,omitempty"`
// Image is an RSCT image
// +kubebuilder:default="quay.io/powercloud/rsct-ppc64le:latest"
// +optional
Image *string `json:"image,omitempty"`
}

// RSCTStatus defines the observed state of RSCT
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

6 changes: 3 additions & 3 deletions bundle/manifests/rsct.ibm.com_rscts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ spec:
spec:
description: RSCTSpec defines the desired state of RSCT
properties:
foo:
description: Foo is an example field of RSCT. Edit rsct_types.go to
remove/update
image:
default: quay.io/powercloud/rsct-ppc64le:latest
description: Image is an RSCT image
type: string
type: object
status:
Expand Down
6 changes: 3 additions & 3 deletions config/crd/bases/rsct.ibm.com_rscts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ spec:
spec:
description: RSCTSpec defines the desired state of RSCT
properties:
foo:
description: Foo is an example field of RSCT. Edit rsct_types.go to
remove/update
image:
default: quay.io/powercloud/rsct-ppc64le:latest
description: Image is an RSCT image
type: string
type: object
status:
Expand Down
1 change: 0 additions & 1 deletion internal/controller/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const (
osID = "rhcos"
rmcPort = 657
rmcAppName = "powervm-rmc"
rsctImage = "quay.io/powercloud/rsct-ppc64le:latest"
)

type DaemonSetConfig struct {
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/rsct_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ func (r *RSCTReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
return reconcile.Result{}, fmt.Errorf("failed to get RSCT %s: %w", req, err)
}

// TODO(mjturek): Allow image specification
r.Config.Namespace = rsct.Namespace
r.Config.Name = rsct.Name
r.Config.Image = "quay.io/powercloud/rsct-ppc64le:latest"
// Set default RSCT image if not specified
if rsct.Spec.Image != nil {
r.Config.Image = *rsct.Spec.Image
}

haveServiceAccount, sa, err := r.ensureRSCTServiceAccount(ctx, rsct)
if err != nil {
Expand Down

0 comments on commit 1b3e7af

Please sign in to comment.