UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Platform One
P
Party Bus
Valkyrie
valkyrie-api
Compare Revisions
fd5410cbc8821ac05945d6f350b125797186bcfd...1922454612b35e1b29102f62da48da44b6423506
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
15 additions
and
497 deletions
+15
-497
config/samples/customer_v1alpha1_authorizingofficial.yaml
config/samples/customer_v1alpha1_authorizingofficial.yaml
+0
-7
config/samples/customer_v1alpha1_chiefinformationsecurityofficer.yaml
...es/customer_v1alpha1_chiefinformationsecurityofficer.yaml
+0
-7
config/samples/customer_v1alpha1_customer.yaml
config/samples/customer_v1alpha1_customer.yaml
+0
-7
config/samples/customer_v1alpha1_organization.yaml
config/samples/customer_v1alpha1_organization.yaml
+0
-7
config/samples/customer_v1alpha1_systemowner.yaml
config/samples/customer_v1alpha1_systemowner.yaml
+0
-7
controllers/customer/authorizingofficial_controller.go
controllers/customer/authorizingofficial_controller.go
+0
-62
controllers/customer/chiefinformationsecurityofficer_controller.go
...rs/customer/chiefinformationsecurityofficer_controller.go
+0
-62
controllers/customer/customer_controller.go
controllers/customer/customer_controller.go
+0
-63
controllers/customer/organization_controller.go
controllers/customer/organization_controller.go
+0
-63
controllers/customer/suite_test.go
controllers/customer/suite_test.go
+0
-92
controllers/customer/systemowner_controller.go
controllers/customer/systemowner_controller.go
+0
-62
controllers/gitlab/dnsrepocredential_controller_test.go
controllers/gitlab/dnsrepocredential_controller_test.go
+2
-3
controllers/gitlab/gitlabcredentials_controller_test.go
controllers/gitlab/gitlabcredentials_controller_test.go
+2
-3
driver.go
driver.go
+0
-23
driver_test.go
driver_test.go
+11
-27
main.go
main.go
+0
-2
No files found.
config/samples/customer_v1alpha1_authorizingofficial.yaml
deleted
100644 → 0
View file @
fd5410cb
apiVersion
:
customer.valkyrie.dso.mil/v1alpha1
kind
:
AuthorizingOfficial
metadata
:
name
:
authorizingofficial-sample
spec
:
# Add fields here
foo
:
bar
config/samples/customer_v1alpha1_chiefinformationsecurityofficer.yaml
deleted
100644 → 0
View file @
fd5410cb
apiVersion
:
customer.valkyrie.dso.mil/v1alpha1
kind
:
ChiefInformationSecurityOfficer
metadata
:
name
:
chiefinformationsecurityofficer-sample
spec
:
# Add fields here
foo
:
bar
config/samples/customer_v1alpha1_customer.yaml
deleted
100644 → 0
View file @
fd5410cb
apiVersion
:
customer.valkyrie.dso.mil/v1alpha1
kind
:
Customer
metadata
:
name
:
customer-sample
spec
:
# Add fields here
foo
:
bar
config/samples/customer_v1alpha1_organization.yaml
deleted
100644 → 0
View file @
fd5410cb
apiVersion
:
customer.valkyrie.dso.mil/v1alpha1
kind
:
Organization
metadata
:
name
:
organization-sample
spec
:
# Add fields here
foo
:
bar
config/samples/customer_v1alpha1_systemowner.yaml
deleted
100644 → 0
View file @
fd5410cb
apiVersion
:
customer.valkyrie.dso.mil/v1alpha1
kind
:
SystemOwner
metadata
:
name
:
systemowner-sample
spec
:
# Add fields here
foo
:
bar
controllers/customer/authorizingofficial_controller.go
deleted
100644 → 0
View file @
fd5410cb
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
customer
import
(
"context"
"k8s.io/apimachinery/pkg/runtime"
ctrl
"sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
)
// AuthorizingOfficialReconciler reconciles a AuthorizingOfficial object
type
AuthorizingOfficialReconciler
struct
{
client
.
Client
Scheme
*
runtime
.
Scheme
}
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=authorizingofficials,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=authorizingofficials/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=authorizingofficials/finalizers,verbs=update
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the AuthorizingOfficial object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile
func
(
r
*
AuthorizingOfficialReconciler
)
Reconcile
(
ctx
context
.
Context
,
req
ctrl
.
Request
)
(
ctrl
.
Result
,
error
)
{
_
=
log
.
FromContext
(
ctx
)
// your logic here
return
ctrl
.
Result
{},
nil
}
// SetupWithManager sets up the controller with the Manager.
func
(
r
*
AuthorizingOfficialReconciler
)
SetupWithManager
(
mgr
ctrl
.
Manager
)
error
{
return
ctrl
.
NewControllerManagedBy
(
mgr
)
.
For
(
&
customerv1alpha1
.
AuthorizingOfficial
{})
.
Complete
(
r
)
}
controllers/customer/chiefinformationsecurityofficer_controller.go
deleted
100644 → 0
View file @
fd5410cb
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
customer
import
(
"context"
"k8s.io/apimachinery/pkg/runtime"
ctrl
"sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
)
// ChiefInformationSecurityOfficerReconciler reconciles a ChiefInformationSecurityOfficer object
type
ChiefInformationSecurityOfficerReconciler
struct
{
client
.
Client
Scheme
*
runtime
.
Scheme
}
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=chiefinformationsecurityofficers,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=chiefinformationsecurityofficers/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=chiefinformationsecurityofficers/finalizers,verbs=update
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the ChiefInformationSecurityOfficer object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile
func
(
r
*
ChiefInformationSecurityOfficerReconciler
)
Reconcile
(
ctx
context
.
Context
,
req
ctrl
.
Request
)
(
ctrl
.
Result
,
error
)
{
_
=
log
.
FromContext
(
ctx
)
// your logic here
return
ctrl
.
Result
{},
nil
}
// SetupWithManager sets up the controller with the Manager.
func
(
r
*
ChiefInformationSecurityOfficerReconciler
)
SetupWithManager
(
mgr
ctrl
.
Manager
)
error
{
return
ctrl
.
NewControllerManagedBy
(
mgr
)
.
For
(
&
customerv1alpha1
.
ChiefInformationSecurityOfficer
{})
.
Complete
(
r
)
}
controllers/customer/customer_controller.go
deleted
100644 → 0
View file @
fd5410cb
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
customer
import
(
"context"
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/runtime"
ctrl
"sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
)
// Reconciler reconciles a Customer object
type
Reconciler
struct
{
client
.
Client
Log
logr
.
Logger
Scheme
*
runtime
.
Scheme
}
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=customers,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=customers/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=customers/finalizers,verbs=update
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the Customer object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.7.2/pkg/reconcile
func
(
r
*
Reconciler
)
Reconcile
(
ctx
context
.
Context
,
req
ctrl
.
Request
)
(
ctrl
.
Result
,
error
)
{
_
=
r
.
Log
.
WithValues
(
"customer"
,
req
.
NamespacedName
)
// your logic here
return
ctrl
.
Result
{},
nil
}
// SetupWithManager sets up the controller with the Manager.
func
(
r
*
Reconciler
)
SetupWithManager
(
mgr
ctrl
.
Manager
)
error
{
return
ctrl
.
NewControllerManagedBy
(
mgr
)
.
For
(
&
customerv1alpha1
.
Customer
{})
.
Complete
(
r
)
}
controllers/customer/organization_controller.go
deleted
100644 → 0
View file @
fd5410cb
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
customer
import
(
"context"
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/runtime"
ctrl
"sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
)
// OrganizationReconciler reconciles a Organization object
type
OrganizationReconciler
struct
{
client
.
Client
Log
logr
.
Logger
Scheme
*
runtime
.
Scheme
}
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=organizations,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=organizations/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=organizations/finalizers,verbs=update
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the Organization object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.7.2/pkg/reconcile
func
(
r
*
OrganizationReconciler
)
Reconcile
(
ctx
context
.
Context
,
req
ctrl
.
Request
)
(
ctrl
.
Result
,
error
)
{
_
=
r
.
Log
.
WithValues
(
"organization"
,
req
.
NamespacedName
)
// your logic here
return
ctrl
.
Result
{},
nil
}
// SetupWithManager sets up the controller with the Manager.
func
(
r
*
OrganizationReconciler
)
SetupWithManager
(
mgr
ctrl
.
Manager
)
error
{
return
ctrl
.
NewControllerManagedBy
(
mgr
)
.
For
(
&
customerv1alpha1
.
Organization
{})
.
Complete
(
r
)
}
controllers/customer/suite_test.go
deleted
100644 → 0
View file @
fd5410cb
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
customer
import
(
"path/filepath"
"testing"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
//+kubebuilder:scaffold:imports
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
var
cfg
*
rest
.
Config
var
k8sClient
client
.
Client
var
testEnv
*
envtest
.
Environment
func
TestAPIs
(
t
*
testing
.
T
)
{
RegisterFailHandler
(
Fail
)
RunSpecsWithDefaultAndCustomReporters
(
t
,
"Controller Suite"
,
[]
Reporter
{
printer
.
NewlineReporter
{}})
}
var
_
=
BeforeSuite
(
func
()
{
logf
.
SetLogger
(
zap
.
New
(
zap
.
WriteTo
(
GinkgoWriter
),
zap
.
UseDevMode
(
true
)))
By
(
"bootstrapping test environment"
)
testEnv
=
&
envtest
.
Environment
{
CRDDirectoryPaths
:
[]
string
{
filepath
.
Join
(
".."
,
".."
,
"config"
,
"crd"
,
"bases"
)},
ErrorIfCRDPathMissing
:
true
,
}
cfg
,
err
:=
testEnv
.
Start
()
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
cfg
)
.
NotTo
(
BeNil
())
err
=
customerv1alpha1
.
AddToScheme
(
scheme
.
Scheme
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
customerv1alpha1
.
AddToScheme
(
scheme
.
Scheme
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
customerv1alpha1
.
AddToScheme
(
scheme
.
Scheme
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
customerv1alpha1
.
AddToScheme
(
scheme
.
Scheme
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
customerv1alpha1
.
AddToScheme
(
scheme
.
Scheme
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
//+kubebuilder:scaffold:scheme
k8sClient
,
err
=
client
.
New
(
cfg
,
client
.
Options
{
Scheme
:
scheme
.
Scheme
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
k8sClient
)
.
NotTo
(
BeNil
())
},
60
)
var
_
=
AfterSuite
(
func
()
{
By
(
"tearing down the test environment"
)
err
:=
testEnv
.
Stop
()
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
})
controllers/customer/systemowner_controller.go
deleted
100644 → 0
View file @
fd5410cb
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
customer
import
(
"context"
"k8s.io/apimachinery/pkg/runtime"
ctrl
"sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
)
// SystemOwnerReconciler reconciles a SystemOwner object
type
SystemOwnerReconciler
struct
{
client
.
Client
Scheme
*
runtime
.
Scheme
}
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=systemowners,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=systemowners/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=customer.valkyrie.dso.mil,resources=systemowners/finalizers,verbs=update
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the SystemOwner object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile
func
(
r
*
SystemOwnerReconciler
)
Reconcile
(
ctx
context
.
Context
,
req
ctrl
.
Request
)
(
ctrl
.
Result
,
error
)
{
_
=
log
.
FromContext
(
ctx
)
// your logic here
return
ctrl
.
Result
{},
nil
}
// SetupWithManager sets up the controller with the Manager.
func
(
r
*
SystemOwnerReconciler
)
SetupWithManager
(
mgr
ctrl
.
Manager
)
error
{
return
ctrl
.
NewControllerManagedBy
(
mgr
)
.
For
(
&
customerv1alpha1
.
SystemOwner
{})
.
Complete
(
r
)
}
controllers/gitlab/dnsrepocredential_controller_test.go
View file @
19224546
...
...
@@ -6,7 +6,6 @@ import (
.
"github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"
ctrl
"sigs.k8s.io/controller-runtime"
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
gitlabv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/gitlab/v1alpha1"
)
...
...
@@ -42,14 +41,14 @@ var _ = Describe("dnsrepocredential_controller", func() {
})
})
Describe
(
"SetupWithManager"
,
func
()
{
v1alpha1
.
SchemeBuilder
.
Register
(
&
gitlabv1alpha1
.
DNSRepoCredential
{},
&
gitlabv1alpha1
.
DNSRepoCredentialList
{})
gitlab
v1alpha1
.
SchemeBuilder
.
Register
(
&
gitlabv1alpha1
.
DNSRepoCredential
{},
&
gitlabv1alpha1
.
DNSRepoCredentialList
{})
sut
:=
DNSRepoCredentialReconciler
{
Client
:
nil
,
Log
:
nil
,
Scheme
:
nil
,
}
mgr
:=
MockManager
{
builder
:
v1alpha1
.
SchemeBuilder
,
builder
:
gitlab
v1alpha1
.
SchemeBuilder
,
Log
:
&
MockLogger
{},
addHealthzCheckFunction
:
nil
,
addHealthzCheckWasCalled
:
false
,
...
...
controllers/gitlab/gitlabcredentials_controller_test.go
View file @
19224546
...
...
@@ -6,7 +6,6 @@ import (
.
"github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"
ctrl
"sigs.k8s.io/controller-runtime"
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
gitlabv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/gitlab/v1alpha1"
)
...
...
@@ -42,14 +41,14 @@ var _ = Describe("gitlabcredentials_controller", func() {
})
})
Describe
(
"SetupWithManager"
,
func
()
{
v1alpha1
.
SchemeBuilder
.
Register
(
&
gitlabv1alpha1
.
GitlabCredentials
{},
&
gitlabv1alpha1
.
GitlabCredentialsList
{})
gitlab
v1alpha1
.
SchemeBuilder
.
Register
(
&
gitlabv1alpha1
.
GitlabCredentials
{},
&
gitlabv1alpha1
.
GitlabCredentialsList
{})
sut
:=
CredentialsReconciler
{
Client
:
nil
,
Log
:
nil
,
Scheme
:
nil
,
}
mgr
:=
MockManager
{
builder
:
v1alpha1
.
SchemeBuilder
,
builder
:
gitlab
v1alpha1
.
SchemeBuilder
,
Log
:
&
MockLogger
{},
addHealthzCheckFunction
:
nil
,
addHealthzCheckWasCalled
:
false
,
...
...
driver.go
View file @
19224546
...
...
@@ -9,7 +9,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"valkyrie.dso.mil/valkyrie-api/controllers"
customercontrollers
"valkyrie.dso.mil/valkyrie-api/controllers/customer"
fortifycontrollers
"valkyrie.dso.mil/valkyrie-api/controllers/fortify"
gitlabcontrollers
"valkyrie.dso.mil/valkyrie-api/controllers/gitlab"
twistlockcontrollers
"valkyrie.dso.mil/valkyrie-api/controllers/twistlock"
...
...
@@ -122,16 +121,6 @@ func (d driverImpl) newManager(metricsAddress string, healthProbeAddress string,
func
(
d
driverImpl
)
instantiateControllers
(
mgr
manager
.
Manager
)
[]
controllers
.
ManagedController
{
if
d
.
instantiateControllersOverride
==
nil
{
return
[]
controllers
.
ManagedController
{
&
customercontrollers
.
Reconciler
{
Client
:
mgr
.
GetClient
(),
Log
:
ctrl
.
Log
.
WithName
(
"controllers"
)
.
WithName
(
"customer"
)
.
WithName
(
"Customer"
),
Scheme
:
mgr
.
GetScheme
(),
},
&
customercontrollers
.
OrganizationReconciler
{
Client
:
mgr
.
GetClient
(),
Log
:
ctrl
.
Log
.
WithName
(
"controllers"
)
.
WithName
(
"customer"
)
.
WithName
(
"Organization"
),
Scheme
:
mgr
.
GetScheme
(),
},
&
gitlabcontrollers
.
GroupReconciler
{
Client
:
mgr
.
GetClient
(),
Log
:
ctrl
.
Log
.
WithName
(
"controllers"
)
.
WithName
(
"gitlab"
)
.
WithName
(
"Group"
),
...
...
@@ -172,18 +161,6 @@ func (d driverImpl) instantiateControllers(mgr manager.Manager) []controllers.Ma
Log
:
ctrl
.
Log
.
WithName
(
"controllers"
)
.
WithName
(
"gitlab"
)
.
WithName
(
"SdElementsPipelineConfiguration"
),
Scheme
:
mgr
.
GetScheme
(),
},
&
customercontrollers
.
AuthorizingOfficialReconciler
{
Client
:
mgr
.
GetClient
(),
Scheme
:
mgr
.
GetScheme
(),
},
&
customercontrollers
.
SystemOwnerReconciler
{
Client
:
mgr
.
GetClient
(),
Scheme
:
mgr
.
GetScheme
(),
},
&
customercontrollers
.
ChiefInformationSecurityOfficerReconciler
{
Client
:
mgr
.
GetClient
(),
Scheme
:
mgr
.
GetScheme
(),
},
&
gitlabcontrollers
.
CredentialsReconciler
{
Client
:
mgr
.
GetClient
(),
Log
:
ctrl
.
Log
.
WithName
(
"controllers"
)
.
WithName
(
"gitlab"
)
.
WithName
(
"GitlabCredentials"
),
...
...
driver_test.go
View file @
19224546
...
...
@@ -9,7 +9,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"valkyrie.dso.mil/valkyrie-api/controllers"
"valkyrie.dso.mil/valkyrie-api/controllers/customer"
"valkyrie.dso.mil/valkyrie-api/controllers/fortify"
"valkyrie.dso.mil/valkyrie-api/controllers/gitlab"
"valkyrie.dso.mil/valkyrie-api/controllers/twistlock"
...
...
@@ -20,53 +19,38 @@ var _ = Describe("instantiateControllers", func() {
program
:=
&
driverImpl
{}
mgr
:=
MockManager
{}
controllers
:=
program
.
instantiateControllers
(
&
mgr
)
It
(
"Should create a Customer Controller"
,
func
()
{
Expect
(
controllers
[
0
])
.
To
(
BeAssignableToTypeOf
(
&
customer
.
Reconciler
{}))
})
It
(
"Should create a Organization Controller"
,
func
()
{
Expect
(
controllers
[
1
])
.
To
(
BeAssignableToTypeOf
(
&
customer
.
OrganizationReconciler
{}))
})
It
(
"Should create a Group Controller"
,
func
()
{
Expect
(
controllers
[
2
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
GroupReconciler
{}))
Expect
(
controllers
[
0
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
GroupReconciler
{}))
})
It
(
"Should create a Project Controller"
,
func
()
{
Expect
(
controllers
[
3
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
ProjectReconciler
{}))
Expect
(
controllers
[
1
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
ProjectReconciler
{}))
})
It
(
"Should create a Fortify Credential Controller"
,
func
()
{
Expect
(
controllers
[
4
])
.
To
(
BeAssignableToTypeOf
(
&
fortify
.
CredentialReconciler
{}))
Expect
(
controllers
[
2
])
.
To
(
BeAssignableToTypeOf
(
&
fortify
.
CredentialReconciler
{}))
})
It
(
"Should create a Fortify Configuration Controller"
,
func
()
{
Expect
(
controllers
[
5
])
.
To
(
BeAssignableToTypeOf
(
&
fortify
.
PipelineConfigurationReconciler
{}))
Expect
(
controllers
[
3
])
.
To
(
BeAssignableToTypeOf
(
&
fortify
.
PipelineConfigurationReconciler
{}))
})
It
(
"Should create a Twistlock Configuration Controller"
,
func
()
{
Expect
(
controllers
[
6
])
.
To
(
BeAssignableToTypeOf
(
&
twistlock
.
PipelineConfigurationReconciler
{}))
Expect
(
controllers
[
4
])
.
To
(
BeAssignableToTypeOf
(
&
twistlock
.
PipelineConfigurationReconciler
{}))
})
It
(
"Should create a Twistlock credential Controller"
,
func
()
{
Expect
(
controllers
[
7
])
.
To
(
BeAssignableToTypeOf
(
&
twistlock
.
CredentialReconciler
{}))
Expect
(
controllers
[
5
])
.
To
(
BeAssignableToTypeOf
(
&
twistlock
.
CredentialReconciler
{}))
})
It
(
"Should create a SonarQube Configuration Controller"
,
func
()
{
Expect
(
controllers
[
8
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
SonarqubePipelineConfigurationReconciler
{}))
Expect
(
controllers
[
6
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
SonarqubePipelineConfigurationReconciler
{}))
})
It
(
"Should create an SD Elements Configuration Controller"
,
func
()
{
Expect
(
controllers
[
9
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
SdElementsPipelineConfigurationReconciler
{}))
})
It
(
"Should create a Authorizing Official Controller"
,
func
()
{
Expect
(
controllers
[
10
])
.
To
(
BeAssignableToTypeOf
(
&
customer
.
AuthorizingOfficialReconciler
{}))
})
It
(
"Should create a System Owner Controller"
,
func
()
{
Expect
(
controllers
[
11
])
.
To
(
BeAssignableToTypeOf
(
&
customer
.
SystemOwnerReconciler
{}))
})
It
(
"Should create a ChiefInformationSecurityOfficer Controller"
,
func
()
{
Expect
(
controllers
[
12
])
.
To
(
BeAssignableToTypeOf
(
&
customer
.
ChiefInformationSecurityOfficerReconciler
{}))
Expect
(
controllers
[
7
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
SdElementsPipelineConfigurationReconciler
{}))
})
It
(
"Should create a GitlabCredentials Controller"
,
func
()
{
Expect
(
controllers
[
13
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
CredentialsReconciler
{}))
Expect
(
controllers
[
8
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
CredentialsReconciler
{}))
})
It
(
"Should create a DNSRepoCredential Controller"
,
func
()
{
Expect
(
controllers
[
14
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
DNSRepoCredentialReconciler
{}))
Expect
(
controllers
[
9
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
DNSRepoCredentialReconciler
{}))
})
It
(
"Should create a DNSRepoMergeRequest Controller"
,
func
()
{
Expect
(
controllers
[
1
5
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
DNSRepoMergeRequestReconciler
{}))
Expect
(
controllers
[
1
0
])
.
To
(
BeAssignableToTypeOf
(
&
gitlab
.
DNSRepoMergeRequestReconciler
{}))
})
})
})
...
...
main.go
View file @
19224546
...
...
@@ -28,7 +28,6 @@ import (
_
"k8s.io/client-go/plugin/pkg/client/auth"
ctrl
"sigs.k8s.io/controller-runtime"
customerv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/customer/v1alpha1"
fortifyv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/fortify/v1alpha1"
gitlabv1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/gitlab/v1alpha1"
sonarqubev1alpha1
"valkyrie.dso.mil/valkyrie-api/apis/sonarqube/v1alpha1"
...
...
@@ -47,7 +46,6 @@ var (
func
init
()
{
utilruntime
.
Must
(
clientgoscheme
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
customerv1alpha1
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
gitlabv1alpha1
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
sonarqubev1alpha1
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
fortifyv1alpha1
.
AddToScheme
(
scheme
))
...
...
Prev
1
2
3
Next