Skip to content

Commit

Permalink
Init flux-operator API v1
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed May 29, 2024
1 parent 2e34a71 commit 62aed2b
Show file tree
Hide file tree
Showing 31 changed files with 129 additions and 129 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ COPY internal/ internal/
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o fluxcd-operator cmd/main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o flux-operator cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/fluxcd-operator .
COPY --from=builder /workspace/flux-operator .
COPY data/ /data/
USER 65532:65532

ENTRYPOINT ["/fluxcd-operator"]
ENTRYPOINT ["/flux-operator"]
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Image URL to use all building/pushing image targets
IMG ?= fluxcd-operator:latest
IMG ?= flux-operator:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.0

Expand Down Expand Up @@ -110,10 +110,10 @@ PLATFORMS ?= linux/arm64,linux/amd64
docker-buildx: ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name fluxcd-operator-builder
$(CONTAINER_TOOL) buildx use fluxcd-operator-builder
- $(CONTAINER_TOOL) buildx create --name flux-operator-builder
$(CONTAINER_TOOL) buildx use flux-operator-builder
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- $(CONTAINER_TOOL) buildx rm fluxcd-operator-builder
- $(CONTAINER_TOOL) buildx rm flux-operator-builder
rm Dockerfile.cross

.PHONY: build-installer
Expand All @@ -138,7 +138,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
mkdir -p config/dev && cp config/default/* config/dev
cd config/dev && $(KUSTOMIZE) edit set image ghcr.io/controlplaneio-fluxcd/fluxcd-operator=${IMG}
cd config/dev && $(KUSTOMIZE) edit set image ghcr.io/controlplaneio-fluxcd/flux-operator=${IMG}
$(KUSTOMIZE) build config/dev | $(KUBECTL) apply -f -
rm -rf config/dev

Expand Down
8 changes: 4 additions & 4 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
domain: controlplane.io
layout:
- go.kubebuilder.io/v4
projectName: fluxcd-operator
repo: github.com/controlplaneio-fluxcd/fluxcd-operator
projectName: flux-operator
repo: github.com/controlplaneio-fluxcd/flux-operator
resources:
- api:
crdVersion: v1
Expand All @@ -15,6 +15,6 @@ resources:
domain: controlplane.io
group: fluxcd
kind: FluxInstance
path: github.com/controlplaneio-fluxcd/fluxcd-operator/api/v1alpha1
version: v1alpha1
path: github.com/controlplaneio-fluxcd/flux-operator/api/v1
version: v1
version: "3"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# fluxcd-operator
# flux-operator
Flux CD Operator
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 Stefan Prodan.
// SPDX-License-Identifier: AGPL-3.0

package v1alpha1
package v1

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2024 Stefan Prodan.
// SPDX-License-Identifier: AGPL-3.0

// Package v1alpha1 contains API Schema definitions for the fluxcd v1alpha1 API group
// Package v1 contains API Schema definitions for the fluxcd v1 API group
// +kubebuilder:object:generate=true
// +groupName=fluxcd.controlplane.io
package v1alpha1
package v1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -13,7 +13,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "fluxcd.controlplane.io", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "fluxcd.controlplane.io", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down

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

8 changes: 4 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
ctrlcfg "sigs.k8s.io/controller-runtime/pkg/config"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

fluxcdv1alpha1 "github.com/controlplaneio-fluxcd/fluxcd-operator/api/v1alpha1"
"github.com/controlplaneio-fluxcd/fluxcd-operator/internal/controller"
fluxcdv1 "github.com/controlplaneio-fluxcd/flux-operator/api/v1"
"github.com/controlplaneio-fluxcd/flux-operator/internal/controller"
// +kubebuilder:scaffold:imports
)

Expand All @@ -38,7 +38,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(fluxcdv1alpha1.AddToScheme(scheme))
utilruntime.Must(fluxcdv1.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}

Expand Down Expand Up @@ -104,7 +104,7 @@ func main() {
controller.FluxInstanceReconcilerOptions{
RateLimiter: runtimeCtrl.GetRateLimiter(rateLimiterOptions),
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", fluxcdv1alpha1.FluxInstanceKind)
setupLog.Error(err, "unable to create controller", "controller", fluxcdv1.FluxInstanceKind)
os.Exit(1)
}
// +kubebuilder:scaffold:builder
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/fluxcd.controlplane.io_fluxinstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- jsonPath: .status.conditions[?(@.type=="Ready")].message
name: Status
type: string
name: v1alpha1
name: v1
schema:
openAPIV3Schema:
description: FluxInstance is the Schema for the fluxinstances API
Expand Down
2 changes: 1 addition & 1 deletion config/default/namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
name: flux-system
4 changes: 2 additions & 2 deletions config/default/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: fluxcd-operator-cluster-admin
name: flux-operator-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: fluxcd-operator
name: flux-operator
namespace: flux-system
4 changes: 2 additions & 2 deletions config/manager/account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
name: fluxcd-operator
app.kubernetes.io/name: flux-operator
name: flux-operator

12 changes: 6 additions & 6 deletions config/manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fluxcd-operator
name: flux-operator
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
spec:
selector:
matchLabels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
replicas: 1
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
spec:
serviceAccountName: fluxcd-operator
serviceAccountName: flux-operator
terminationGracePeriodSeconds: 10
affinity:
nodeAffinity:
Expand All @@ -30,7 +30,7 @@ spec:
- linux
containers:
- name: manager
image: fluxcd-operator:latest
image: flux-operator:latest
imagePullPolicy: IfNotPresent
securityContext:
readOnlyRootFilesystem: true
Expand Down
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ resources:
- deployment.yaml
- service.yaml
images:
- name: fluxcd-operator
newName: ghcr.io/controlplaneio-fluxcd/fluxcd-operator
- name: flux-operator
newName: ghcr.io/controlplaneio-fluxcd/flux-operator
newTag: v0.0.1
6 changes: 3 additions & 3 deletions config/manager/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
name: fluxcd-operator
app.kubernetes.io/name: flux-operator
name: flux-operator
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
selector:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
2 changes: 1 addition & 1 deletion config/rbac/fluxinstance_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
app.kubernetes.io/managed-by: kustomize
name: fluxinstance-editor-role
rules:
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/fluxinstance_viewer_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
app.kubernetes.io/managed-by: kustomize
name: fluxinstance-viewer-role
rules:
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/leader_election_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
app.kubernetes.io/managed-by: kustomize
name: leader-election-role
rules:
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/leader_election_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
app.kubernetes.io/managed-by: kustomize
name: leader-election-rolebinding
roleRef:
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
app.kubernetes.io/managed-by: kustomize
name: manager-rolebinding
roleRef:
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/service_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: fluxcd-operator
app.kubernetes.io/name: flux-operator
app.kubernetes.io/managed-by: kustomize
name: controller-manager
namespace: system
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: fluxcd.controlplane.io/v1alpha1
apiVersion: fluxcd.controlplane.io/v1
kind: FluxInstance
metadata:
name: flux
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/controlplaneio-fluxcd/fluxcd-operator
module github.com/controlplaneio-fluxcd/flux-operator

go 1.22.0

Expand Down
Loading

0 comments on commit 62aed2b

Please sign in to comment.