Skip to content

Commit

Permalink
Merge pull request #404 from guillaumerose/profilepoc
Browse files Browse the repository at this point in the history
Bug 1907329: Add cluster profile support
  • Loading branch information
openshift-merge-robot committed Jan 11, 2021
2 parents 1e51a0e + 8f4d36c commit 9f50a07
Show file tree
Hide file tree
Showing 31 changed files with 272 additions and 126 deletions.
2 changes: 1 addition & 1 deletion hack/cluster-version-util/task_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func newTaskGraphCmd() *cobra.Command {

func runTaskGraphCmd(cmd *cobra.Command, args []string) error {
manifestDir := args[0]
release, err := payload.LoadUpdate(manifestDir, "", "")
release, err := payload.LoadUpdate(manifestDir, "", "", payload.DefaultClusterProfile)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions install/0000_00_cluster-version-operator_00_namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Namespace
metadata:
name: openshift-cluster-version
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
openshift.io/node-selector: ""
labels:
name: openshift-cluster-version
Expand Down
2 changes: 2 additions & 0 deletions install/0000_00_cluster-version-operator_02_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cluster-version-operator
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
roleRef:
kind: ClusterRole
name: cluster-admin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: openshift-cluster-version
annotations:
exclude.release.openshift.io/internal-openshift-hosted: "true"
include.release.openshift.io/self-managed-high-availability: "true"
spec:
selector:
matchLabels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Role
metadata:
name: prometheus-k8s
namespace: openshift-cluster-version
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: openshift-cluster-version
annotations:
exclude.release.openshift.io/internal-openshift-hosted: "true"
include.release.openshift.io/self-managed-high-availability: "true"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
namespace: openshift-cluster-version
annotations:
exclude.release.openshift.io/internal-openshift-hosted: "true"
include.release.openshift.io/self-managed-high-availability: "true"
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
Expand All @@ -32,6 +33,7 @@ metadata:
namespace: openshift-cluster-version
annotations:
exclude.release.openshift.io/internal-openshift-hosted: "true"
include.release.openshift.io/self-managed-high-availability: "true"
spec:
groups:
- name: cluster-version
Expand Down
3 changes: 2 additions & 1 deletion install/0001_00_cluster-version-operator_03_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ metadata:
labels:
k8s-app: cluster-version-operator
annotations:
service.beta.openshift.io/serving-cert-secret-name: cluster-version-operator-serving-cert
include.release.openshift.io/self-managed-high-availability: "true"
exclude.release.openshift.io/internal-openshift-hosted: "true"
service.beta.openshift.io/serving-cert-secret-name: cluster-version-operator-serving-cert
spec:
type: ClusterIP
selector:
Expand Down
9 changes: 7 additions & 2 deletions pkg/cvo/cvo.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ type Operator struct {
// exclude is an optional identifier used to exclude certain manifests
// via annotation
exclude string

clusterProfile string
}

// New returns a new cluster version operator.
Expand All @@ -166,6 +168,7 @@ func New(
client clientset.Interface,
kubeClient kubernetes.Interface,
exclude string,
clusterProfile string,
) *Operator {
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(klog.Infof)
Expand Down Expand Up @@ -194,7 +197,8 @@ func New(
availableUpdatesQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "availableupdates"),
upgradeableQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "upgradeable"),

exclude: exclude,
exclude: exclude,
clusterProfile: clusterProfile,
}

cvInformer.Informer().AddEventHandler(optr.eventHandler())
Expand All @@ -219,7 +223,7 @@ func New(
// controller that loads and applies content to the cluster. It returns an error if the payload appears to
// be in error rather than continuing.
func (optr *Operator) InitializeFromPayload(restConfig *rest.Config, burstRestConfig *rest.Config) error {
update, err := payload.LoadUpdate(optr.defaultPayloadDir(), optr.release.Image, optr.exclude)
update, err := payload.LoadUpdate(optr.defaultPayloadDir(), optr.release.Image, optr.exclude, optr.clusterProfile)
if err != nil {
return fmt.Errorf("the local release contents are invalid - no current version can be determined from disk: %v", err)
}
Expand Down Expand Up @@ -261,6 +265,7 @@ func (optr *Operator) InitializeFromPayload(restConfig *rest.Config, burstRestCo
},
optr.exclude,
optr.eventRecorder,
optr.clusterProfile,
)

return nil
Expand Down
Loading

0 comments on commit 9f50a07

Please sign in to comment.