Skip to content

Commit

Permalink
Rename crdReplicator to crdreplicator for docker compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
palexster committed Nov 14, 2020
1 parent 83df613 commit d989ee7
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 43 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
echo "::set-output name=master::false"
echo "::set-output name=commit_ref::${{ github.event.pull_request.head.sha }}"
elif [ ! -z VERSION ]; then
elif [ "${{ steps.get_version.outputs.VERSION }}" != "" ]; then
echo "::set-output name=master::false"
echo "::set-output name=commit_ref::${{ steps.get_version.outputs.VERSION }}"
else
Expand All @@ -36,7 +36,7 @@ jobs:
fi
# The suffix to append to the repository name if not triggered by a push to master
[[ "${{ github.event_name }}" == "push" && -z VERSION ]] && \
[[ "${{ steps.get_version.outputs.VERSION }}" == "" ]] && \
echo "::set-output name=repo-suffix::-ci" ||
echo "::set-output name=repo-suffix::"
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- init-pod-mutator
- pod-mutator
- peering-request-webhook-init
- crdreplicator
- crd-replicator
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -85,8 +85,8 @@ jobs:
uses: docker/build-push-action@v2
with:
tags: |
liqo/${{ matrix.component }}:latest
liqo/${{ matrix.component }}:${{ needs.configure.outputs.commit_ref }}
liqo/${{ matrix.component }}${{ needs.configure.outputs.repo-suffix }}:latest
liqo/${{ matrix.component }}${{ needs.configure.outputs.repo-suffix }}:${{ needs.configure.outputs.commit_ref }}
push: ${{ needs.configure.outputs.repo-push }}
file: build/${{ matrix.component }}/Dockerfile

