Skip to content

Unavailable/deprecated K8s APIs support - #1773

Merged
openshift-merge-robot merged 2 commits into
openshift-knative:mainfrom
skonto:deprecated_apis_fix_main
Oct 26, 2022
Merged

openshift-merge-robot merged 2 commits into
openshift-knative:mainfrom
skonto:deprecated_apis_fix_main

Conversation

@skonto

@skonto skonto commented Oct 19, 2022 •

Copy link
Copy Markdown
Collaborator

Fixes JIRA #

Proposed Changes

    security.openshift.io/scc.podSecurityLabelSync: "false"

Without this it seems things fail.

  • TODO: test on 4.12-nightly

Stavros Kontopoulos added 2 commits October 19, 2022 16:11
@openshift-ci
openshift-ci Bot requested review from alanfx and nak3 October 19, 2022 13:53
@skonto skonto changed the title Unavailable/deprecated K8s APIs support [wip] Unavailable/deprecated K8s APIs support Oct 19, 2022
rbacProxyTranform,
)
socommon.ConfigMapVolumeChecksumTransform(context.Background(), r.client, sets.NewString("config-tracing", "kafka-config-logging")),
rbacProxyTranform), socommon.DeprecatedAPIsTranformersFromConfig()...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeprecatedAPIsTranformersFromConfig ?

@skonto skonto Oct 19, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeprecatedAPIsTranformersFromVersion is more accurate the idea is to check the K8s version based on K8s config we create and return the right transformers. I will change the name.

@matzew

matzew commented Oct 20, 2022

Copy link
Copy Markdown
Member

/assign @matzew

- fs.StringVar(&c.Kubeconfig, "kubeconfig", os.Getenv("KUBECONFIG"),
- "Path to a kubeconfig. Only required if out-of-cluster.")
-
+ if fs.Lookup("kubeconfig") == nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? Is it somewhere tracked/addressed (ideally upstream)?

