-
Notifications
You must be signed in to change notification settings - Fork 20
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
CDAP-19300 adding container injection feature and Dockerfile for unit testing on Docker image #89
base: develop
Are you sure you want to change the base?
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Build the manager binary | ||
FROM golang:1.19 as tester | ||
|
||
ENV version 1.0.8 | ||
ENV arch amd64 | ||
|
||
# Copy everything in the go src | ||
WORKDIR /go/src/cdap.io/cdap-operator | ||
COPY ./ ./ | ||
|
||
# Install Kubebuilder | ||
RUN curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${version}_linux_${arch}.tar.gz" && \ | ||
tar -zxvf kubebuilder_${version}_linux_${arch}.tar.gz && \ | ||
mv kubebuilder_${version}_linux_${arch} /usr/local/kubebuilder && \ | ||
cp /usr/local/kubebuilder/bin/* /usr/local/bin | ||
|
||
# Install setup-envtest | ||
RUN go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
|
||
RUN go env -w GO111MODULE=auto | ||
|
||
# download envtest 1.19.x for kubebuilder and to set KUBEBUILDER_ASSETS environment variable | ||
RUN $(go env GOPATH)/bin/setup-envtest use -p env 1.19.x > /tmp/setup_envtest.sh && \ | ||
eval `$(go env GOPATH)/bin/setup-envtest use -p env 1.19.x` && \ | ||
rm /tmp/setup_envtest.sh | ||
|
||
CMD make test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,9 +128,41 @@ func ApplyDefaults(resource interface{}) { | |
} | ||
|
||
// Set the configMapCConf entry for the router and UI service and ports | ||
spec.Config[confRouterServerAddress] = fmt.Sprintf("cdap-%s-%s", r.Name, strings.ToLower(string(serviceRouter))) | ||
spec.Config[confRouterBindPort] = strconv.Itoa(int(*spec.Router.ServicePort)) | ||
spec.Config[confUserInterfaceBindPort] = strconv.Itoa(int(*spec.UserInterface.ServicePort)) | ||
if spec.Config[confRouterServerAddress] == "" { | ||
spec.Config[confRouterServerAddress] = fmt.Sprintf("cdap-%s-%s", r.Name, strings.ToLower(string(serviceRouter))) | ||
} | ||
if spec.Config[confRouterBindPort] == "" { | ||
spec.Config[confRouterBindPort] = strconv.Itoa(int(*spec.Router.ServicePort)) | ||
} | ||
if spec.Config[confUserInterfaceBindPort] == "" { | ||
spec.Config[confUserInterfaceBindPort] = strconv.Itoa(int(*spec.UserInterface.ServicePort)) | ||
} | ||
|
||
// Set the default local data directory if it is not set in cdap-cr. | ||
if _, ok := spec.Config[confLocalDataDirKey]; !ok { | ||
spec.Config[confLocalDataDirKey] = confLocalDataDirVal | ||
} | ||
|
||
// Set security secret disk names to be consistent with securitySecret if not overwritten. | ||
if _, ok := spec.Config[confTwillSecurityMasterSecretDiskName]; !ok && spec.SecuritySecret != "" { | ||
spec.Config[confTwillSecurityMasterSecretDiskName] = spec.SecuritySecret | ||
} | ||
if _, ok := spec.Config[confTwillSecurityMasterSecretDiskPath]; !ok && spec.SecuritySecret != "" { | ||
spec.Config[confTwillSecurityMasterSecretDiskPath] = defaultSecuritySecretPath | ||
} | ||
// This configuration makes the default securitySecret available to the workers by default. | ||
// TODO: Add support for secure-by-default configurations. | ||
if _, ok := spec.Config[confTwillSecurityWorkerSecretDiskName]; !ok && spec.SecuritySecret != "" { | ||
spec.Config[confTwillSecurityWorkerSecretDiskName] = spec.SecuritySecret | ||
} | ||
if _, ok := spec.Config[confTwillSecurityWorkerSecretDiskPath]; !ok && spec.SecuritySecret != "" { | ||
spec.Config[confTwillSecurityWorkerSecretDiskPath] = defaultSecuritySecretPath | ||
} | ||
|
||
// Set the default JMX server port if not set and system metrics exporter sidecar is enabled | ||
if _, ok := spec.Config[confJMXServerPort]; spec.SystemMetricsExporter != nil && !ok { | ||
spec.Config[confJMXServerPort] = fmt.Sprint(defaultJMXport) | ||
} | ||
|
||
// Set the default local data directory if it is not set in cdap-cr. | ||
if _, ok := spec.Config[confLocalDataDirKey]; !ok { | ||
|
@@ -166,9 +198,9 @@ func ApplyDefaults(resource interface{}) { | |
finalizer.EnsureStandard(r) | ||
} | ||
|
||
///////////////////////////////////////////////////////// | ||
///// Handling reconciling ConfigMapHandler objects ///// | ||
///////////////////////////////////////////////////////// | ||
// /////////////////////////////////////////////////////// | ||
// /// Handling reconciling ConfigMapHandler objects ///// | ||
// /////////////////////////////////////////////////////// | ||
type ConfigMapHandler struct{} | ||
|
||
func (h *ConfigMapHandler) Observables(rsrc interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable { | ||
|
@@ -257,9 +289,9 @@ func buildConfigMapObject(spec *ConfigMapSpec) reconciler.Object { | |
return obj | ||
} | ||
|
||
/////////////////////////////////////////////////////////// | ||
///// Handling reconciling deployment of all services ///// | ||
/////////////////////////////////////////////////////////// | ||
// ///////////////////////////////////////////////////////// | ||
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. nit: no spaces |
||
// /// Handling reconciling deployment of all services ///// | ||
// ///////////////////////////////////////////////////////// | ||
type ServiceHandler struct{} | ||
|
||
func (h *ServiceHandler) Observables(rsrc interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable { | ||
|
@@ -337,9 +369,9 @@ func CopyNodePortIfAny(expected, observed []reconciler.Object) { | |
} | ||
} | ||
|
||
/////////////////////////////////////////////////////// | ||
///// Handler for image version upgrade/downgrade ///// | ||
/////////////////////////////////////////////////////// | ||
// ///////////////////////////////////////////////////// | ||
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. nit: no spaces |
||
// /// Handler for image version upgrade/downgrade ///// | ||
// ///////////////////////////////////////////////////// | ||
type VersionUpdateHandler struct{} | ||
|
||
func (h *VersionUpdateHandler) Observables(rsrc interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable { | ||
|
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.
nit: no additional space