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

Update node placement #5

Merged
merged 3 commits into from
Sep 11, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
)

const (
// HttpServerDeploymentName defines the name of the HTTP server deployment
HttpServerDeploymentName = "http-server"
// HttpServerName defines the name of the HTTP server service
HttpServerName = "http-server"
// HTTPServerDeploymentName defines the name of the HTTP server deployment
HTTPServerDeploymentName = "http-server"
// HTTPServerName defines the name of the HTTP server service
HTTPServerName = "http-server"
deploymentMatchKey = "sample-operator.kubevirt.io"
httpServerPort = 8081
)
Expand Down Expand Up @@ -57,13 +57,13 @@ func (m *CrManager) Status(cr runtime.Object) *sdkapi.Status {
func (m *CrManager) GetAllResources(_ runtime.Object) ([]runtime.Object, error) {
namespace := m.operatorArgs.Namespace

serviceAccount := resourceBuilder.CreateServiceAccount(HttpServerName)
serviceAccount := resourceBuilder.CreateServiceAccount(HTTPServerName)
serviceAccount.Namespace = namespace

role := resourceBuilder.CreateRole(HttpServerName, []rbacv1.PolicyRule{})
role := resourceBuilder.CreateRole(HTTPServerName, []rbacv1.PolicyRule{})
role.Namespace = namespace

roleBinding := resourceBuilder.CreateRoleBinding(HttpServerName, HttpServerName, HttpServerName, namespace)
roleBinding := resourceBuilder.CreateRoleBinding(HTTPServerName, HTTPServerName, HTTPServerName, namespace)
roleBinding.Namespace = namespace

httpDeployment := m.createHTTPServerDeployment()
Expand All @@ -79,7 +79,7 @@ func (m *CrManager) GetAllResources(_ runtime.Object) ([]runtime.Object, error)
}

func (m *CrManager) createHTTPServerService() *v1.Service {
httpService := resourceBuilder.CreateService(HttpServerName, deploymentMatchKey, HttpServerName, nil)
httpService := resourceBuilder.CreateService(HTTPServerName, deploymentMatchKey, HTTPServerName, nil)
httpService.Namespace = m.operatorArgs.Namespace
httpService.Spec.Type = v1.ServiceTypeNodePort
httpService.Spec.Ports = []v1.ServicePort{
Expand All @@ -102,7 +102,7 @@ func (m *CrManager) createHTTPServerDeployment() *appsv1.Deployment {
*container,
},
}
return resourceBuilder.CreateOperatorDeployment(HttpServerDeploymentName, m.operatorArgs.Namespace, deploymentMatchKey, HttpServerName, HttpServerName, 1, podSpec)
return resourceBuilder.CreateOperatorDeployment(HTTPServerDeploymentName, m.operatorArgs.Namespace, deploymentMatchKey, HTTPServerName, HTTPServerName, 1, podSpec)
}

// GetDependantResourcesListObjects returns resource list objects of dependant resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var _ = Describe("Operator lifecycle test ", func() {

By("Confirming that the HTTP server deployment is gone")
Eventually(func() error {
_, err := deployments.Get(context.TODO(), sampleconfig.HttpServerDeploymentName, v1meta.GetOptions{})
_, err := deployments.Get(context.TODO(), sampleconfig.HTTPServerDeploymentName, v1meta.GetOptions{})
return err
}, 2*time.Minute, time.Second).Should(
And(
Expand All @@ -147,7 +147,7 @@ var _ = Describe("Operator lifecycle test ", func() {

func assertHTTPServerAvailable(f *fwk.Framework) bool {
return Eventually(func() (int32, error) {
httpDeployment, err := f.K8sClient.AppsV1().Deployments(f.OperatorInstallNamespace).Get(context.TODO(), sampleconfig.HttpServerDeploymentName, v1meta.GetOptions{})
httpDeployment, err := f.K8sClient.AppsV1().Deployments(f.OperatorInstallNamespace).Get(context.TODO(), sampleconfig.HTTPServerDeploymentName, v1meta.GetOptions{})
if err != nil {
return 0, err
}
Expand Down

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

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

2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ replace (
k8s.io/api => k8s.io/api v0.18.6
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.6
k8s.io/apimachinery => k8s.io/apimachinery v0.18.6
k8s.io/apiserver => k8s.io/apiserver v0.18.6
k8s.io/client-go => k8s.io/client-go v0.18.6
k8s.io/code-generator => k8s.io/code-generator v0.18.6

sigs.k8s.io/structured-merge-diff => sigs.k8s.io/structured-merge-diff v1.0.0
)
Loading