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

Component-config flag enabled causing issue #3009

Closed
laxmikantbpandhare opened this issue Oct 9, 2022 · 2 comments · Fixed by #3010
Closed

Component-config flag enabled causing issue #3009

laxmikantbpandhare opened this issue Oct 9, 2022 · 2 comments · Fixed by #3010
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@laxmikantbpandhare
Copy link
Member

What broke? What's expected?

There are 2 places where we must revert the sign which we missed as part of old PR #2826

{{- if not .ComponentConfig }}
        args:
        - --leader-elect
{{- end }}

it should be now modified to

{{- if .ComponentConfig }}
        args:
        - --leader-elect
{{- end }}

As of now, we are scaffolding the controller_manager_config.yaml file only when the flag --component-config is passed.

Reproducing this issue

laxmikantbhaskarpandhare@lpandhar-mac test % cat config/manager/manager.yaml 
apiVersion: v1
kind: Namespace
metadata:
  labels:
    control-plane: controller-manager
    app.kubernetes.io/name: namespace
    app.kubernetes.io/instance: system
    app.kubernetes.io/component: manager
    app.kubernetes.io/created-by: test
    app.kubernetes.io/part-of: test
    app.kubernetes.io/managed-by: kustomize
  name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-manager
  namespace: system
  labels:
    control-plane: controller-manager
    app.kubernetes.io/name: deployment
    app.kubernetes.io/instance: controller-manager
    app.kubernetes.io/component: manager
    app.kubernetes.io/created-by: test
    app.kubernetes.io/part-of: test
    app.kubernetes.io/managed-by: kustomize
spec:
  selector:
    matchLabels:
      control-plane: controller-manager
  replicas: 1
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: manager
      labels:
        control-plane: controller-manager
    spec:
      securityContext:
        runAsNonRoot: true
        # TODO(user): For common cases that do not require escalating privileges
        # it is recommended to ensure that all your Pods/Containers are restrictive.
        # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
        # Please uncomment the following code if your project does NOT have to work on old Kubernetes
        # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ).
        # seccompProfile:
        #   type: RuntimeDefault
      containers:
      - command:
        - /manager
        args:
        - --leader-elect
        image: controller:latest
        name: manager
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
              - "ALL"
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 15
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 5
          periodSeconds: 10
        # TODO(user): Configure the resources accordingly based on the project requirements.
        # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
        resources:
          limits:
            cpu: 500m
            memory: 128Mi
          requests:
            cpu: 10m
            memory: 64Mi
      serviceAccountName: controller-manager
      terminationGracePeriodSeconds: 10

It should scaffold below code only when flag is passed.

        args:
        - --leader-elect

KubeBuilder (CLI) Version

v3.7.0

PROJECT version

No response

Plugin versions

v2-alpha and v1

Other versions

$ go version
go version go1.19.1 darwin/amd64
sigs.k8s.io/controller-runtime v0.13.0 // for `kubebuilder alpha config-gen`
sigs.k8s.io/controller-tools v0.10.0 
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"2c6062082e8dbbf36936b35dcc27c6882d3a2f67", GitTreeState:"clean", BuildDate:"2022-01-11T19:37:02Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:01:33Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}

Extra Labels

No response

@laxmikantbpandhare laxmikantbpandhare added the kind/bug Categorizes issue or PR as related to a bug. label Oct 9, 2022
@laxmikantbpandhare
Copy link
Member Author

/assign

@laxmikantbpandhare
Copy link
Member Author

@camilamacedo86 - Could you please take a look once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant