-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove disabledfeatures from master config #19070
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,16 +27,7 @@ import ( | |
triggerdeploymentconfigs "github.com/openshift/origin/pkg/image/trigger/deploymentconfigs" | ||
) | ||
|
||
type ImageTriggerControllerConfig struct { | ||
HasBuilderEnabled bool | ||
HasDeploymentsEnabled bool | ||
HasDaemonSetsEnabled bool | ||
HasStatefulSetsEnabled bool | ||
HasCronJobsEnabled bool | ||
} | ||
|
||
func (c *ImageTriggerControllerConfig) RunController(ctx ControllerContext) (bool, error) { | ||
//streamInformer := ctx.ImageInformers.Image().InternalVersion().ImageStreams().Informer() | ||
func RunImageTriggerController(ctx ControllerContext) (bool, error) { | ||
informer := ctx.ImageInformers.Image().InternalVersion().ImageStreams() | ||
|
||
buildClient, err := ctx.ClientBuilder.OpenshiftInternalBuildClient(bootstrappolicy.InfraImageTriggerControllerServiceAccountName) | ||
|
@@ -63,51 +54,41 @@ func (c *ImageTriggerControllerConfig) RunController(ctx ControllerContext) (boo | |
Reactor: &triggerdeploymentconfigs.DeploymentConfigReactor{Client: appsClient.Apps()}, | ||
}, | ||
} | ||
if !c.HasBuilderEnabled { | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "build.openshift.io", Resource: "buildconfigs"}, | ||
Informer: ctx.BuildInformers.Build().InternalVersion().BuildConfigs().Informer(), | ||
Store: ctx.BuildInformers.Build().InternalVersion().BuildConfigs().Informer().GetIndexer(), | ||
TriggerFn: triggerbuildconfigs.NewBuildConfigTriggerIndexer, | ||
Reactor: triggerbuildconfigs.NewBuildConfigReactor(bcInstantiator, kclient.Core().RESTClient()), | ||
}) | ||
} | ||
if !c.HasDeploymentsEnabled { | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "extensions", Resource: "deployments"}, | ||
Informer: ctx.ExternalKubeInformers.Extensions().V1beta1().Deployments().Informer(), | ||
Store: ctx.ExternalKubeInformers.Extensions().V1beta1().Deployments().Informer().GetIndexer(), | ||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
} | ||
if !c.HasDaemonSetsEnabled { | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "extensions", Resource: "daemonsets"}, | ||
Informer: ctx.ExternalKubeInformers.Extensions().V1beta1().DaemonSets().Informer(), | ||
Store: ctx.ExternalKubeInformers.Extensions().V1beta1().DaemonSets().Informer().GetIndexer(), | ||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
} | ||
if !c.HasStatefulSetsEnabled { | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "apps", Resource: "statefulsets"}, | ||
Informer: ctx.ExternalKubeInformers.Apps().V1beta1().StatefulSets().Informer(), | ||
Store: ctx.ExternalKubeInformers.Apps().V1beta1().StatefulSets().Informer().GetIndexer(), | ||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
} | ||
if !c.HasCronJobsEnabled { | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "batch", Resource: "cronjobs"}, | ||
Informer: ctx.ExternalKubeInformers.Batch().V2alpha1().CronJobs().Informer(), | ||
Store: ctx.ExternalKubeInformers.Batch().V2alpha1().CronJobs().Informer().GetIndexer(), | ||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
} | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It would have failed validation here, right? https://github.com/openshift/origin/pull/19070/files#diff-6b6e279f3c86e5edb0688c1ca449db56L241 |
||
Resource: schema.GroupResource{Group: "build.openshift.io", Resource: "buildconfigs"}, | ||
Informer: ctx.BuildInformers.Build().InternalVersion().BuildConfigs().Informer(), | ||
Store: ctx.BuildInformers.Build().InternalVersion().BuildConfigs().Informer().GetIndexer(), | ||
TriggerFn: triggerbuildconfigs.NewBuildConfigTriggerIndexer, | ||
Reactor: triggerbuildconfigs.NewBuildConfigReactor(bcInstantiator, kclient.Core().RESTClient()), | ||
}) | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "extensions", Resource: "deployments"}, | ||
Informer: ctx.ExternalKubeInformers.Extensions().V1beta1().Deployments().Informer(), | ||
Store: ctx.ExternalKubeInformers.Extensions().V1beta1().Deployments().Informer().GetIndexer(), | ||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "extensions", Resource: "daemonsets"}, | ||
Informer: ctx.ExternalKubeInformers.Extensions().V1beta1().DaemonSets().Informer(), | ||
Store: ctx.ExternalKubeInformers.Extensions().V1beta1().DaemonSets().Informer().GetIndexer(), | ||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "apps", Resource: "statefulsets"}, | ||
Informer: ctx.ExternalKubeInformers.Apps().V1beta1().StatefulSets().Informer(), | ||
Store: ctx.ExternalKubeInformers.Apps().V1beta1().StatefulSets().Informer().GetIndexer(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While you're at it can you update all these to use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Doesn't that ripple through the types in the controller too? I'd have to update all the trigger funcs, rigth? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll create a followup. |
||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
sources = append(sources, imagetriggercontroller.TriggerSource{ | ||
Resource: schema.GroupResource{Group: "batch", Resource: "cronjobs"}, | ||
Informer: ctx.ExternalKubeInformers.Batch().V2alpha1().CronJobs().Informer(), | ||
Store: ctx.ExternalKubeInformers.Batch().V2alpha1().CronJobs().Informer().GetIndexer(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, but |
||
TriggerFn: triggerannotations.NewAnnotationTriggerIndexer, | ||
Reactor: &triggerannotations.AnnotationReactor{Updater: updater}, | ||
}) | ||
|
||
go imagetriggercontroller.NewTriggerController( | ||
broadcaster, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k was this even logically correct before?
if has not builder enabled, then add trigger for build configs
sounds weird to me?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess not :-) and nobody noticed this since 3.6... shame on me and shame on @smarterclayton who manually merged it ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvmd. false alarm, this code is unfortunate but it works because we check if the feature is disabled when we initialize this struct (the negation should have been there to make this more clear...)