Skip to content
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

Static pod revision pruning #134

Merged
merged 2 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/cluster-kube-controller-manager-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/cmd/operator"
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/cmd/render"
"github.com/openshift/library-go/pkg/operator/staticpod/installerpod"
"github.com/openshift/library-go/pkg/operator/staticpod/prune"
)

func main() {
Expand Down Expand Up @@ -47,6 +48,7 @@ func NewSSCSCommand() *cobra.Command {
cmd.AddCommand(operator.NewOperator())
cmd.AddCommand(render.NewRenderCommand(os.Stderr))
cmd.AddCommand(installerpod.NewInstaller())
cmd.AddCommand(prune.NewPrune())

return cmd
}
15 changes: 9 additions & 6 deletions glide.lock

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

2 changes: 1 addition & 1 deletion pkg/apis/kubecontrollermanager/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type KubeControllerManagerOperatorConfig struct {
}

type KubeControllerManagerOperatorConfigSpec struct {
operatorsv1.OperatorSpec `json:",inline"`
operatorsv1.StaticPodOperatorSpec `json:",inline"`

// forceRedeploymentReason can be used to force the redeployment of the kube-controller-manager by providing a unique string.
// This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work
Expand Down

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

4 changes: 2 additions & 2 deletions pkg/operator/operatorclient/operatorclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ func (c *OperatorClient) Informer() cache.SharedIndexInformer {
return c.Informers.Kubecontrollermanager().V1alpha1().KubeControllerManagerOperatorConfigs().Informer()
}

func (c *OperatorClient) GetStaticPodOperatorState() (*operatorv1.OperatorSpec, *operatorv1.StaticPodOperatorStatus, string, error) {
func (c *OperatorClient) GetStaticPodOperatorState() (*operatorv1.StaticPodOperatorSpec, *operatorv1.StaticPodOperatorStatus, string, error) {
instance, err := c.Informers.Kubecontrollermanager().V1alpha1().KubeControllerManagerOperatorConfigs().Lister().Get("cluster")
if err != nil {
return nil, nil, "", err
}

return &instance.Spec.OperatorSpec, &instance.Status.StaticPodOperatorStatus, instance.ResourceVersion, nil
return &instance.Spec.StaticPodOperatorSpec, &instance.Status.StaticPodOperatorStatus, instance.ResourceVersion, nil
}

func (c *OperatorClient) UpdateStaticPodOperatorStatus(resourceVersion string, status *operatorv1.StaticPodOperatorStatus) (*operatorv1.StaticPodOperatorStatus, error) {
Expand Down
6 changes: 4 additions & 2 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"os"
"time"

"github.com/openshift/library-go/pkg/operator/staticpod/controller/revision"

"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
Expand All @@ -26,6 +24,7 @@ import (
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/resourcesynccontroller"
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/targetconfigcontroller"
"github.com/openshift/cluster-kube-controller-manager-operator/pkg/operator/v311_00_assets"
"github.com/openshift/library-go/pkg/operator/staticpod/controller/revision"
)

func RunOperator(ctx *controllercmd.ControllerContext) error {
Expand Down Expand Up @@ -97,12 +96,15 @@ func RunOperator(ctx *controllercmd.ControllerContext) error {
staticPodControllers := staticpod.NewControllers(
operatorclient.TargetNamespace,
"openshift-kube-controller-manager",
"kube-controller-manager-pod",
[]string{"cluster-kube-controller-manager-operator", "installer"},
[]string{"cluster-kube-controller-manager-operator", "prune"},
deploymentConfigMaps,
deploymentSecrets,
operatorClient,
v1helpers.CachedConfigMapGetter(kubeClient, kubeInformersForNamespaces),
v1helpers.CachedSecretGetter(kubeClient, kubeInformersForNamespaces),
kubeClient.CoreV1(),
kubeClient,
dynamicClient,
kubeInformersForNamespaces.InformersFor(operatorclient.TargetNamespace),
Expand Down
29 changes: 22 additions & 7 deletions vendor/github.com/davecgh/go-spew/.travis.yml

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

2 changes: 1 addition & 1 deletion vendor/github.com/davecgh/go-spew/LICENSE

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

12 changes: 4 additions & 8 deletions vendor/github.com/davecgh/go-spew/README.md

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

Loading