@skonto skonto Oct 20, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for double vendoring (kubernetes-sigs/controller-runtime#878), you need this so controller-runtime plays well. Otherwise you get an issue with the flag because that flag is also defined in knative.dev. It is a known issue afaik we cant do much, I adapted the fix here: kubernetes-sigs/controller-runtime#1999.

}
m, err := manifest.Transform(
tfs := []mf.Transformer{}
tfs = append(append(tfs,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the embedding here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kafka deployments dont need management?

)

// UpgradePodDisruptionBudget upgrade the API version to policy/v1
func UpgradePodDisruptionBudget() mf.Transformer {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine having this here, but isn't this also somewhat a concern for the upstream operator?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upstream operator has more freedom on what it supports (I guess it will make sure that it works on the three latest K8s versions). We have to support more versions.

func SetSecurityContextForAdmissionController() mf.Transformer {
return func(u *unstructured.Unstructured) error {
switch u.GetKind() {
case "Deployment":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soon we have statefulsets.apps here too /cc @pierDipi

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree

@pierDipi pierDipi Oct 25, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need this, let me know if I should follow up for statefulset support.


// CheckMinimumVersion checks if current K8s version we are on is higher than the one passed.
// If an error is returned then we
func CheckMinimumVersion(versioner discovery.ServerVersionInterface, version string) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we name this CheckMinimumKubeVersion ? (to avoid confusion w/ serverless versions)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

actualVersion: &testVersioner{version: "1.20.2-kpn-065dce"},
}, {
name: "greater version (patch), pre-release with build",
actualVersion: &testVersioner{version: "1.20.0-1095+9689d22dc3121e-dirty"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best version ever 😄 (ocp one, right?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha ;)

@matzew

matzew commented Oct 20, 2022

Copy link
Copy Markdown
Member

@skonto thanks a lot for this - I added a few comments, but this looks good to me!

@matzew

matzew commented Oct 21, 2022

Copy link
Copy Markdown
Member

On 4.11, I saw these on the Kafka deployments, like

...
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          seccompProfile:
            type: RuntimeDefault
...

(and midstream/upstream these settings do not exist)

@matzew

matzew commented Oct 21, 2022

Copy link
Copy Markdown
Member

Next: testing on OCP 4.10 ... to check for

Do NOT set seccomProfile if you want that your workloads/Operator solution works on versions < 4.11

@matzew

matzew commented Oct 21, 2022

Copy link
Copy Markdown
Member

on 4.10

oc get deployment controller -n knative-serving -oyaml

...
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - all
...

Or here oc get deployment kafka-broker-receiver -n knative-eventing -oyaml

...
        securityContext:
          allowPrivilegeEscalation: false
          privileged: false
          readOnlyRootFilesystem: true
...

oc get deployment eventing-controller -n knative-eventing -oyaml

...
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - all
          readOnlyRootFilesystem: true
          runAsNonRoot: true
...

@skonto I wonder on the all VERSUS ALL: I guess we need to patch midstream?

@matzew

matzew commented Oct 21, 2022

Copy link
Copy Markdown
Member

4.12
eventing-controller:

        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          seccompProfile:
            type: RuntimeDefault

broker-receiver:

        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          seccompProfile:
            type: RuntimeDefault

@skonto

skonto commented Oct 21, 2022 •

Copy link
Copy Markdown
Collaborator Author

I wonder on the all VERSUS ALL: I guess we need to patch midstream?

It would be good to do it there I have a PR for this: openshift/knative-serving#1272. In any case the patch here could protect us under any scenario as we have the ocp version and we can downgrade/upgrade whatever we want.
The only catch is that Serving depends on code as well not just manifests for hpa stuff as on 4.13( 1.26) we will need to solve this at midstream otherwise we will have a big issue. Right now we revert the upstream change from v2beta2 to v2 (autoscaling) at the midstream repo. 🤷

@matzew

matzew commented Oct 24, 2022

Copy link
Copy Markdown
Member

Right now we openshift/knative-serving#1275 the upstream change from v2beta2 to v2 (autoscaling) at the midstream repo. shrug

FWIW, The HPA change for upstream eventing was done just for 1.8, so is not relevant here:
knative/eventing#6549

@matzew

matzew commented Oct 24, 2022

Copy link
Copy Markdown
Member

@skonto let's get this merged, and we update the midstream serving/eventing manifests afterwards?

@matzew matzew changed the title [wip] Unavailable/deprecated K8s APIs support Unavailable/deprecated K8s APIs support Oct 24, 2022
@matzew

matzew commented Oct 24, 2022

Copy link
Copy Markdown
Member

I removed the WIP status...

@matzew matzew left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

/hold
for others to get some more reviews...

@openshift-ci

openshift-ci Bot commented Oct 24, 2022

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, skonto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@matzew

matzew commented Oct 24, 2022

Copy link
Copy Markdown
Member

on the all VERSUS ALL: I guess we need to patch midstream?

So, these have been:

  • merged on midstream
  • manifiests here being updated, via validation job

pierDipi added a commit to pierDipi/eventing-kafka-broker that referenced this pull request Oct 25, 2022
This config is not available in any supported OCP, it will
be added dynamically in [1].

[1] openshift-knative/serverless-operator#1773

Signed-off-by: Pierangelo Di Pilato <[email protected]>
@skonto

skonto commented Oct 26, 2022 •

Copy link
Copy Markdown
Collaborator Author

@matzew should we unhold? Will do a follow-up PR with any changes needed once midstream stuff is done.

@skonto

skonto commented Oct 26, 2022

Copy link
Copy Markdown
Collaborator Author

/test 4.11-osd-images

@skonto

skonto commented Oct 26, 2022

Copy link
Copy Markdown
Collaborator Author

/unhold

@openshift-merge-robot
openshift-merge-robot merged commit 1d93fd7 into openshift-knative:main Oct 26, 2022
pierDipi added a commit to pierDipi/eventing-kafka-broker that referenced this pull request Oct 28, 2022
This config is not available in any supported OCP, it will
be added dynamically in [1].

[1] openshift-knative/serverless-operator#1773

Signed-off-by: Pierangelo Di Pilato <[email protected]>
@skonto skonto mentioned this pull request Oct 31, 2022
pierDipi added a commit to openshift-knative/eventing-kafka-broker that referenced this pull request Nov 2, 2022
This config is not available in any supported OCP, it will
be added dynamically in [1].

[1] openshift-knative/serverless-operator#1773

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants