Skip to content

Commit

Permalink
Merge pull request #9555 from MoShitrit/issue-9151
Browse files Browse the repository at this point in the history
Adding feature stability table to docs and including one example for encryption support in cilium
  • Loading branch information
k8s-ci-robot authored Jul 16, 2020
2 parents cadd8ba + d43c9b5 commit 9d675e3
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@

.hidden {
display: none;
}

.kops_feature_table .md-typeset__table table{
max-width: fit-content;
}
2 changes: 2 additions & 0 deletions docs/networking/cilium.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ Note that since Cilium Operator is the entity that interacts with the EC2 API to
Also note that this feature has only been tested on the default kops AMIs.

#### Enabling Encryption in Cilium
{{ kops_feature_table(kops_added_default='1.19', k8s_min='1.17') }}

As of Kops 1.19, it is possible to enable encryption for Cilium agent.
In order to enable encryption, you must first generate the pre-shared key using this command:
```bash
Expand Down
23 changes: 23 additions & 0 deletions hack/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


def main():
pass


if __name__ == "__main__":
main()
26 changes: 26 additions & 0 deletions hack/mkdocs_macros/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from .feature_stability_table import define_env


def main():
pass


if __name__ == "__main__":
main()
68 changes: 68 additions & 0 deletions hack/mkdocs_macros/feature_stability_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env python

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


def define_env(env):
"""Hook function"""

@env.macro
def kops_feature_table(**kwargs):
"""
Generate a markdown table which will be rendered when called, along with the supported passed keyword args.
:param kwargs:
kops_added_ff => Kops version in which this feature was added as a feature flag
kops_added_default => Kops version in which this feature was introduced as stable
k8s_min => Minimum k8s version which supports this feature
:return: rendered markdown table
"""

# this dict object maps the kwarg to its description, which will be used in the final table
supported_args = {
'kops_added_ff': 'Alpha (Feature Flag)',
'kops_added_default': 'Default',
'k8s_min': 'Minimum K8s Version'
}

# Create the initial strings to which we'll concatenate the relevant columns
title = '** FEATURE STATE **\n\n|'
separators = '|'
values = '|'

# Iterate over provided supported kwargs and match them with the provided values.
for arg in supported_args.keys():
if arg in kwargs.keys():
title += f' {supported_args[arg]} |'
separators += ' :-: |'
values += f' Kops {kwargs[arg]} |'

# Create a list object containing all the table rows,
# Then return a string object which contains every list item in a new line.
table = [
title,
separators,
values
]
table = '\n'.join(table)
table = f'<div class="kops_feature_table">{table}</div>'
return table


def main():
pass


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion hack/update-header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"

BAD_HEADERS=$((${KOPS_ROOT}/hack/verify-boilerplate.sh || true) | awk '{ print $7}')
FORMATS="sh go Makefile Dockerfile"
FORMATS="sh go Makefile Dockerfile py"
YEAR=`date -u +%Y`
Expand Down
1 change: 1 addition & 0 deletions images/mkdocs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ mkdocs-material~=5.2.3
mkdocs~=1.1.2
pymdown-extensions==7.1
pygments~=2.6.1
mkdocs-macros-plugin~=0.4.9
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ theme:
accent: 'green'
plugins:
- search

- macros:
module_name: hack.mkdocs_macros
extra_css: [extra.css]

nav:
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[build]
publish = "site"
command = "make build-docs-netlify"
ignore = "git diff --quiet HEAD^ HEAD netlify.toml Makefile mkdocs.yml docs/ images/"
ignore = "git diff --quiet HEAD^ HEAD netlify.toml Makefile mkdocs.yml docs/ images/ hack/"
# available here https://github.com/netlify/build-image/blob/xenial/included_software.md#languages
environment = { PYTHON_VERSION = "3.7" }

0 comments on commit 9d675e3

Please sign in to comment.