Expand All @@ -104,18 +104,7 @@ jobs:
- uses: actions/checkout@v2
with:
ref: "${{ env.commit_ref }}"
- name: "Make scripts executable"
run: chmod +x ./scripts/utils/*
- name: "Set PR number"
run: echo "branch_owner=`git log -1 --format='%ae' $commit_ref^!`"
- name: "Install python dependencies"
run: pip install requests
- name: "Notify PR Event to Liqops"
run: |
curl -X POST https://api.github.com/repos/liqotech/${{ matrix.component }}/dispatches \
-u ${{ secrets.CI_TOKEN }} \
--data '
- name: Notify Event to CrownOps
- name: Notify Event to ${{ matrix.component }}
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.CI_TOKEN }}
Expand Down Expand Up @@ -214,7 +203,6 @@ jobs:
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} kubebuilder && sudo mv kubebuilder /usr/local/
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Get dependencies for Test execution
run: |
Expand Down
11 changes: 11 additions & 0 deletions build/crd-replicator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.13 as builder
ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go
COPY . /go/src/github.com/liqotech/liqo
WORKDIR /go/src/github.com/liqotech/liqo
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./cmd/crd-replicator/
RUN cp crd-replicator /usr/bin/crd-replicator

FROM scratch
COPY --from=builder /usr/bin/crd-replicator /usr/bin/crd-replicator
ENTRYPOINT [ "/usr/bin/crd-replicator" ]
11 changes: 0 additions & 11 deletions build/crdReplicator/Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/crdReplicator/main.go → cmd/crd-replicator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ func main() {
RemoteDynSharedInformerFactory: make(map[string]dynamicinformer.DynamicSharedInformerFactory),
}
if err = d.SetupWithManager(mgr); err != nil {
klog.Error(err, "unable to setup the crdReplicator-operator")
klog.Error(err, "unable to setup the crdreplicator-operator")
os.Exit(1)
}
err = d.WatchConfiguration(cfg, &configv1alpha1.GroupVersion)
if err != nil {
klog.Error(err)
os.Exit(-1)
}
klog.Info("Starting crdReplicator-operator")
klog.Info("Starting crdreplicator-operator")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
klog.Error(err, "problem running manager")
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion deployments/liqo/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ dependencies:
- name: crdReplicator
version: "0.1.0"
repository: file://subcharts/crdReplicator/
condition: crdReplicator.enabled
condition: crdreplicator.enabled
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
- image: {{ .Values.image.repository }}{{ .Values.global.suffix | default .Values.suffix }}:{{ .Values.global.version | default .Values.version }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: crdreplicator-operator
command: ["/usr/bin/crdReplicator"]
command: ["/usr/bin/crd-replicator"]
env:
- name: NAMESPACE
valueFrom:
Expand Down
4 changes: 2 additions & 2 deletions deployments/liqo/subcharts/crdReplicator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Default values for crdReplicator.
# Default values for crdreplicator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
repository: liqo/crdreplicator
repository: liqo/crd-replicator
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.

Expand Down
2 changes: 1 addition & 1 deletion deployments/liqo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ liqodash:

crdReplicator:
image:
repository: "liqo/crdreplicator"
repository: "liqo/crd-replicator"
pullPolicy: "IfNotPresent"
enabled: true

Expand Down
4 changes: 2 additions & 2 deletions internal/discovery/discovery-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ func (discovery *DiscoveryCtrl) GetDiscoveryConfig(crdClient *crdClient.CRDClien
}

func (discovery *DiscoveryCtrl) handleDispatcherConfig(config configv1alpha1.DispatcherConfig) {
role, err := discovery.crdClient.Client().RbacV1().ClusterRoles().Get(context.TODO(), "crdReplicator-role", metav1.GetOptions{})
role, err := discovery.crdClient.Client().RbacV1().ClusterRoles().Get(context.TODO(), "crdreplicator-role", metav1.GetOptions{})
create := false
if errors.IsNotFound(err) {
// create it
role = &rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: "crdReplicator-role",
Name: "crdreplicator-role",
},
Rules: []rbacv1.PolicyRule{},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func (r *ForeignClusterReconciler) getForeignConfig(clusterID string, owner *dis
return "", err
}

// crdReplicator role binding
// crdreplicator role binding
err = r.setDispatcherRole(clusterID, sa)
if err != nil {
return "", err
Expand Down Expand Up @@ -804,12 +804,12 @@ func (r *ForeignClusterReconciler) createRoleBindingIfNotExists(clusterID string
}

func (r *ForeignClusterReconciler) setDispatcherRole(clusterID string, sa *apiv1.ServiceAccount) error {
_, err := r.crdClient.Client().RbacV1().ClusterRoleBindings().Get(context.TODO(), clusterID+"-crdReplicator", metav1.GetOptions{})
_, err := r.crdClient.Client().RbacV1().ClusterRoleBindings().Get(context.TODO(), clusterID+"-crdreplicator", metav1.GetOptions{})
if errors.IsNotFound(err) {
// does not exist
rb := &rbacv1.ClusterRoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: clusterID + "-crdReplicator",
Name: clusterID + "-crdreplicator",
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: "v1",
Expand All @@ -829,7 +829,7 @@ func (r *ForeignClusterReconciler) setDispatcherRole(clusterID string, sa *apiv1
RoleRef: rbacv1.RoleRef{
APIGroup: "rbac.authorization.k8s.io",
Kind: "ClusterRole",
Name: "crdReplicator-role",
Name: "crdreplicator-role",
},
}
_, err = r.crdClient.Client().RbacV1().ClusterRoleBindings().Create(context.TODO(), rb, metav1.CreateOptions{})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/crdReplicator/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func startDispatcherOperator() {
}
err = dOperator.WatchConfiguration(newConfig, &configv1alpha1.GroupVersion)
if err != nil {
klog.Errorf("an error occurred while starting the configuration watcher of crdReplicator operator: %s", err)
klog.Errorf("an error occurred while starting the configuration watcher of crdreplicator operator: %s", err)
os.Exit(-1)
}
fc := getForeignClusterResource()
Expand Down
1 change: 1 addition & 0 deletions test/unit/reflector/reflector.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package reflector

0 comments on commit d989ee7

Please sign in to comment.