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

Remove deprecated kubebuilder config #205

Merged
merged 3 commits into from
Sep 22, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ jobs:
cat ./charts/${{ steps.name.outputs.name }}/values.yaml

- name: Save Chart Metadata
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v3
with:
name: chart-metadata
path: |
./charts/${{ steps.name.outputs.name }}/Chart.yaml

- name: Save Chart Values
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v3
with:
name: chart-values
path: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Set up Go environment
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down Expand Up @@ -125,8 +125,8 @@ jobs:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: metadata
with:
images: |
Expand All @@ -140,7 +140,7 @@ jobs:
type=semver,pattern=v{{major}}
type=sha
type=raw,value=${{ needs.meta.outputs.version }}
- uses: docker/build-push-action@v4
- uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
golang 1.20.7
golang 1.21.1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.20 as builder
FROM golang:1.21 as builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= ghcr.io/nais/unleasherator:main
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.25.0
ENVTEST_K8S_VERSION = 1.28.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
11 changes: 11 additions & 0 deletions api/v1/remoteunleash_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand All @@ -19,6 +20,16 @@ type mockClient struct {
mock.Mock
}

// GroupVersionKindFor implements client.Client.
func (*mockClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error) {
panic("unimplemented")
}

// IsObjectNamespaced implements client.Client.
func (*mockClient) IsObjectNamespaced(obj runtime.Object) (bool, error) {
panic("unimplemented")
}

func (m *mockClient) Get(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error {
args := m.Called(ctx, key, obj, opts)
return args.Error(0)
Expand Down
260 changes: 147 additions & 113 deletions charts/unleasherator-crds/templates/unleash-crd.yaml

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions charts/unleasherator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ spec:
values:
- linux
containers:
- args: {{- toYaml .Values.controllerManager.manager.args | nindent 8 }}
command:
- command:
- /manager
env:
- name: API_TOKEN_NAME_SUFFIX
Expand Down Expand Up @@ -68,6 +67,18 @@ spec:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: {{ quote .Values.controllerManager.manager.env.googleApplicationCredentials
}}
- name: HEALTH_PROBE_BIND_ADDRESS
value: {{ quote .Values.controllerManager.manager.env.healthProbeBindAddress
}}
- name: METRICS_BIND_ADDRESS
value: {{ quote .Values.controllerManager.manager.env.metricsBindAddress }}
- name: WEBHOOK_PORT
value: {{ quote .Values.controllerManager.manager.env.webhookPort }}
- name: LEADER_ELECTION_ENABLED
value: {{ quote .Values.controllerManager.manager.env.leaderElectionEnabled }}
- name: LEADER_ELECTION_RESOURCE_NAME
value: {{ quote .Values.controllerManager.manager.env.leaderElectionResourceName
}}
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ quote .Values.kubernetesClusterDomain }}
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag
Expand All @@ -91,9 +102,6 @@ spec:
securityContext: {{- toYaml .Values.controllerManager.manager.containerSecurityContext
| nindent 10 }}
volumeMounts:
- mountPath: /controller_manager_config.yaml
name: manager-config
subPath: controller_manager_config.yaml
- mountPath: /var/secrets/google
name: controller-manager-gcp
readOnly: true
Expand All @@ -119,9 +127,6 @@ spec:
serviceAccountName: {{ include "unleasherator.fullname" . }}-controller-manager
terminationGracePeriodSeconds: 10
volumes:
- configMap:
name: {{ include "unleasherator.fullname" . }}-manager-config
name: manager-config
- name: controller-manager-gcp
secret:
items:
Expand Down
9 changes: 0 additions & 9 deletions charts/unleasherator/templates/manager-config.yaml

This file was deleted.

38 changes: 5 additions & 33 deletions charts/unleasherator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ controllerManager:
cpu: 5m
memory: 64Mi
manager:
args:
- --config=controller_manager_config.yaml
containerSecurityContext:
allowPrivilegeEscalation: false
capabilities:
Expand All @@ -40,8 +38,13 @@ controllerManager:
federationPubsubSubscription: ""
federationPubsubTopic: ""
googleApplicationCredentials: ""
healthProbeBindAddress: :8081
httpsProxy: ""
leaderElectionEnabled: "true"
leaderElectionResourceName: 509984d3.nais.io
metricsBindAddress: 127.0.0.1:8080
noProxy: ""
webhookPort: "9443"
image:
repository: ghcr.io/nais/unleasherator
tag: main
Expand All @@ -58,37 +61,6 @@ controllerManager:
controllerManagerGcp:
serviceAccountCredentialsJson: ""
kubernetesClusterDomain: cluster.local
managerConfig:
controllerManagerConfigYaml: |-
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
metadata:
labels:
app.kubernetes.io/name: controllermanagerconfig
app.kubernetes.io/instance: controller-manager-configuration
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: unleasherator
app.kubernetes.io/part-of: unleasherator
app.kubernetes.io/managed-by: kustomize
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: 509984d3.nais.io
# leaderElectionReleaseOnCancel defines if the leader should step down volume
# when the Manager ends. This requires the binary to immediately end when the
# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
# speeds up voluntary leader transitions as the new leader don't have to wait
# LeaseDuration time first.
# In the default scaffold provided, the program ends immediately after
# the manager stops, so would be fine to enable this option. However,
# if you are doing or is intended to do any operation such as perform cleanups
# after the manager stops then its usage might be unsafe.
# leaderElectionReleaseOnCancel: true
metricsService:
ports:
- name: https
Expand Down
14 changes: 1 addition & 13 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ func init() {
}

func main() {
var configFile string
flag.StringVar(&configFile, "config", "",
"The controller will load its initial configuration from this file. "+
"Omit this flag to use the default configuration values. "+
"Command-line flags override configuration from this file.")
opts := zap.Options{
Development: true,
}
Expand All @@ -62,14 +57,7 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

options := ctrl.Options{Scheme: scheme}
if configFile != "" {
options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile))
if err != nil {
setupLog.Error(err, "unable to load the config file")
os.Exit(1)
}
}
options := cfg.ManagerOptions(scheme)

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options)
if err != nil {
Expand Down
Loading
Loading