Skip to content

Commit

Permalink
Allow rsct image to configure runtime via RSCT spec
Browse files Browse the repository at this point in the history
Signed-off-by: Varad Ahirwadkar <[email protected]>
  • Loading branch information
varad-ahirwadkar committed Jul 2, 2024
1 parent 37b57a9 commit 1fd9f8b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
10 changes: 8 additions & 2 deletions api/v1alpha1/rsct_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,25 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// DefaultRSCTImage is an default RSCT Image
const DefaultRSCTImage = "quay.io/powercloud/rsct-ppc64le:latest"

// RSCTSpec defines the desired state of RSCT
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
// +optional
// +kubebuilder:default=`quay.io/powercloud/rsct-ppc64le:latest`
RSCTImage string `json:"image,omitempty"`
}

// RSCTStatus defines the observed state of RSCT
type RSCTStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

}

//+kubebuilder:object:root=true
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/rsct-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2024-06-04T09:24:45Z"
createdAt: "2024-07-02T11:56:43Z"
operators.operatorframework.io/builder: operator-sdk-v1.34.1
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
name: rsct-operator.v0.0.1
Expand Down
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
9 changes: 7 additions & 2 deletions internal/controller/rsct_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ 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"

// Using the default RSCT image if not specified in RSCTSpec
if rsct.Spec.RSCTImage == "" {
r.Config.Image = rsctv1alpha1.DefaultRSCTImage
} else {
r.Config.Image = rsct.Spec.RSCTImage
}

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

0 comments on commit 1fd9f8b

Please sign in to comment.